var bbo_poker_table_title;
var bbo_poker_table_picture=new Array();
var bbo_poker_table_category=new Array();
var bbo_poker_table_product=new Array();
var option_count=-1;
var bbo_poker_table_current_id=0;
var promotion_sign=false;

var mouse_x;
var mouse_y;

function showmouseinfo(event1)
{
    if(!document.all){
        mouse_x=event1.pageX;
        mouse_y=event1.pageY;

    }else{
        mouse_x=document.documentElement.scrollLeft+event.clientX;
        mouse_y=document.documentElement.scrollTop+event.clientY;
    }
}

document.onmousemove=showmouseinfo;

function GetTitle(Description,top,left,img)
{
	var ClientWidth=document.body.clientWidth;
	//alert("");
	if(bbo_poker_table_product[img][1]==0&&(Description.indexOf(".jpg")<0))
	{
		$("#plus_description").html("<span style=\"font-size:11px; text-align:center;display:block;\">"+Description+"</span>");
		$("#plus_description").css("top",top-27+"px");
	}
	else if(!(Description.indexOf(".jpg")<0))
	{
		$("#plus_description").html("<span style=\"font-size:11px; text-align:center;display:block;\">"+Description+"</span>");
		$("#plus_description").css("top",top-95+"px");
	}
	else if(Description.indexOf("Dye Sub Graphics")>0)
	{
		$("#plus_description").html("<span style=\"font-size:11px; text-align:center;display:block;\"><a href='/custom_tables.html' style='text-decoration:none;'><img src='/poker_tables_images/dye/d--s.jpg' width=100><br>"+Description+"</a></span>");
			$("#plus_description").css("top",top-95+"px");
	}
	else
	{
		//alert("test");
		if(Description.indexOf("<br/>")>0)
		{
			$("#plus_description").html("<span style=\"font-size:11px; text-align:center;display:block;\"><img src="+bbo_poker_table_picture[bbo_poker_table_product[img][4]][0]+" width=100><br>"+Description+"</span>");
			$("#plus_description").css("top",top-108+"px");
		}
		else
		{
			$("#plus_description").html("<span style=\"font-size:11px; text-align:center;display:block;\"><img src="+bbo_poker_table_picture[bbo_poker_table_product[img][4]][0]+" width=100><br>"+Description+"</span>");
			$("#plus_description").css("top",top-95+"px");
		}
	}
	

	$("#plus_description").css("position","absolute");
	
	$("#plus_description").css("filter","Alpha(opacity=90)");
	$("#plus_description").css("-moz-opacity",".9");
	$("#plus_description").css("opacity","0.9");

	$("#plus_description").css("display","");
	$("#plus_description").css("background-color","#000");
	$("#plus_description").css("padding","5px");
	$("#plus_description").css("border","1px solid #ccc");
	


	
	if((mouse_x+50)>ClientWidth)
	{
		mouse_x=ClientWidth-50;
	}
	
	$("#plus_description").css("left",left+"px");
}


function EmptyTitle()
{
	$("#plus_description").css("display","none");
}


function addMethod(object, name, fn){    
	var old = object[ name ];
	object[ name ] = function(){
		if ( fn.length == arguments.length ){
			   return fn.apply( this, arguments );
		   }
		else if ( typeof old == 'function' ){
			  return old.apply( this, arguments );
		  }
	  }
}


function outputMoney(number) {
number=number.replace(/\,/g,"");
if (isNaN(number)||number=="") return "";
number = Math.round( number*100) /100;
if(number<0)
return '-'+outputDollars(Math.floor(Math.abs(number)-0) + '') + outputCents(Math.abs(number) - 0);
else
return outputDollars(Math.floor(number-0) + '') + outputCents(number - 0);
}
function outputDollars(number)
{
if (number.length<= 3)
return (number == '' ? '0' : number);
else
{
    var mod = number.length%3;
    var output = (mod == 0 ? '' : (number.substring(0,mod)));
    for (i=0 ; i< Math.floor(number.length/3) ; i++)
    {
      if ((mod ==0) && (i ==0))
      output+= number.substring(mod+3*i,mod+3*i+3);
      else
      output+= ',' + number.substring(mod+3*i,mod+3*i+3);
    }
    return (output);
}
}
function outputCents(amount)
{
amount = Math.round( ( (amount) - Math.floor(amount) ) *100);
return (amount<10 ? '.0' + amount : '.' + amount);
}



