 
var XMLHttpRequestObject = false;       

if (window.XMLHttpRequest) 
 {	XMLHttpRequestObject = new XMLHttpRequest();  } 
 else if (window.ActiveXObject) 
 { XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP")  }

function getData(datasource,divid)
{
  if (XMLHttpRequestObject)
 	{
		var obj = document.getElementById(divid);
		XMLHttpRequestObject.open("GET", datasource+"&ms=" + new Date().getTime(),true);
		XMLHttpRequestObject.onreadystatechange = function()
		{
			if (XMLHttpRequestObject.readyState ==4 && XMLHttpRequestObject.status == 200)
				{ obj.innerHTML  = XMLHttpRequestObject.responseText; }           
		}
		XMLHttpRequestObject.send(null);
	}         

}   

 
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){ 
  
	$.fancybox({
		'overlayShow'	:	true, 
		'overlayColor' 	:	'#000000',
		'href' 			: 'product_quick_view.asp?product_id='+the_id,
		padding			: 0,
		showCloseButton	: true 
		 
	}); 
		 
}

function hide_product_info(){
 
	parent.$.fancybox.close();
	
}

function add_to_cart(product_id)
{	
	var thevars=''; 
	var qty;
	var kkm;
	var the_qty='';
	 
 
			if($('#prod_qty_'+product_id).length>0){ 
				qty  = document.getElementById('prod_qty_'+product_id).value
			} else {
				qty  = 1
			}
			
			/*totalvars   = document.getElementById('total_vars_'+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="addtocart.asp?product_id="+product_id+'&vars='+thevars+'&qty='+qty  
		*/ 
	
		//document.getElementById("AddProd").src="addtocart.asp?product_id="+product_id+'&vars='+thevars+'&qty='+qty;  
		//slidedown2('cart_contents'); 
		//setTimeout("slideup('cart_contents')",4000)  
		
		$.ajaxSetup ({ cache: false});   // Disable caching of AJAX responses    
		$('#cart_contents').load('addtocart.asp?product_id='+product_id+'&vars='+thevars+'&qty='+qty + ' #cart_display', 
			function() {
				$('#cart_count').load('addtocart.asp #count'); 
			}); 
		$('#cart_contents').slideDown("fast");
		window.scroll(0,0);  
		setTimeout("add_to_cart_close();",4000)   

 
}


function add_to_cart_close()
{	
	 
	$('#cart_contents').slideUp('fast');
 
}

function readMoreDept(dept_id) {
	 
	$('#prod_listing_top_desc').fadeIn('fast');
}

function readMoreDeptClose(dept_id) {
	 
	$('#prod_listing_top_desc').fadeOut('fast');
}

function showClip(rec_id) {

	$('#clipdiv').load('clips.asp?clip_id=' + rec_id + ' #clip_' + rec_id)
}


 
function showPress(pressImg) {

	$('#press_main_div').fadeOut("fast", function() {
		$('#press_main_div img').attr('src', 'http://www.sproutwatches.com/upload/gallery_large/' + pressImg);
		$('#press_main_div').fadeIn("slow"); 
		 
	});
	
}
 
 
function showCeleb(celeb_id) {

	$('#celeb_main_div').fadeOut("fast", function() {
		$('#celeb_main_div').load('celebritiesnew.asp?celeb_id=' + celeb_id + ' #celeb_main_div', function() {
			$('#celeb_main_div').fadeIn("slow"); 
		} );
	});
	
}

function showEvent(rec_id) {
$.ajaxSetup ({ cache: false});   // Disable caching of AJAX responses    
	document.location.href= "events.asp?event_id=" + rec_id
}

function showEventDesc(rec_id) {
	if ( $("#event_desc_" + rec_id).css("display") == "none" ) {
		//$("#event_desc_" + rec_id).fadeIn("fast");
		$("#event_desc_" + rec_id).slideDown("slow");
	} else {
		$("#event_desc_" + rec_id).slideUp("fast");
	}
}



