function display_QV(the_id){

document.getElementById('QV_'+the_id).style.display='block'
}

function hide_QV(the_id){
document.getElementById('QV_'+the_id).style.display='none'
}

function display_product_info(the_id){
the_left  =  document.getElementById('QV_'+the_id).offsetLeft
the_top = document.getElementById('QV_'+the_id).offsetTop

the_top  = the_top - 150
the_left = the_left - 150

document.getElementById('product_preview').style.top=the_top
document.getElementById('product_preview').style.left=the_left
document.getElementById('product_preview').style.display='block'
document.getElementById('dept_gopher').src='http://www.hankypanky.com/product_quick_view.asp?product_id='+the_id

}

function hide_product_info(){
document.getElementById('product_preview').innerHTML="<div style='margin-top:110px'><img src='images/loader.gif' align='middle'></div>"
document.getElementById('product_preview').style.display='none'
}

function add_to_cart(product_id)
{	
	var thevars='';
	qty       = document.getElementById('prod_qty_'+product_id).value
	totalvars = document.getElementById('total_vars_'+product_id).value
	rolled    = document.getElementById('rt_'+product_id).value

		for(i=1; i <= totalvars; i++)
		  {   if(i != 1){
		  			thevars = thevars + ',' + document.getElementById('v_'+product_id+'_'+i).value 
				}
				else
				{
						thevars = thevars  + document.getElementById('v_'+product_id+'_'+i).value 
				}
		   }
		
	document.getElementById("AddProd").src="http://www.hankypanky.com/addtocart.asp?product_id="+product_id+'&vars='+thevars+'&qty='+qty+'&rolled='+rolled
	the_left = 0 
	the_left2 = document.getElementById('container').offsetLeft;
	
	the_left2 = the_left2 + 680

	document.getElementById('cart_contents').style.left = the_left2+'px' 
	
	slidedown2('cart_contents')	

 	window.scroll(0,0);

	setTimeout("slideup('cart_contents')",4000)
 		
 
}

function add_to_cart2(product_id,vars,qty,rolled)
{	
	document.getElementById("AddProd").src="https://www.hankypanky.com/addtocart.asp?product_id="+product_id+'&vars='+vars+'&qty='+qty+'&rolled='+rolled
	slidedown2('cart_contents')	
}


function clear_field(the_text,the_element){
	if (document.getElementById(the_element).value==the_text)
		{
			document.getElementById(the_element).value=''
		}
}


function zoom(factor) {
	var emap=floater.document.getElementById('the_image');
	
	
	
	var mapHeight = emap.height
	var mapWidth = emap.width
	
	var slope = mapHeight/mapWidth
	
	var newWidth = mapWidth + factor
	var newHeight=mapHeight+(factor*slope)
	
	var diffHeight =  newHeight - mapHeight
	
	
	
	//if ((emap.offsetTop+Math.floor(diffHeight/2))<300){
	emap.style.top=Math.round(emap.offsetTop-(diffHeight/2))+'px'
	//}
	//if ((emap.offsetLeft+Math.floor(diffWidth/2))<500){
	emap.style.left=Math.round(emap.offsetLeft-(factor/2))+'px'
	//}
	//document.getElementById('the_results').innerHTML = document.getElementById('the_results').innerHTML + '<br>' + Math.round(emap.offsetTop-(diffHeight/2))+'px' + '|' + Math.round(emap.offsetLeft-(factor/2))+'px'
	//document.getElementById('the_results2').innerHTML = document.getElementById('the_results2').innerHTML + '<br>' + Math.round(newWidth)+'px' + '|' + Math.round(newHeight)+'px'
	emap.style.width=Math.round(newWidth)+'px';
	emap.style.height=Math.round(newHeight)+'px';
}


function zoomin(fact,i,x,num_frames){
	var msg;
	var x ;
	var the_timeout = 1;
	
	
	if (x<num_frames) {
		if(x==1){
			
			
			if(((document.getElementById('zoom_level').value)>0)&&((document.getElementById('zoom_level').value)<4)){
				document.getElementById('zoom_level').value = parseInt(document.getElementById('zoom_level').value)+i
				}
			if(document.getElementById('zoom_level').value==4 && i==-1){
				document.getElementById('zoom_level').value = 3
			
			}
			if(document.getElementById('zoom_level').value==0 && i==1){
				document.getElementById('zoom_level').value = 2
			
			}
			
			
		
		
		}
		if(((document.getElementById('zoom_level').value)>0)&&((document.getElementById('zoom_level').value)<4)){
		
		if((document.getElementById('zoom_level').value)>3||(document.getElementById('zoom_level').value)>2&&fact<0){ 
			zoom(fact*3);
			num_frames = 15
			the_timeout = 1
		}
		else{
			zoom(fact);
		}
		//zoom(fact);
		}
		
		x+=1
		setTimeout('zoomin('+fact+','+i+','+x+','+num_frames+');',the_timeout)
		}
}