function bbo_poker_table_option_add(category_id,product_id,attribute_name,price,picture_id,selected,original_images)
{
	option_count+=1;	
	bbo_poker_table_product[option_count]=new Array(category_id,product_id,attribute_name,price,picture_id,selected,original_images);
}

function bbo_poker_table_display_images_word()
{
	document.write('<span id="bbo_poker_table_display_images_word_id">Click to enlarge</span>');	

	$("#bbo_poker_table_display_images_word_id").css("top",$("#bbo_poker_table_display_images_id").position().top+176+"px");
	$("#bbo_poker_table_display_images_word_id").css("left",$("#bbo_poker_table_display_images_id").position().left+120+"px");

	$("#bbo_poker_table_display_images_word_id").css("text-align","center");
	$("#bbo_poker_table_display_images_word_id").css("width","100px");
	$("#bbo_poker_table_display_images_word_id").css("position","absolute");
}

function bbo_poker_table_display_images()
{
	var i;
	var images_count;
	
	if (bbo_poker_table_picture.length>16)
	{
		images_count=16;
	}
	else
	{
		images_count=bbo_poker_table_picture.length;
	}

	document.write('<div class="product_images">');	
	
	document.write('<div id="bbo_poker_table_product_main_image" class="main_picture">');	
    document.write('<a href="javascript:bbo_product_images_module(0);"><img src="'+bbo_poker_table_picture[0][0]+'" id="bbo_poker_table_display_images_id" alt="'+bbo_poker_table_picture[0][3]+'" title="'+bbo_poker_table_picture[0][3]+'"/></a>');
	bbo_poker_table_display_images_word();
    document.write('</div>');
	
	document.write('<ul>');	
	
	for (i=0;i<images_count;i++)
	{		
		document.write('<li><a href="javascript:bbo_product_images_module('+i+');"><img src="'+bbo_poker_table_picture[i][0]+'" alt="'+bbo_poker_table_picture[i][3]+'" title="'+bbo_poker_table_picture[i][3]+'"/></a></li>');	
	}
	
	document.write('</ul>');
	
	document.write('<div class="product_images_text" style="text-align:center;clear:both;"><a href="javascript:bbo_product_images_module(0);" style="color:#ccc;text-decoration:none;">Click for more views!</a></div>');	
	
	document.write('</div>');	

	
				
}