function showGalleryImage(imgName) {

	
	//$('#clipdiv').load('clips.asp?clip_id=' + rec_id + ' #clip_' + rec_id)
	
	var $active = $('#banner_images div.active-banner');

    if ( $active.length == 0 ) $active = $('#banner_images div:last');
 
 
	$('#banner_images').append('<div><img src="upload/gallery_large/' + imgName +'"></div>')
	
    var $next =  $('#banner_images div:last');
  
    $active.addClass('last-active-banner');

    $next.css({opacity: 0.0})
        .addClass('active-banner')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active-banner last-active-banner');
        });
		
		
	//$('#banner_images_count li').children('img').attr("src", "images/circle.png"); 
	//$('#banner_count_' + $next.attr("id") + ' img').attr("src", "images/circle_full.png"); 
	
	
	//$('#banner_images div:first img').attr("src", "upload/gallery_large/" + imgName); 
	
}


function imageSlide(direction) {

	var w = $("#images_list td").length * 242; 
       w = w - 970 
	
       startPos = $("#images_list_container").css('right')
       startPos = startPos.replace("px", "")
       if (isNaN(startPos) == true) { startPos = 0 } 
	
	if (direction == 'left') { 
        if (  startPos > 0 ) {
			$("#images_list_container").animate({ right:"-=242px" }, "fast", "linear");
        }
       } else {
		
        if ( startPos < w ) {
			$("#images_list_container").animate({ right:"+=242px" }, "fast", "linear");
        }
	}
	 
   }
  
  

function eventsImageSlider(direction,event_id) {

	var w = $("#event_image_slider_" + event_id + " #images_list td").length * 242; 
       w = w - 970 
	
       startPos = $("#event_image_slider_" + event_id + " #images_list_container").css('right')
       startPos = startPos.replace("px", "")
       if (isNaN(startPos) == true) { startPos = 0 } 
	
	if (direction == 'left') { 
        if (  startPos > 0 ) {
			$("#event_image_slider_" + event_id + " #images_list_container").animate({ right:"-=242px" }, "fast", "linear");
        }
       } else {
		
        if ( startPos < w ) {
			$("#event_image_slider_" + event_id + " #images_list_container").animate({ right:"+=242px" }, "fast", "linear");
        }
	}
	 
   }
   

function galleryImageFadeIn(element) { 
	$('#' + element.id + ' div img').stop(true,true)
 	$('#' + element.id + ' div img').fadeTo("2000", 1.0)
	//$('#' + element.id + ' div img').animate({ opacity: 1.0 }, "slow");
	//$('#' + element.id + ' div img').removeClass('images_list_notactive'); 
	
	
}

function galleryImageFadeOut(element) {   
	$('#' + element.id + ' div img').stop(true,true)
	$('#' + element.id + ' div img').fadeTo("6000", 0.5);
	//$('#' + element.id + ' div img').animate({ opacity: 0.5 }, "slow");
//	$('#' + element.id + ' div img').addClass('images_list_notactive');
	
} 

function showEventsImage(theHref) {
	 
	$.fancybox({  
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayColor'	: '#000000',
		'overlayOpacity' : .8,
		'titleShow' : false,
		'href' : theHref
	}); 	
 
}

function add_to_cart2(product_id,vars,qty,rolled)
{	
the_left = 0 
	the_left2 = document.getElementById('container').offsetLeft;
	
	the_left2 = the_left2 + 680

	document.getElementById('cart_contents').style.left = the_left2+'px' 
	

	document.getElementById("AddProd").src="http://www.sproutwatches.com/addtocart.asp?product_id="+product_id+'&vars='+vars+'&qty='+qty+'&rolled='+rolled
	slidedown2('cart_contents')	
	
	 	window.scroll(0,0);

	setTimeout("slideup('cart_contents')",4000)
}