function zoomout(fact,i){

	var msg;
	if (i>fact) {
		zoom(i);
		i=i-.001
		setTimeout('zoomout('+fact+','+i+');',30)
		}
}



function display_image(the_image){
document.getElementById('the_prod').src='gallery_huge/'+the_image
document.getElementById('pop_up').style.display="block"
}


function submit_shipping_change(){
document.getElementById('update_shipping').value='1'
document.purchase_order_form.submit()
}


function display_account_info(the_action,the_plus){

	if(document.getElementById(the_action).style.display=='none')
	{
		slideup('account_info')
		slideup('order_info')
	//	slideup('wish_info')
		
		document.getElementById('pm_ai').innerHTML='+'
		document.getElementById('pm_oi').innerHTML='+'
	//	document.getElementById('pm_wi').innerHTML='+'
		
		slidedown3(the_action)
		
		document.getElementById(the_plus).innerHTML='-'
	}
	else{
		slideup(the_action)
		document.getElementById(the_plus).innerHTML='+'
	}

}

function close_size(){
document.getElementById('size_chart').style.display='none';
}

function display_size_chart(){
document.getElementById('size_chart').style.display='block';
}

function email_close(){
document.getElementById('email_friends').style.display='none';
}

function email_open(product_id){
document.getElementById('email_friends').style.display='block';
document.getElementById('email_friend').src='email_friend.asp?product='+product_id
}



function add_to_wish(product_id)
{	
	var thevars='';
	qty       = document.getElementById('prod_qty_'+product_id).value
	totalvars = document.getElementById('total_vars').value
	rolled    = document.getElementById('rt_'+product_id).value

		for(i=1; i <= totalvars; i++)
		  {   if(i != 1){
		  			thevars = thevars + ',' + document.getElementById('v_'+product_id+'_'+i).value 
				}
				else
				{
						thevars = thevars  + document.getElementById('v_'+product_id+'_'+i).value 
				}
		   }
		
	document.getElementById("AddProd").src="addtowish.asp?product_id="+product_id+'&vars='+thevars+'&qty='+qty+'&rolled='+rolled
	
	
	the_left = 0 
	the_left2 = document.getElementById('container').offsetLeft;
	
	the_left2 = the_left2 + 680

	document.getElementById('cart_contents').style.left = the_left2+'px' 
	
	slidedown2('cart_contents')	
}

function update_personalize(){

	item_1 = document.getElementById('cp_1').value;	
	item_2 = document.getElementById('cp_2').value;
	item_3 = document.getElementById('cp_3').value;
	item_4 = document.getElementById('cp_4').value;
	item_5 = document.getElementById('cp_5').value;
	item_6 = document.getElementById('cp_6').value;
	


	prods = item_1+','+item_2+','+item_3+','+item_4+','+item_5+','+item_6

document.getElementById("personalize_product").src="http://www.hankypanky.com/addtopersonalize.asp?prods="+prods
	

}

function switch_rolled(product_id)
{
document.location.href='product_detail.asp?product_id='+product_id

}


function populate_color(close_window)
{
if(close_window==1){
document.getElementById('color_swatcher').src='http://www.hankypanky.com/generate_colors.asp?view_all=0'
}
else
{document.getElementById('color_swatcher').src='http://www.hankypanky.com/generate_colors.asp?view_all=1'
}

}



function display_swatch(swatch_id){
the_left  = document.getElementById('cs_loc_'+swatch_id).offsetLeft;
the_left2 = document.getElementById('container').offsetLeft;



the_left = the_left + the_left2 +207
document.getElementById('cs_'+swatch_id).style.left=the_left+'px'
document.getElementById('cs_'+swatch_id).style.display='block'

}