function bbo_poker_table_display()
{
	var i;
	var ii;
	var selected_attribute;
	var quantity;
	
	bbo_poker_table_display_images();
	
	
	//alert("test");
	document.write('<div class="buy_functions">');
	
	document.write('<form id="form1" name="form1" method="post" action="/pokertables/index.php?action=multiple_products_add_product">');
	

    document.write('<div class="buy_qty">');
    document.write('<h4>QTY</h4>');
    document.write('<ul>');
    document.write('<li>');
    document.write('<input name="bbo_poker_table_product_quantity" type="text" id="bbo_poker_table_product_quantity" value="1" size="5" class="qty" onkeyup="bbo_poker_table_total_price();"/>');
    document.write('</li>');
    document.write('</ul>');
    document.write('</div>');


	for (i=0;i<bbo_poker_table_category.length;i++)
	{
		
		
		
		if(bbo_poker_table_category[i][0]=="Chair Combo")
		{
			document.write('<h3 class="'+bbo_poker_table_category[i][1]+'" style="margin-bottom:0px;padding-bottom:0px;">'+bbo_poker_table_category[i][0]+'</h3>');
			document.write('<div style="float:left;clear:both;margin-bottom:3px;"><a href="/poker_table_chair_black.html" style="color:#999; text-decoration:none;font-size:10px;">Matching Poker Dining Chair</a></div>');   
			
		}
		else if(bbo_poker_table_category[i][0]=="Premium Chair Combo")	
		{
				document.write('<div style="float:left;clear:both;margin-bottom:3px;"><a href="/Premium-Poker-Table-Chairs.html" style="color:#999; text-decoration:none;font-size:10px;">Premium Poker Lounge Chair</a></div>');
		}
		else
		{document.write('<h3 class="'+bbo_poker_table_category[i][1]+'" style="margin-bottom:0px;padding-bottom:0px;">'+bbo_poker_table_category[i][0]+'</h3>');
		}
document.write('<ul class="'+bbo_poker_table_category[i][1]+'">');

		for (ii=0;ii<bbo_poker_table_product.length;ii++)
		{
			if(bbo_poker_table_product[ii][0]==i)
			{
				
				if(bbo_poker_table_product[ii][5]==1)
				{
					selected_attribute=" class=\"selected\"";
					quantity=$("#bbo_poker_table_product_quantity").val();
				}
				else
				{
					selected_attribute="";
					quantity=0;
				}				
				
				document.write('<li><img src="'+bbo_poker_table_product[ii][6]+'" onclick="bbo_poker_table_selector('+ii+');" id="bbo_poker_table_product_attribute_id_'+ii+'"'+selected_attribute+' onmousemove="GetTitle(\''+bbo_poker_table_product[ii][2]+'\',$(this).position().top,$(this).position().left,'+ii+')" onmouseout="EmptyTitle();"/></a><input type="hidden" name="products_id['+bbo_poker_table_product[ii][1]+']" id="products_id_get_'+ii+'" value="'+quantity+'" /></li>');				
			}
		}

		
		if(bbo_poker_table_category[i][0]=="Chairs"||bbo_poker_table_category[i][0]=="Matching Chair")
		{
			document.write('<li><input name="c_qty" type="text" id="c_qty" value="1" size="5" class="qty" onkeyup="bbo_poker_table_total_price();"/></li>');	
		}
		
        document.write('</ul>');	
	}

	$.getScript("/template/javascript/uniworld_pop_windows.js");
	document.write('<div class="buy_now_button"><input type="image" name="imageField" id="imageField" src="/template/upload/file/2011-6/newGenIIIpage_button.png" /><span id="buy_now_status" style="color:#fff;"></span><img src="template/upload/file/2011-11/4/whybuy-btn.png" class="why_buy_bbo" style="margin-left:20px;cursor:pointer;"/></div>');
	document.write('<div class="bbo_promotion"></div>');
	document.write('</form>');
	
	document.write('</div>');
	
	document.write('<div id="plus_description" style="display:none;"></div>');
	
	document.write('<div id="PopDiv01" style="display:none;"></div><div id="PopDiv02" style="display:none;"></div>');
	
	
	
	
}



function bbo_poker_table_display_1()
{
	var i;
	var ii;
	var selected_attribute;
	var quantity;
	
	bbo_poker_table_display_images();
	

	
	document.write('<div id="plus_description" style="display:none;"></div>');
	
	document.write('<div id="PopDiv01" style="display:none;"></div><div id="PopDiv02" style="display:none;"></div>');
	
	$("#bbo_poker_table_display_images_word_id").css("display","none");
	
	
}