function clear_field(the_text,the_element){
	if (document.getElementById(the_element).value==the_text)
		{
			document.getElementById(the_element).value=''
		}
}


 function setMainImage(element) {
    large_image = $(element).children('.large-image').attr('src');
    huge_image = $(element).children('.huge-image').attr('src');

    $('#main_image_link').attr('href', huge_image).attr('title', '&nbsp;');
    $('#main_image').attr('src', large_image);

    $('#main_image_link').unbind();

    var options = {
        zoomWidth: 340,
        zoomHeight: 340,
        position: 'right',
        xOffset: '30',
        yOffset: '-6'
    };


    $('#main_image_link').jqzoom(options);
}

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 display_account_info2(the_action,the_plus){

	if(document.getElementById(the_action).style.display=='none')
	{
		slideup('billing_info')
		slideup('shipping_info')
		slideup('login_information')
		slideup('order_info')
		
		document.getElementById('pm_bi').innerHTML='+'
		document.getElementById('pm_si').innerHTML='+'
		document.getElementById('pm_li').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 email_close(){ 
	//parent.document.getElementById('email_friends').style.display='none'; 
	$('#email_friends', parent.document).slideUp("slow");
}

function email_open(product_id){
	//document.getElementById('email_friends').style.display='block';
	$('#email_friends').slideDown("slow");
	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_'+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.sproutwatches.com/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.sproutwatches.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.sproutwatches.com/generate_colors.asp?view_all=0'
}
else
{document.getElementById('color_swatcher').src='http://www.sproutwatches.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('main_content').offsetLeft;
the_top = document.getElementById('color_table').offsetTop;


the_top = the_top + 90

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){ 

	all_colors = document.getElementById('full_color_list').value;
	arr_colors = all_colors.split(',');
	for (x = 0; x< arr_colors.length;x=x+1) { 
		document.getElementById('cs_thumb_' +arr_colors[x]).style.border = '1px solid #FFFFFF' 
	}
	document.getElementById('cs_thumb_' +color_id).style.border = '1px solid #000000' 
	
	document.getElementById('update_image').src="image_color_updater.asp?product_id="+product_id+"&color_id="+color_id
	//document.getElementById('image_floater').innerHTML = document.getElementById('update_image').contentWindow.document.body.innerHTML
	//getData('image_color_updater.asp?product_id='+product_id+'&color_id='+color_id,'image_floater');
			
}

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').contentWindow.location.replace="image_color_updater2.asp?product_id="+product_id+"&color_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').contentWindow.location.replace="image_color_updater.asp?product_id="+product_id+"&variant_id="+the_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').contentWindow.location.replace="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 	 		= "";
nav_home2 		  		= new Image();
nav_home2.src 	 		= "";
nav_home3 		  		= new Image();
nav_home3.src 	 		= "";


nav_home_over 	 		= new Image();
nav_home_over.src 	 	= "";
nav_home_over2 	 		= new Image();
nav_home_over2.src 	 	= "";
nav_home_over3 		  	= new Image();
nav_home_over3.src 	 	= "";


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.sproutwatches.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
document.getElementById('AddProd').contentWindow.location.replace("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
document.getElementById('AddProd').contentWindow.location.replace="update_color_vars.asp?total_colors="+total_colors+"&product_id="+product_id+"&size_id="+the_size+"&selected_color="+selected_color
}


function update_color_var2(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
document.getElementById('AddProd').contentWindow.location.replace("update_color_vars2.asp?total_colors="+total_colors+"&product_id="+product_id+"&size_id="+the_size+"&selected_color="+selected_color)
}

function update_color_var3(rec_id, product_id){
//GET COLOR ID


selected_color  = document.getElementById('v_'+rec_id+'_1').value
the_size	    = document.getElementById('v_'+rec_id+'_2').value
total_colors    = document.getElementById('total_colors_'+rec_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
document.getElementById('AddProd').contentWindow.location.replace("update_color_vars3.asp?the_rec_id="+rec_id+"&total_colors="+total_colors+"&product_id="+product_id+"&size_id="+the_size+"&selected_color="+selected_color)
}



function update_size_var3(rec_id, product_id){
//GET COLOR ID

the_color 	  = document.getElementById('v_'+rec_id+'_1').value
selected_size = document.getElementById('v_'+rec_id+'_2').value
total_sizes   = document.getElementById('total_sizes_'+rec_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
document.getElementById('AddProd').contentWindow.location.replace("update_size_vars3.asp?the_rec_id="+rec_id+"&total_sizes="+total_sizes+"&product_id="+product_id+"&color_id="+the_color+"&selected_size="+selected_size)
}



function update_size_var2(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
document.getElementById('AddProd').contentWindow.location.replace("update_size_vars2.asp?total_sizes="+total_sizes+"&product_id="+product_id+"&color_id="+the_color+"&selected_size="+selected_size)
}


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'}
}

function display_more()
{
	current_display = (current_display == 6) ? 1 : current_display + 1;
	
	if(current_display>4){
	 	document.getElementById('add_more_text').style.display="none"
	}
	
	
	document.getElementById('more_options_'+current_display).style.display="block"
	document.getElementById('close_options').style.display="block"

//alert(current_display)
}



function hide_more()
{
	document.getElementById('more_options_'+current_display).style.display="none"
	current_display =  current_display - 1;
	
	if(current_display==0)
	{
			document.getElementById('close_options').style.display="none"
	}
//alert(current_display)
}




function letus_open(product_id){

document.getElementById('preview_product').style.display='block';
document.getElementById('preview_products').src='preview_request.asp?product='+product_id
}

function update_tax_info(){
document.getElementById('ship_zip').value=document.getElementById('returned_zip').value
document.getElementById('entered_zip').innerHTML=document.getElementById('returned_zip').value
	
document.getElementById('ship_state').value=document.getElementById('returned_state').value
document.getElementById('entered_state').innerHTML=document.getElementById('returned_state').value
	
document.getElementById('ship_city').value=document.getElementById('returned_city').value
document.getElementById('entered_city').innerHTML=document.getElementById('returned_city').value
}


function display_slide(rec_id)
{


 
 if(selected_slide==0){
  jQuery(jQuery('.slide_show_holder')).css('opacity', '0');

 }

 jQuery('.slide_show_holder').css('z-index', '-1');
 jQuery(jQuery('.slide_show_holder')[selected_slide]).css('z-index', '100');
 jQuery(jQuery('.slide_show_holder')[rec_id]).css('z-index', '100');

 //jQuery(jQuery('.slide_show_holder')[selected_slide]).css('display', 'none');
 jQuery(jQuery('.slide_show_holder')[selected_slide]).animate({opacity: 0.0}, 900);
 //jQuery(jQuery('.slide_show_holder')[rec_id]).css('display', 'block');
 jQuery(jQuery('.slide_show_holder')[rec_id]).animate({opacity: 1.0}, 1000);

 
 $('#slide_holder td div').html("<div class='home_thumbs'><img src='images/tint.png' border='0'></div>")	
 document.getElementById("dt_"+rec_id).innerHTML = "<div class='home_thumbs'></div>"

 
selected_slide = rec_id
clearInterval(startShow)
startShow = setInterval("RotateSlide()",7000)
}


function slideupfunc() {

if(document.getElementById('float_email_signup')){

 window.onscroll = function () 
	 		{
                slideup = document.getElementById('float_email_signup');        
				var footerHeight = slideup.offsetHeight;    
				var windowHeight = window.innerHeight?  window.innerHeight :  document.body.clientHeight;       
				var pageOffSet = document.body.scrollTop  
				slideup.style.top = ( pageOffSet +  windowHeight - 106) + "px";
            }

	var slideup;
	
	var broswerType=navigator.appVersion
	slideup = document.getElementById('float_email_signup');
	
	if (broswerType.indexOf('MSIE') > 1 ) {
	
	//	slideup.filters[0].Apply();
		
		if (slideup.style.visibility == "visible") { 
			slideup.style.visibility = "hidden"; 
			//slideup.filters.revealTrans.transition=4; 
		} else { 
			//getData("showSubscribe.asp?showSub=1","slideup");
			slideup.style.visibility = "visible";  
		//	slideup.filters[0].transition=4; 
			
			
		} 
			
	//	slideup.filters[0].Play(); 
		
	} else {
		
		if (slideup.style.visibility == "visible") { 
			slideup.style.visibility = "hidden"; 
		} else { 
			slideup.style.visibility = "visible"; 
		} 
	}	
	}
}


function bannersSlide() {
 	var $active = $('#banners div.active-banner');

    if ( $active.length == 0 ) $active = $('#banners div:last');
 
    var $next =  $active.next().length ? $active.next()
        : $('#banners div:first');
  
    $active.addClass('last-active-banner');

    $next.css({opacity: 0.0})
        .addClass('active-banner')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active-banner last-active-banner');
        });
		 
	$('#banner_count li').children('img').attr("src", "images/circle.png"); 
	$('#banner_count_' + $next.attr("id") + ' img').attr("src", "images/circle_full.png"); 
	
}