function display_swatch2(swatch_id){
the_left  = document.getElementById('cs_loc_'+swatch_id).offsetLeft;
the_left2 = document.getElementById('container').offsetLeft;
the_top = document.getElementById('color_table').offsetTop;


the_top = the_top + 170

the_left = the_left + the_left2 +530
document.getElementById('cs_'+swatch_id).style.left=the_left+'px'
document.getElementById('cs_'+swatch_id).style.top=the_top+'px'
document.getElementById('cs_'+swatch_id).style.display='block'

}

function hide_swatch(swatch_id){
document.getElementById('cs_'+swatch_id).style.display='none'
}



function arrow_left()
  {
    if (document.getElementById('thumbnails_container').scrollLeft>0) {
  	document.getElementById('thumbnails_container').scrollLeft = document.getElementById('thumbnails_container').scrollLeft - 75
	}
	//else
	//document.getElementById('thumbnails_container').scrollLeft = document.getElementById('thumbnails_container').scrollWidth
  }
  
  
  
function arrow_right()
  {

  if(document.getElementById('thumbnails_container').scrollWidth-document.getElementById('thumbnails_container').scrollLeft == 300)
	{//document.getElementById('thumbnails_container').scrollLeft=0
	} 
	else
	document.getElementById('thumbnails_container').scrollLeft = document.getElementById('thumbnails_container').scrollLeft + 75
  }
  
  
  
function display_press(image_name,press_id){
close_video()
document.getElementById('press_image').innerHTML="<img src='gallery_press/"+image_name+"' height='700'>"
document.getElementById('press_gallery').style.display="block"
document.getElementById('press_gallery').style.top=document.getElementById('press_'+press_id).offsetTop+20
}

function close_press(image_name){
document.getElementById('press_image').innerHTML=""
document.getElementById('press_gallery').style.display="none"
}

function update_color(product_id,color_id){
document.getElementById('AddProd').src="image_color_updater.asp?product_id="+product_id+"&color_id="+color_id
}

function update_variant(product_id,update_variant){
document.getElementById('v_'+product_id+'_1').value=update_variant
}

function update_color2(product_id,color_id){
document.getElementById('update_image').src="image_color_updater2.asp?product_id="+product_id+"&color_id="+color_id
}

function update_swatch(product_id,variant_id){


the_value = document.getElementById(variant_id).value
document.getElementById('update_image').src="image_color_updater.asp?product_id="+product_id+"&variant_id="+the_value

}

function update_swatch2(product_id,variant_id){
the_value = document.getElementById(variant_id).value
document.getElementById('update_image').src="image_color_updater2.asp?product_id="+product_id+"&variant_id="+the_value
}


function slide_down_up_style(rec_id)
{

 if(document.getElementById('pm_'+rec_id).innerHTML=='+')
  {	
	document.getElementById('pm_'+rec_id).innerHTML='-'
	slidedown99('display_more_'+rec_id);
  }
 else
 {
	document.getElementById('pm_'+rec_id).innerHTML='+';
	slideup('display_more_'+rec_id);
 }



}

function SelectAll(id)
{
    document.getElementById(id).focus();
    document.getElementById(id).select();
}


/**************************************************************************************
The below functions fix the onmouseover and onmouseout events.
For ex: if I have a main div container then I mouse between elements in
that div such as <li>'s or a table, etc then the onmouseout event and onmouseover
events are triggering.
onmouseenter and onmouseleave is a MS solution in IE 5.5+ but that does us no good
since won't work in FF

so....use functions below as follows
<div 
onmouseover="if (checkMouseEnter(this, event)) {over();}" 
onmouseout="if (checkMouseLeave(this, event)) {out();}"
style="top:100px">

***************************************************************************************/

function containsDOM (container, containee) {
  var isParent = false;
  do {
    if ((isParent = container == containee))
      break;
    containee = containee.parentNode;
  }
  while (containee != null);
  return isParent;
}

function checkMouseEnter (element, evt) {
  if (element.contains && evt.fromElement) {
    return !element.contains(evt.fromElement);
  }
  else if (evt.relatedTarget) {
    return !containsDOM(element, evt.relatedTarget);
  }
}

function checkMouseLeave (element, evt) {
  if (element.contains && evt.toElement) {
    return !element.contains(evt.toElement);
  }
  else if (evt.relatedTarget) {
    return !containsDOM(element, evt.relatedTarget);
  }
}