function bbo_poker_table_selector(attribute_id)
{
	
	var i;
	for (i=0;i<bbo_poker_table_product.length;i++)
	{
		if(bbo_poker_table_product[attribute_id][0]==bbo_poker_table_product[i][0])
		{
			if(i==attribute_id)
			{
				$("#bbo_poker_table_product_attribute_id_"+i).addClass('selected'); 
				$("#bbo_poker_table_product_main_image").html('<a href="javascript:bbo_product_images_module('+bbo_poker_table_product[i][4]+');"><img src="'+bbo_poker_table_picture[bbo_poker_table_product[i][4]][0]+'" id="bbo_poker_table_display_images_id"/></a><span id="bbo_poker_table_display_images_word_id_'+i+'">Click to enlarge</span>');				
			

				$("#bbo_poker_table_display_images_word_id_"+i).css("top",$("#bbo_poker_table_display_images_id").position().top+136+"px");
				$("#bbo_poker_table_display_images_word_id_"+i).css("left",$("#bbo_poker_table_display_images_id").position().left+120+"px");
				$("#bbo_poker_table_display_images_word_id_"+i).css("width","100px");
				$("#bbo_poker_table_display_images_word_id_"+i).css("text-align","center");
				$("#bbo_poker_table_display_images_word_id_"+i).css("position","absolute");
				
				bbo_poker_table_product[i][5]=1;

			}
			else
			{
				$("#bbo_poker_table_product_attribute_id_"+i).removeClass('selected'); 
				bbo_poker_table_product[i][5]=0;

			}
		}
	}	
	
	
	bbo_poker_table_total_price();	
}

function bbo_poker_table_total_price()
{
	
	var i;
	var total_price=0;
	
	for (i=0;i<bbo_poker_table_product.length;i++)
	{
		if(bbo_poker_table_product[i][5]==1)
		{

			if(bbo_poker_table_category[bbo_poker_table_product[i][0]][0]!="Chairs"||parseInt($("#c_qty").val())==1||bbo_poker_table_category[bbo_poker_table_product[i][0]][0]!="Matching Chair")
			{
				total_price+=(bbo_poker_table_product[i][3]*(parseInt($("#bbo_poker_table_product_quantity").val())));
			}
			else
			{
				total_price+=(bbo_poker_table_product[i][3])*(parseInt($("#c_qty").val()));
			}
		}
	}	
	
	/*if (total_price>498)
	{
		$(".bbo_promotion").html('<input type="hidden" name="products_id[262]" value="1" /></li>');
	}
	else
	{
		$(".bbo_promotion").html("");
	}*/
	
	if(bbo_poker_table_title=="Casino X - CLOSEOUT")
	{
		$("#bbo_poker_table_product_total_price").html("<span style=\"text-decoration:line-through; color:#900;\">$995.00 Free S&amp;H</span><br>$"+outputMoney(""+total_price+"")+" Free Shipping ");	
	}
	else if(bbo_poker_table_title=="Casino X2 Ultra Setup - Professional Card Room Poker Table ")
	{
		//alert("dd");
		//$("#bbo_poker_table_product_total_price").html("$"+outputMoney(""+total_price+"")+" Free Shipping ");
				$("#bbo_poker_table_product_total_price").html("<font style=\"text-decoration:line-through;\">$1399</font> <font style=\"color:#c00;\"><span style='text-decoration:line-through;'>$"+outputMoney(""+(total_price-560)+"")+" CLOSEOUT 40% OFF</span> - SOLD OUT</font> ");
		}
	else
	{	
		if (window.location.pathname=="/v5series.htm")
		{
			$("#bbo_poker_table_product_total_price").html("<font style=\"text-decoration:line-through;\">$549</font> <font style=\"color:#c00;\">$"+outputMoney(""+(total_price-110)+"")+" Free Shipping</font> ");
		}
		else
		{
			$("#bbo_poker_table_product_total_price").html("$"+outputMoney(""+total_price+"")+" Free Shipping ");
		}
		
	}
	bbo_poker_table_get_param();
	
}



function bbo_product_images_module(image_id)
{
	$("#bbo_poker_table_product_main_image").html('<a href="javascript:bbo_product_images_module('+image_id+');"><img src="'+bbo_poker_table_picture[image_id][0]+'" id="bbo_poker_table_display_images_id"/></a><span id="bbo_poker_table_display_images_word_id_'+image_id+'">Click to enlarge</span>');
	$("#bbo_poker_table_display_images_word_id_"+image_id).css("top",$("#bbo_poker_table_display_images_id").position().top+136+"px");
				$("#bbo_poker_table_display_images_word_id_"+image_id).css("left",$("#bbo_poker_table_display_images_id").position().left+120+"px");
				$("#bbo_poker_table_display_images_word_id_"+image_id).css("width","100px");
				$("#bbo_poker_table_display_images_word_id_"+image_id).css("text-align","center");
				$("#bbo_poker_table_display_images_word_id_"+image_id).css("position","absolute");
	uniworld__confirm(image_id);
}