function bannerSelect(bannerNum) { 

	var $active = $('#banners div.active-banner');

    if ( $active.length == 0 ) $active = $('#banners div:last');
 
    var $next = $('#banners #' + bannerNum);
  
    $active.addClass('last-active-banner');

    $next.css({opacity: 0.0})
        .addClass('active-banner')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active-banner last-active-banner');
        });
		 
	$('#banner_count li').children('img').attr("src", "images/circle.png"); 
	$('#banner_count_' + $next.attr("id") + ' img').attr("src", "images/circle_full.png"); 
	
}

function bannerImagesSlide() {
 	var $active = $('#banner_images div.active-banner');

    if ( $active.length == 0 ) $active = $('#banner_images div:last');
 
    var $next =  $active.next().length ? $active.next()
        : $('#banner_images div:first');
  
    $active.addClass('last-active-banner');

    $next.css({opacity: 0.0})
        .addClass('active-banner')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active-banner last-active-banner');
        });
		
	$('#banner_images_count li').children('img').attr("src", "images/circle.png"); 
	$('#banner_count_' + $next.attr("id") + ' img').attr("src", "images/circle_full.png"); 
	
}

 
 
function eventsImagesSlide() {

$.ajaxSetup ({ cache: false});   // Disable caching of AJAX responses    
 	var $active = $('#banner_events div.active-banner');
    if ( $active.length == 0 ) $active = $('#banner_events div:last');  
  
    var $next =  $active.next().length ? $active.next()
        : $('#banner_events div:first');
  
    $active.addClass('last-active-banner');

    $next.css({opacity: 0.0})
        .addClass('active-banner')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active-banner last-active-banner');
        });
		
	$('#banner_events_count li').children('img').attr("src", "images/circle.png"); 
	$('#banner_events_' + $next.attr("id") + ' img').attr("src", "images/circle_full.png"); 
	
	$.ajaxSetup ({ cache: false});   // Disable caching of AJAX responses    
	var event_id = $('#' + $next.attr("id") + ' img').attr("id")
	event_id = event_id.replace("img_","") 
	//$('#images_btm').load('events.asp?jq=1&event_id=' + event_id + ' #images_list_container')
	$('#event_image_sliders .event_image_slider_perevent').fadeOut("fast", function() {$('#event_image_slider_' + event_id).fadeIn("fast");});
	
	
	
}