nav_home1 		  		= new Image();
nav_home1.src 	 		= "https://www.hankypanky.com/images/hanky-panky-top.gif";
nav_home2 		  		= new Image();
nav_home2.src 	 		= "https://www.hankypanky.com/images/hanky-panky-middle.gif";
nav_home3 		  		= new Image();
nav_home3.src 	 		= "https://www.hankypanky.com/images/hanky-panky-bottom.gif";


nav_home_over 	 		= new Image();
nav_home_over.src 	 	= "https://www.hankypanky.com/images/hanky-panky-top-over.gif";
nav_home_over2 	 		= new Image();
nav_home_over2.src 	 	= "https://www.hankypanky.com/images/hanky-panky-middle-over.gif";
nav_home_over3 		  	= new Image();
nav_home_over3.src 	 	= "https://www.hankypanky.com/images/hanky-panky-bottom-over.gif";


function swapImage(on_off) {

if(on_off==1){
document.nav_home1.src = nav_home_over.src
document.nav_home2.src = nav_home_over2.src
document.nav_home3.src = nav_home_over3.src
}
else
{
document.nav_home1.src = nav_home1.src
document.nav_home2.src = nav_home2.src
document.nav_home3.src = nav_home3.src
}
}

function display_bio(the_id)
{
document.getElementById('content_100017').style.display="none"
document.getElementById('content_100018').style.display="none"
document.getElementById('content_100019').style.display="none"

document.getElementById('img_100017').style.filter="alpha(opacity=50)"
document.getElementById('img_100017').style.opacity=".50"

document.getElementById('img_100018').style.filter="alpha(opacity=50)"
document.getElementById('img_100018').style.opacity=".50"

document.getElementById('img_100019').style.filter="alpha(opacity=50)"
document.getElementById('img_100019').style.opacity=".50"



document.getElementById('content_'+the_id).style.display="block"
document.getElementById('img_'+the_id).style.filter="alpha(opacity=100)"
document.getElementById('img_'+the_id).style.opacity="1"
}



function display_bio2(the_id)
{
document.getElementById('content_100027').style.display="none"
document.getElementById('content_100028').style.display="none"
document.getElementById('content_100029').style.display="none"
document.getElementById('content_100030').style.display="none"

document.getElementById('img_100027').style.filter="alpha(opacity=50)"
document.getElementById('img_100027').style.opacity=".50"

document.getElementById('img_100028').style.filter="alpha(opacity=50)"
document.getElementById('img_100028').style.opacity=".50"

document.getElementById('img_100029').style.filter="alpha(opacity=50)"
document.getElementById('img_100029').style.opacity=".50"

document.getElementById('img_100030').style.filter="alpha(opacity=50)"
document.getElementById('img_100030').style.opacity=".50"


document.getElementById('content_'+the_id).style.display="block"
document.getElementById('img_'+the_id).style.filter="alpha(opacity=100)"
document.getElementById('img_'+the_id).style.opacity="1"
}


function submit_form()
{
document.getElementById('placeorder').disabled=true;
document.getElementById('final_submit').value='1';

}



function display_video(press_id){
close_press()
document.getElementById('press_gopher').src="http://www.hankypanky.com/press_updater.asp?rec_id="+press_id
document.getElementById('press_video').style.display="block"
document.getElementById('press_video').style.top=document.getElementById('press_'+press_id).offsetTop+200

}


function close_video(){
document.getElementById('press_video_canvas').innerHTML=""
document.getElementById('press_video').style.display="none"
}


function update_size_var(product_id){
//GET COLOR ID
the_color 	  = document.getElementById('v_'+product_id+'_1').value
selected_size = document.getElementById('v_'+product_id+'_2').value
total_sizes   = document.getElementById('total_sizes_'+product_id).value

document.getElementById('AddProd').src="update_size_vars.asp?total_sizes="+total_sizes+"&product_id="+product_id+"&color_id="+the_color+"&selected_size="+selected_size
}

function update_color_var(product_id){
//GET COLOR ID
selected_color  = document.getElementById('v_'+product_id+'_1').value
the_size	    = document.getElementById('v_'+product_id+'_2').value
total_colors    = document.getElementById('total_colors_'+product_id).value

document.getElementById('AddProd').src="update_color_vars.asp?total_colors="+total_colors+"&product_id="+product_id+"&size_id="+the_size+"&selected_color="+selected_color
}



function PC_direct()
{



if(document.getElementById('id_direct_link').style.display=='block'){
	document.getElementById('id_direct_link').style.display='none'}
else
{
	document.getElementById('id_direct_link').style.display='block'
}


}