function uniworld__black_background_flash()
{
	var html11="";
	html11+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="960" height="300">';
	html11+='<param name="movie" value="/template/flash/Main.swf" />';
	html11+='<param name="quality" value="high" />';
	html11+='<param name="wmode" value="transparent" />';
	html11+='<embed src="/template/flash/Main.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="960" height="300" wmode="transparent"></embed>';
	html11+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="960" height="300">';
	html11+='</object>';     
	uniworld__black_background(html11);	
}



function uniworld__black_background_gallery(html)
{
	var Height_e;
	var width=document.body.clientWidth;
	if(document.documentElement.scrollHeight<window.screen.availHeight)
	{
		Height_e=window.screen.availHeight;
	}
	else
	{
		Height_e=document.documentElement.scrollHeight;		
	}
	
	
	
	$("#PopDiv01").css("position","absolute");
	$("#PopDiv01").css("left","0px");
	$("#PopDiv01").css("width",width+"px");
	$("#PopDiv01").css("height",Height_e+"px");
	$("#PopDiv01").css("top","0px");
	$("#PopDiv01").css("background-color","#fff");
	$("#PopDiv01").css("filter","alpha(opacity=50)");
	$("#PopDiv01").css("-moz-opacity","0.5");
	$("#PopDiv01").css("z-index","99");

	$("#PopDiv01").css("opacity","0.5");
	
	$("#PopDiv02").css("z-index","100");
	$("#PopDiv02").css("position","absolute");
	$("#PopDiv02").css("top",(parseInt(document.documentElement.scrollTop)+10)+"px");
	$("#PopDiv02").css("left","0px");
	$("#PopDiv02").css("width",width+"px");
	
	$("#PopDiv02").fadeIn();
	$("#PopDiv01").fadeIn();
	
	
	$("#PopDiv02").html('<div style="width:960px; margin:0 auto; " id="go_images_zone">'+html+'</div>');
	//$("img.original_picture").click(uniworld__confirm_close);
	//$("#PopDiv02").click(uniworld__confirm_close);
	$("#go_images_zone").hover(
  function () {
	 // alert("ddd");
   $("#PopDiv02").unbind("click");
  },
  function () {
	 // alert("ff");
    $("#PopDiv02").click(uniworld__confirm_close_gallery);
  }
);




}


function uniworld__confirm_close()
{
	$("#PopDiv02").fadeOut();
	$("#PopDiv01").fadeOut();
}

function uniworld__confirm_close_gallery()
{
	$("#PopDiv02").fadeOut();
	$("#PopDiv01").fadeOut();
}