//* Document ready -----------------------------------------------------*/
$(document).ready(function() {

	
	if($('#shop_nav').length>0){ 
		$("#shop_nav li").hover(
			function(){ 
				$('#dropdown_'+this.id).fadeIn('slow');
			}, 
			function(){  
				$('#dropdown_'+this.id).fadeOut('fast');
			}
		);
	};
	
	
	if($('#DDmedia').length>0){ 
		$("#DDmedia").hover(
			function(){ 
				$('#dropdown_'+this.id).fadeIn('slow');
			}, 
			function(){  
				$('#dropdown_'+this.id).fadeOut('fast');
			}
		);
	};
	
	
	if($('#DDabout').length>0){ 
		$("#DDabout").hover(
			function(){ 
				$('#dropdown_'+this.id).fadeIn('slow');
			}, 
			function(){  
				$('#dropdown_'+this.id).fadeOut('fast');
			}
		);
	};
	
	
	if($('#product_details').length>0){ 
			 
			$("a.product_images").fancybox({ 
				'transitionIn'	:	'elastic',
				'transitionOut'	:	'elastic',
				'speedIn'		:	600, 
				'speedOut'		:	200, 
				'overlayColor'	: '#000000',
				'overlayOpacity' : .8,
				'titleShow' : false
			}); 		
			
	}  
	
	if($('#cvv_note').length>0){  
			$("#cvv_note").fancybox({ 
				'href' 			: 	'cvv.asp',
				'transitionIn'	:	'elastic',
				'transitionOut'	:	'elastic',
				'speedIn'		:	600, 
				'speedOut'		:	200, 
				'overlayColor'	: '#000000',
				'overlayOpacity' : .8,
				'titleShow' : false
			}); 		
			
	}  
	
	
	if($('#celeb_img').length>0){   
	
		//$("#celeb_img").rotate(2);	 
		
	}  
	
	if($('#banners').length>0){   
		 
		 var i = setInterval( "bannersSlide()", 3000 );
	}
		
		$.ajaxSetup ({ cache: false});   // Disable caching of AJAX responses    
	if($('#privacypolicy').length>0){ 
			 
			$("#privacypolicy").fancybox({  
				'href'			:	'https://www.sproutwatches.com/secure/privacy-policy-fb.asp', 
				'overlayColor'	: '#000000',
				'overlayOpacity' : .8,
				'titleShow' : false
			}); 		
			
	}  
	
	if($('#terms').length>0){ 
			 
			$("#terms").fancybox({  
				'href'			:	'https://www.sproutwatches.com/secure/terms-fb.asp', 
				'overlayColor'	: '#000000',
				'overlayOpacity' : .8,
				'titleShow' : false
			}); 		
			
	}  
	
	if($('#taxinfo').length>0){ 
			 
			$("#taxinfo").fancybox({  
				'href'			:	'https://www.sproutwatches.com/secure/tax-fb.asp', 
				'overlayColor'	: '#000000',
				'overlayOpacity' : .8,
				'titleShow' : false
			}); 		
			
	}  
	
	
	 
   if ($('.images .image').length > 0) {
    	setMainImage($('.images .image:first'));
   }
		
	
	if($('#banner_images').length>0){   
		 
		 var i = setInterval( "bannerImagesSlide()", 3000 );
	}
	 
	 if($('#banner_events').length>0){   
		 
		 var i = setInterval( "eventsImagesSlide()", 6000 );
		 
		 $(".event_images").fancybox({  
			'transitionIn'	:	'elastic',
			'transitionOut'	:	'elastic',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayColor'	: '#000000',
			'overlayOpacity' : .8,
			'titleShow' : false
		}); 	
	}
	 
	if($('.event_images').length>0){ 
	 
	 	$(".event_images").fancybox({  
			'transitionIn'	:	'elastic',
			'transitionOut'	:	'elastic',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayColor'	: '#000000',
			'overlayOpacity' : .8,
			'titleShow' : false
		}); 	
	}
	
	if($('.gallery_images').length>0){ 
	 
	 	$(".gallery_images").fancybox({  
			'transitionIn'	:	'elastic',
			'transitionOut'	:	'elastic',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayColor'	: '#000000',
			'overlayOpacity' : .8,
			'titleShow' : false
		}); 	
	}
	
	
	
	if($('#images_list div img').length>0){   
		 
		$('#images_list div img').animate({ opacity: 0.3 }, "fast");   
	}
		 
	if($('.gallery_images_td').length>0){ 
	 
	 	$('.gallery_images_td').hover( 
			function() { 
				$('#' + this.id + ' div img').stop(true,true)
 				$('#' + this.id + ' div img').fadeTo(400, 1.0)
			}, 
			function() { 
				$('#' + this.id + ' div img').stop(true,true);
 				$('#' + this.id + ' div img').fadeTo(2000, 0.3);
			} 
		);
	}
	
});	

     