function uniworld__confirm(image_id)
{
	var html="";
	var i;
	var ii=0;
	var total_price=0;
	var selecte_class="";
	//alert("debug");
	//alert(image_id);
	//alert(bbo_poker_table_picture.length);
	bbo_poker_table_current_id=image_id;
	
	html+='<div class="image_pop">';
	
	html+='<div class="head">';	

	html+='<a href="javascript:uniworld__confirm_close();" style="background-image:url(/template/upload/file/2010-1-27/Close_button.jpg);height:26px;width:26px;overflow:hidden;float:right;margin:10px; clear:both;"></a>';
	
	html+="</div>"

	html+='<div class="big-image">';
	
	if(bbo_poker_table_picture[image_id][2].indexOf("hi-res")>0)
	{
		//alert(bbo_poker_table_picture[image_id][2]);
	//html+='<a href="javascript:bbo_poker_table_go_next_picture();"><img src="'+bbo_poker_table_picture[image_id][1].replace("--s","")+'" alt="'+bbo_poker_table_picture[image_id][3]+'" title="'+bbo_poker_table_picture[image_id][3]+'" class="bbo_gallery" oringal_image="'+bbo_poker_table_picture[image_id][2]+'"/></a>';
	html+='<a href="javascript:bbo_poker_table_go_next_picture();"><img src="'+bbo_poker_table_picture[image_id][2]+'" alt="'+bbo_poker_table_picture[image_id][3]+'" title="'+bbo_poker_table_picture[image_id][3]+'" class="bbo_gallery" oringal_image="'+bbo_poker_table_picture[image_id][2]+'"/></a>';
	}
	else
	{
		html+='<a href="javascript:bbo_poker_table_go_next_picture();"><img src="'+bbo_poker_table_picture[image_id][1].replace("--s","")+'" alt="'+bbo_poker_table_picture[image_id][3]+'" title="'+bbo_poker_table_picture[image_id][3]+'"/></a>';
	}

	//html+='<a href="javascript:uniworld__confirm_close();"><img src="'+bbo_poker_table_picture[image_id][1].replace("--s","")+'" alt="'+bbo_poker_table_picture[image_id][3]+'" title="'+bbo_poker_table_picture[image_id][3]+'"/></a>';

	html+='</div>';

	html+='<div class="images_list">';
	
	html+='<div class="images_list_wrap">';
	
	for(i=0;i<bbo_poker_table_picture.length;i++)
	{
		html+='<ul>';
		html+='<li>';
		
		if(image_id==i)
		{
			selecte_class=' class="selected_images"';
		}
		else
		{
			selecte_class=' class=""';
		}
		
		html+='<img src="'+bbo_poker_table_picture[i][0]+'" onclick="javascript:bbo_product_images_module('+i+');"'+selecte_class+' alt="'+bbo_poker_table_picture[i][3]+'" title="'+bbo_poker_table_picture[i][3]+'"/>';

		html+='</li>';
		html+='</ul>';
	}
	html+='</div>';	
	
	html+='</div>';	
	
	html+='<div class="images_count"></div>';	
	
	html+='</div>';	
	
	
	uniworld__black_background_gallery('<div style="margin:0 auto; width:650px;">'+html+'</div>');
	try
	{
		$("div.bbo_gallery_hover_section").remove();
		bbo_gallery_zoom();
	}
		catch(e)
	{}


}


function bbo_poker_table_get_param()
{
	var i;
	var ii;
	
	for (ii=0;ii<bbo_poker_table_product.length;ii++)
	{
		
		if(bbo_poker_table_product[ii][5]==1)
		{
			//alert(bbo_poker_table_product[ii][2]+"ddd");
			if(bbo_poker_table_category[bbo_poker_table_product[ii][0]][0]=="Chairs"||bbo_poker_table_category[bbo_poker_table_product[ii][0]][0]=="Matching Chair")
			{		
				
				$("#products_id_get_"+ii).val($("#c_qty").val());
				//alert(bbo_poker_table_product[ii][2]+"==>>"+$("#products_id_get_"+ii).val());
			}	
			else
			{
				$("#products_id_get_"+ii).val($("#bbo_poker_table_product_quantity").val());				
			}
		
		}			
		else			
		{
			$("#products_id_get_"+ii).val(0);	
		}	

	}	
		
}

function bbo_poker_table_go_next_picture()
{
	
	bbo_poker_table_current_id+=1;
	//alert(current_id_);
	if(bbo_poker_table_current_id==bbo_poker_table_picture.length)
	{
		bbo_poker_table_current_id=0;
	}
	
	bbo_product_images_module(bbo_poker_table_current_id);
	
	
}


function get_bbo_poker_table_title(title)
{
	if(title=="Gen III Poker Table")
	{
		return "Gen III Poker Table - Limited Edition";
	}
	else if(title=="Ultimate Poker Table Jr")
	{
		return "Ultimate Poker Table Jr";
	}
	else if(title=="V5 Series Specialized")
	{
		return "V5 Series Pro";
	}
	else if(title=="Ultimate Poker Table")
	{
		return "Ultimate Poker Table";
	}
	else if(title=="Casino X2 Ultra Setup - Professional Card Room Poker Table ")
	{
		return "Casino X2";
	}
	else if(title=="The Elite Poker Table")
	{
		return "The Elite";
	}
	
	else if(title=="BBO Premier")
	{
		return "The Premier";
	}
	
	else if(title=="Rockwell")
	{
		return "The Rockwell";
	}
	
	else if(title=="The Royale ¨C Sunken Playing Surface Card Table")
	{
		return "The Royale";
	}
	
	else if(title=="Nighthawk")
	{
		return "The Nighthawk";
	}
	
	else if(title=="Classic Poker Table Chair")
	{
		return "Poker Chair";
	}
	else if(title=="Albatross Leaf Poker Table")
	{
		return "The Albatross Leaf Poker Table";
	}
	
	else
	{
		return title;	
	}
}


$(function(){
		   
		   

		   if($(".product_content").length>0)
		   {
		   $(".buy_section .path").html("");
		   if($("h1.video").length>0)
		   {
		   $("h1.video").html($("h1.video").html().replace("Video:","<span style='color:#fff;'>Video:</span>"));
		   //$("h1.video").html($("h1.video").html().replace("Video:","<span style='color:#fff;'>Video:</span>"));
		   }
		   
		   $(".product_content .description >p").insertBefore(".product_content .specs h2:eq(0)");
		   $(".product_content .similar").insertAfter(".product_content .description div");
		    
			if($("table.buy-section").length==0)
			{
			$.getScript("/template/javascript/uniworld_pop_windows_images.js");
				//alert(get_bbo_poker_table_title(bbo_poker_table_title));
		   $(".center .buy_section").before('<div class="center_title" style="float:left;"><h1>'+get_bbo_poker_table_title(bbo_poker_table_title)+'</h1><h2 id="bbo_poker_table_product_total_price"></h2><div style="margin-left:20px;"><p><iframe src="http://www.facebook.com/plugins/like.php?href='+escape(location.href.replace("localhost:8022","www.bbopokertables.com")).replace(/\//g,"%2F")+'&amp;layout=button_count&amp;show_faces=false&amp;width=90&amp;action=like&amp;font&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px; height:21px;" allowTransparency="true"></iframe></p><p><g:plusone size="medium"></g:plusone></p></div></div><div style="float:right;font-size:14px;font-weight:bold;margin-right:50px;margin-top:10px;">');
		   
		   //<a href="javascript:uniworld_pop_windows(\'/images/promotion/2011-6-30/special-banner-img.jpg\');" rel="zoom-position: inner;" style="text-decoration:none;" class="promotion_715"><u>FREE</u> COPAG + COVER THIS WEEKEND!</a></div>

		   //$.getScript("/template/javascript/mzp-packed.js");
		  // $.getScript("/template/javascript/ze-lin-tools.js");
		   //$.getScript("/template/javascript/uniworld_pop_pokertables.js");
		   $.getScript("https://apis.google.com/js/plusone.js");
		   $.getScript("/template/javascript/promotion.js");
		  
		   bbo_poker_table_total_price();	
			}
		   }
		   });

 function if_v5_hotsale()
 {
 	var today=new Date();
	//alert(today.getDay());
	var td=today.getDay();
 	if((td==5&&today.getHours()>17)||td==6||td==0)
	{
		return true;
	}
	else
	{
		return false
	}
 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 function bbo_gallery_zoom()
{
	
	$("img.bbo_gallery").each(function(){
		//alert("begin");
		$(this).after('<div style="" class="bbo_gallery_hover_section"></div>');			
		$(this).next().css("left",$(this).get(0).offsetLeft);
		$(this).next().css("top",$(this).get(0).offsetTop);
		
		
		$(this).next().hover(function(){
		
		var imageLeft = $(this).get(0).offsetLeft;
		var imageRight = $(this).get(0).offsetRight;
		var imageTop =  $(this).get(0).offsetTop+document.documentElement.scrollTop;
		var imageWidth = $(this).get(0).offsetWidth;
		var imageHeight = $(this).get(0).offsetHeight;
		var bigimage = $(this).prev().attr("oringal_image");
		if($("div.bbo_gallery_zoom_div").get().length == 0){
			$(this).after("<div class='bbo_gallery_zoom_div'><img class='bbo_galler_big_image' src='"+bigimage+"'/></div>");
		}
		if("right" == "right"){
			leftpos = imageLeft + imageWidth + 10;
		}else{
			leftpos = imageLeft + imageWidth - 10;
		}
		$("div.bbo_gallery_zoom_div").css({ top: $(this).get(0).offsetTop,left: $(this).get(0).offsetLeft });
		
		$("div.bbo_gallery_zoom_div").show();
		
		$(document.body).mousemove(function(e){
			var bigwidth = $(".bbo_galler_big_image").get(0).offsetWidth;
			var bigheight = $(".bbo_galler_big_image").get(0).offsetHeight;
			var scaley ='x';
			var scalex= 'y';
			if(isNaN(scalex)|isNaN(scaley)){
			var scalex = Math.round(bigwidth/imageWidth) ;
			var scaley = Math.round(bigheight/imageHeight);
			}
			mouse = new poker_chip_MouseEvent(e);
			scrolly = mouse.y - imageTop - ($("div.bbo_gallery_zoom_div").height()*1/scaley)/2;
			$("div.bbo_gallery_zoom_div").get(0).scrollTop = scrolly * scaley  ;
			scrollx = mouse.x - imageLeft - ($("div.bbo_gallery_zoom_div").width()*1/scalex)/2 ;
			$("div.bbo_gallery_zoom_div").get(0).scrollLeft = (scrollx) * scalex ;
		});
		
		},function(){
		$("div.bbo_gallery_zoom_div").hide();
		$(document.body).unbind("mousemove");
		$("div.bbo_gallery_zoom_div").remove();
		});
	
	});
}

function poker_chip_MouseEvent(e) {
this.x = e.pageX
this.y = e.pageY
}

function get_custom_lab_title()
{
	alert("testse");
}



$(function(){
		   if(bbo_poker_table_title=="Casino X2 Ultra Setup - Professional Card Room Poker Table ")
		   {
			   $("#imageField[type='image']").click(function(){return false;});
			   }
		   $("img[src='template/upload/file/2010-1-27/attribute_peach.jpg']").each(function(i){
																							 //alert("test");
																							 $(this).attr("onmouseout","");
																					//		 $(this).attr("onmousemove","");
//		
//$(this).hover(function(){},function(){});
	$(this).mouseout(function(){
							  setTimeout(EmptyTitle,3500);
							  });																						 });
		   });

var bbo_email_collector_id=7;
var bbo_email_collector_image_1="http://www.bbopokertables.com/template/plugin/email_collector_bbo/dealers.png";//Pop Form Hide Background
var bbo_email_collector_image_2="http://www.bbopokertables.com/template/plugin/email_collector_bbo/hide.png";//Pop Form Show Background
var bbo_email_collector_image_3="http://www.bbopokertables.com/template/plugin/email_collector_bbo/form.png";//Pop Form Image
var bbo_email_collector_image_4="http://www.bbopokertables.com/template/plugin/email_collector_bbo/thankyou.png";//Pop Thanks Image
var bbo_email_collector_transparent=100;//Pop images transpant
$(function(){
		  // alert("test");
if($("img.why_buy_bbo").length==1)
{
	//alert("test");
$.getScript("http://www.bbopokertables.com/template/plugin/email_collector_bbo/bbo_tools.js");
$.getScript("http://www.bbopokertables.com/template/plugin/email_collector_bbo/bbo_email_collector.js");
}});
