// JavaScript Document

 var player;
 
 var t;
 var interval=0;
 
 
function colorselecbox() {
		var cc=document.getElementById("colorlist").offsetWidth;
		document.getElementById("colorinput").style.width =  cc + "px";
}

function sizeselecbox() {
		var ss=document.getElementById("sizelist").offsetWidth;
		document.getElementById("sizebox").style.width = ss + "px";
}


  $(document).ready(function(){
  
  
  if($('#millisec'))
	  {
		  interval = parseInt($('#millisec').val());
		  startCounter();

	  }
	  
	
	restrictAcneFromIDP();
	  
			$('#registerPopup').removeAttr("onclick");
			$('#registerPopupInput').removeAttr("onkeypress");
			
			$('#registerPopupInput').keypress(function(evt){
				
				if (evt.which == '13') {
					$('#registerPopup').click();
					return false;
				   }
				
			});
			$('#registerPopup').click(function(){
				registerSaleEventEmailPopup();
			}); 


	$('.home_new_shoes').mouseover( function(){
	  		$(this).find('.label_holder').children('.new_lable').hide();
	  		$(this).find('.label_holder').children('.zoom_lable').show();	  		
	  	});
	  	$('.home_new_shoes').mouseout( function(){
	  		$(this).find('.label_holder').children('.new_lable').show();
	  		$(this).find('.label_holder').children('.zoom_lable').hide();	  		
	  	});

//change dis to hide after the sale gets over SOLE-4157
	  //	$('#forFlashSale').hide(); 
	  //	$('.offer_notification_bar').hide();
	  	// hide till here
// menu


		 /*$("#imgDiv1, #div2 *").mouseover( function(){
			 $('#imgDiv1').addClass('menu_shadow_over');
			 
		 })	 ;
		 
		 $("#imgDiv1, #div2 *").mouseout( function(){
			 $('#imgDiv1').removeClass('menu_shadow_over');
			 
		 })	 ;*/
		 
		 
		/* $('#imgDiv2,#div3 *').mouseover( function(){
			 $('#imgDiv2').addClass('menu_shadow_over');
		 });
		 
		 $('#imgDiv2,#div3 *').mouseout( function(){
			 $('#imgDiv2').removeClass('menu_shadow_over');
		 });
		 
		// sales style
		 
		
				 
		 $("#imgDiv5, #div5 *").mouseover( function(){
			 $('#imgDiv5').addClass('menu_shadow_over');
			 
		 })	 ;
		 
		 $("#imgDiv5, #div5 *").mouseout( function(){
			 $('#imgDiv5').removeClass('menu_shadow_over');
			 
		 })	 ;
		 
		 
		 $('#imgDiv6,#saleDropdown *').mouseover( function(){
			 $('#imgDiv6').addClass('menu_shadow_over');
		 });
		 
		 $('#imgDiv6,#saleDropdown *').mouseout( function(){
			 $('#imgDiv6').removeClass('menu_shadow_over');
		 });			 
		 */
	     
		 /*************womens navigation*********/
		 $('#womenTopNav').mouseout( function(){
			 $('#imgDiv1').removeClass('menu_shadow_over');
			 $('#womenTopNav').css('color','#4e4949');
			 $('#imgDiv1').attr('style','');
			 
		 });
		 
		 
		 
		 $('#womenTopNav').mouseover( function(){
			 $('#imgDiv1').addClass('menu_shadow_over');
			 $('#womenTopNav').css('color','#d22e2e');
			 $('#imgDiv1').attr('style','-webkit-border-top-left-radius: 6px;-webkit-border-top-right-radius: 6px;-moz-border-radius-topleft: 6px;-moz-border-radius-topright: 6px;border-top-left-radius: 6px;	border-top-right-radius: 6px; -moz-box-shadow: 0px 0px 5px #cecece; -webkit-box-shadow: 0px 0px 5px #cecece;');
		 });
		 
		 $('#div2').mouseout( function(){
			 $('#imgDiv1').removeClass('menu_shadow_over');
			 $('#womenTopNav').css('color','#4e4949');
			 $('#imgDiv1').attr('style','');
			 
		 });
		 
		 
		 
		 $('#div2').mouseover( function(){
			 $('#imgDiv1').addClass('menu_shadow_over');
			 $('#womenTopNav').css('color','#d22e2e');
			 $('#imgDiv1').attr('style','-webkit-border-top-left-radius: 6px;-webkit-border-top-right-radius: 6px;-moz-border-radius-topleft: 6px;-moz-border-radius-topright: 6px;border-top-left-radius: 6px;	border-top-right-radius: 6px; -moz-box-shadow: 0px 0px 5px #cecece; -webkit-box-shadow: 0px 0px 5px #cecece;');
		 });
		
		 /*************womens navigation*********/
		 
		 
		 /*************mens navigation*********/
		 $('#MenTopNav1').mouseout( function(){
			 $('#imgDiv2').removeClass('menu_shadow_over');
			 $('#MenTopNav1').css('color','#4e4949');
			 $('#imgDiv2').attr('style','');
			 
		 });
		 
		 
		 
		 $('#MenTopNav1').mouseover( function(){
			 $('#imgDiv2').addClass('menu_shadow_over');
			 $('#MenTopNav1').css('color','#d22e2e');
			 $('#imgDiv2').attr('style','-webkit-border-top-left-radius: 6px;-webkit-border-top-right-radius: 6px;-moz-border-radius-topleft: 6px;-moz-border-radius-topright: 6px;border-top-left-radius: 6px;	border-top-right-radius: 6px; -moz-box-shadow: 0px 0px 5px #cecece; -webkit-box-shadow: 0px 0px 5px #cecece;');
		 });
		 
		 $('#div3').mouseout( function(){
			 $('#imgDiv2').removeClass('menu_shadow_over');
			 $('#MenTopNav1').css('color','#4e4949');
			 $('#imgDiv2').attr('style','');
			 
		 });
		 
		 
		 
		 $('#div3').mouseover( function(){
			 $('#imgDiv2').addClass('menu_shadow_over');
			 $('#MenTopNav1').css('color','#d22e2e');
			 $('#imgDiv2').attr('style','-webkit-border-top-left-radius: 6px;-webkit-border-top-right-radius: 6px;-moz-border-radius-topleft: 6px;-moz-border-radius-topright: 6px;border-top-left-radius: 6px;	border-top-right-radius: 6px; -moz-box-shadow: 0px 0px 5px #cecece; -webkit-box-shadow: 0px 0px 5px #cecece;');
		 });
		
		 /*************mens navigation*********/
		 
		 
		 /*************style navigation*********/
		 
		 /*************style navigation*********/
		 
		 
		 /*************sale navigation*********/
		 $('#SaleTopNav').mouseout( function(){
			 $('#imgDiv6').removeClass('menu_shadow_over');
			 $('#SaleTopNav').css('color','#4e4949');
			 $('#imgDiv6').attr('style','');
			 
		 });
		 
		 
		 
		 $('#SaleTopNav').mouseover( function(){
			 $('#imgDiv6').addClass('menu_shadow_over');
			 $('#SaleTopNav').css('color','#d22e2e');
			 $('#imgDiv6').attr('style','-webkit-border-top-left-radius: 6px;-webkit-border-top-right-radius: 6px;-moz-border-radius-topleft: 6px;-moz-border-radius-topright: 6px;border-top-left-radius: 6px;	border-top-right-radius: 6px; -moz-box-shadow: 0px 0px 5px #cecece; -webkit-box-shadow: 0px 0px 5px #cecece;');
		 });
		 
		 $('#saleAdditional').mouseout( function(){
			 $('#imgDiv6').removeClass('menu_shadow_over');
			 $('#SaleTopNav').css('color','#4e4949');
			 $('#imgDiv6').attr('style','');
			 
		 });
		 
		 
		 
		 $('#saleAdditional').mouseover( function(){
			 $('#imgDiv6').addClass('menu_shadow_over');
			 $('#SaleTopNav').css('color','#d22e2e');
			 $('#imgDiv6').attr('style','-webkit-border-top-left-radius: 6px;-webkit-border-top-right-radius: 6px;-moz-border-radius-topleft: 6px;-moz-border-radius-topright: 6px;border-top-left-radius: 6px;	border-top-right-radius: 6px; -moz-box-shadow: 0px 0px 5px #cecece; -webkit-box-shadow: 0px 0px 5px #cecece;');
		 });
		
		 /*************sale navigation*********/
		 
		 // for women 
		 
		 
		 
		
		
		   
		   
		/* $('#div2').mouseout( function(){
			 $('#imgDiv1').removeClass('menu_shadow_over');
		 })		;
		 $('imgDiv1 a#womenTopNav').mouseout( function(){
			 $('#imgDiv1').removeClass('menu_shadow_over');
		 });
		
		 // Added for men
		 
		 $('#div3').mouseout( function(){
			 $('#imgDiv2').removeClass('menu_shadow_over');
		 })		;
		 
		 $('#MenTopNav').mouseout( function(){
			 $('#imgDiv2').removeClass('menu_shadow_over');
		 })		;
		 
		 //Added for  Style 
		 
		 $('#div5').mouseout( function(){
			 $('#imgDiv5').removeClass('menu_shadow_over');
		 })		;
		 
		 $('#StyleTopNav').mouseout( function(){
			 $('#imgDiv5').removeClass('menu_shadow_over');
		 })		;
		 
		
		 //for sales 
		 
		 $('#saleDropdown').mouseout( function(){
			 $('#imgDiv6').removeClass('menu_shadow_over');
		 })		;
		 
		 $('#SaleTopNav').mouseout( function(){
			 $('#imgDiv6').removeClass('menu_shadow_over');
		 })		;*/
		 
/*	  	
$('#imgDiv1').mouseover( function(){
	$('#div2').show();
  });
	 $('#div2').mouseover( function(){
		 $('#imgDiv1').find('.menu_text').addClass('menu_shadow_over');
	 })
	 $('#div2').mouseout( function(){
		 $('#imgDiv1').find('.menu_text').removeClass('menu_shadow_over');
	 })
	 
	 $('#div3').mouseover( function(){
		 $('#imgDiv2').find('.menu_text').addClass('menu_shadow_over');

	 })
	 $('#div3').mouseout( function(){
		 $('#imgDiv2').find('.menu_text').removeClass('menu_shadow_over');

	 })

	 $('#div5').mouseover( function(){
		 $('#imgDiv5').find('.menu_text').addClass('menu_shadow_over');

	 })
	 $('#div5').mouseout( function(){
		 $('#imgDiv5').find('.menu_text').removeClass('menu_shadow_over');

	 })
	 $('#saleDropdown').mouseover( function(){
		 $('#imgDiv6').find('.menu_text').addClass('menu_shadow_over');

	 })
	 $('#saleDropdown').mouseout( function(){
		 $('#imgDiv6').find('.menu_text').removeClass('menu_shadow_over');

	 })
	 
	 $('#imgDiv1, #imgDiv2, #imgDiv5, #imgDiv6').find('.women_shadow_btn').mouseover( function(){
		 $('.menu_text').removeClass('menu_shadow_over');
		 
	 })
	*/ 
/*****************************
	sorf function
******************************/




	//$("#shoestyle").hide();

/*
	$("#tab_nav li").click(function() {
		if (document.getElementById('brand_tab').className = "tab_nav") 
		{
		$(this).removeClass("tab_nav");			
		$(this).addClass("tab_nav_select");
		$(this).siblings().removeClass("tab_nav_select");
		$(this).siblings().addClass("tab_nav");		
		}

		if (document.getElementById('style_tab').className = "tab_nav") 
		{
		$(this).removeClass("tab_nav");			
		$(this).addClass("tab_nav_select");
		$(this).siblings().removeClass("tab_nav_select");
		$(this).siblings().addClass("tab_nav");			
		}
	});
	*/
	/*
		$("#brand_tab").click(function(){
			$("#shoebrand").show();
			$("#shoestyle").hide();
		});

		$("#style_tab").click(function(){
			$("#shoebrand").hide();
			$("#shoestyle").show();			
		});


	$("#shoebrand ul li a").toggle(function(){
		$(this).parent().addClass('selectbg');	
		setpage('brands');									
		},function(){
		$(this).parent().removeClass('selectbg');	
		setpage('brands');									
	});

	$("#shoestyle ul li").toggle(function(){
		$(this).addClass('selectbg');					
		setpage('styles');					
		},function(){
		$(this).removeClass('selectbg');
		setpage('styles');											
	});

	
	$("#shoesizes ul li a span").toggle(function(){
		$(this).addClass('selectbg');	
		setpage('sizes');									
		},function(){
		$(this).removeClass('selectbg');
		setpage('sizes');											
	});



	$(".heelsection a").toggle(function(){
	$(this).css('background-position', '0px -2px');		
	setpage('heels');
	},function(){	
	$(this).css('background-position', '0px -24px');	
	setpage('heels');
	 });
	 

 $("#shoecolors li span img").click(function () {
      $(this).toggleClass("colorheight");
      setpage('colors');
    });
*/
		 /*this is for vintage popup*/
		   $(".learn_more").removeAttr("onclick");
		   $(".learn_more").bind("click",function(){

		    $("#backgroundPopup").css("width", $(document).width());
		    $("#backgroundPopup").css("height", $(document).height());
		   $("#backgroundPopup").fadeIn(400,function(){$("#vintageInfo").fadeIn(400);});


		   });
		   
		   $(".vintage_popup_close a").bind("click",function(){
		    
		    $("#vintageInfo").fadeOut(400,function(){$("#backgroundPopup").fadeOut(300);});
		     //$("#vintageInfo").hide(1000,'linear',function(){});
		     //$("#backgroundPopup").hide(500,'linear',function(){});
		     
		   });
		   
		   //removeCommentFromHomepage();
		  restrictBrandsFromSite();
		
		//putLookBookVideo();
		//youtubeVideoReady();
		playNightRiderLookBookVideo();
		playInSpiritLookBookVideo();
		
		//putLookBookVideoLeatherExtensions()
		
	
  });



function restrictBrandsFromSite()
{
	//console.log("entered this");
	var countriesRestricted=new Array();

	countriesRestricted["IN"]="ugg australia";
	countriesRestricted["WORLD"]="ugg australia";
        //restrict in top navigation
        //restrict in left menu in sort page
        //restrict add item in IDP
        //restrict in sale page
	 //restrict left menu in listing pages
	
	var ctry="";
        if($("#countryCode").val()!="" && $("#countryCode").val()!="US" && $("#countryCode").val()!="IN"){

        //console.log("inside");
        		for(x in countriesRestricted)
        		{
        			if(x==$("#countryCode").val())
        			{
        				ctry=x;
        				break;
        			}
        		}
        		if(ctry=="")
        		{
        			ctry="WORLD";
        		}
                    //restrict in top navigation
                        if($("#topNavStuff div div table tbody tr td").length>0)
                        {
                                $("#topNavStuff div div table tbody tr td ul li a").each(function(){

                                        var brands=countriesRestricted[ctry].split(",");
                                        for(i=0;i<brands.length;i++){
                                                if($(this).text().toLowerCase()==brands[i])
                                                {
                                                        $(this).parent().remove();
                                                }
                                        }

                                });
                        }
                      //restrict in left menu in sort page
                        if($("#shoebrand ul li").length>0)
                        {
                        	
                                $("#shoebrand ul li a span").each(function(){

                                        var brands=countriesRestricted[ctry].split(",");
                                        for(i=0;i<brands.length;i++){
                                                if($(this).text().toLowerCase()==brands[i])
                                                {
                                                        //$(this).parent().parent().remove();
                                                	 $(this).parent().parent().hide();
                                                }
                                        }

                                });
                        }
                        //restrict add item in IDP
                        if($(".title_new").length>0)
                        {
                        	
                               

                                        var brands=countriesRestricted[ctry].split(",");
                                        for(i=0;i<brands.length;i++){
                                                if($(".title_new").text().toLowerCase().indexOf(brands[i])!=-1)
                                                {
                                                        $("#addtobutton").hide();
                                                }
                                        }

                              
                        }
                        //restrict left menu in listing pages 
                        if($(".leftMenuSelectedItem a").length>0)
                        {
                        	
                               

                                        var brands=countriesRestricted[ctry].split(",");
                                        for(i=0;i<brands.length;i++){
                                                if($(".leftMenuSelectedItem a").text().toLowerCase()==brands[i])
                                                {
                                                       // $(".leftMenuSelectedItem a").parent().parent().parent().parent().remove();
                                                	 $(".leftMenuSelectedItem a").parent().parent().parent().parent().hide();
                                                        break;
                                                }
                                        }

                              
                        }
                        //restrict left menu in listing pages
                        if($(".leftMenuItem a").length>0)
                        {
                        	
                               
                        	$(".leftMenuItem a").each(function(){
                                        var brands=countriesRestricted[ctry].split(",");
                                        for(i=0;i<brands.length;i++){
                                                if($(this).text().toLowerCase()==brands[i])
                                                {
                                                       // $(this).parent().parent().parent().parent().remove();
                                                	 $(this).parent().parent().parent().parent().hide();
                                                }
                                        }
                        	});

                              
                        }
                      //restrict in sale page
                        if($(".loop").length>0)
                        {
                        	
                               
                        	$(".loop").each(function(){
                                        var brands=countriesRestricted[ctry].split(",");
                                        for(i=0;i<brands.length;i++){
                                                if($(this).text().toLowerCase().indexOf(brands[i])!=-1)
                                                {
                                                        $(this).remove();
                                                }
                                        }
                        	});

                              
                        }
                        
                        if($(".ShoeBoxTexts b").length>0)
                        {
                        	$(".ShoeBoxTexts b").each(function(){
                        		var brands=countriesRestricted[ctry].split(",");
                                for(i=0;i<brands.length;i++){
                                        if($(this).text().toLowerCase()==brands[i])
                                        {
                                                $(this).parent().parent().children("div").children("a[href~='addItem']").attr("href","#").hide();
                                        }
                                }
                        	});
                        }
                        //console.log($(".prod_base").length);
                        if($(".prod_base").length>0)
                        {
                        	
                        	 var brands=countriesRestricted[ctry].split(",");
                        	$(".prod_base").each(function(){
                        		
                                	
                                		////console.log($($($($(this).children()[2]).children("ul li")[0]).children()[0]).text());
                                
                                		for(i=0;i<brands.length;i++){
                                            if($($($($(this).children()[2]).children("ul li")[0]).children()[0]).text().toLowerCase()==brands[i])
                                            {
                                                    $(this).parent().parent().children("div").children("a[href~='addItem']").attr("href","#").hide();
                                                    $($(this).children()[3]).find(".btn_addtocart").hide();
                                            }
                                    }
                        		
                        	});
                        	
                        	
                        }
               
        
        }

}


function checkCountryRestriction()
{
	
	
	var retVal=false;
	var countriesRestricted=new Array();

	//countriesRestricted["IN"]="ugg australia";
	countriesRestricted["WORLD"]="ugg australia";
        //restrict in top navigation
        //restrict in left menu in sort page
        //restrict add item in IDP
        //restrict in sale page
	 //restrict left menu in listing pages
	
	var ctry="";
        if($("#countryCode").val()!="" && $("#countryCode").val()!="US" && $("#countryCode").val()!="IN"){

        
        		for(x in countriesRestricted)
        		{
        			if(x==$("#countryCode").val())
        			{
        				ctry=x;
        				break;
        			}
        		}
        		if(ctry=="")
        		{
        			ctry="WORLD";
        		}
                    
                        //restrict add item in IDP
                        if($(".title_new").length>0)
                        {
                        	
                               

                                        var brands=countriesRestricted[ctry].split(",");
                                       
                                        for(i=0;i<brands.length;i++){
                                                if($(".title_new").text().toLowerCase().indexOf(brands[i])!=-1)
                                                {
                                                	//console.log(brands[i]);
                                                	retVal=false;
                                                	break;
                                                }
                                                else
                                                {
                                                	retVal=true;
                                                }
                                        }

                              
                        }
                        //restrict left menu in listing pages 
                       
        }
        else if($("#countryCode").val()=="US" || $("#countryCode").val()=="IN")
        {
        	retVal=true;
        }
      // //console.log(retVal);
        return retVal;
       
}


function putLookBookVideo()
{
	img1 = new Image();
    img1.src = "http://images2.solestruck.com/homepageBannerImage/videoBanner_inspirit.jpg";
	img2 = new Image();
    img2.src = "http://images2.solestruck.com/homepageBannerImage/videoBanner_inspirit-hover.jpg";


    var aObj=$("img[src*='homepageBannerImage']").parent();
	$(aObj).removeAttr("href");
	$(aObj).html("<img id=\"spiritBanner\" style=\"cursor:pointer;\" src=\"http://images2.solestruck.com/homepageBannerImage/videoBanner_inspirit.jpg\" width=\"750\" height=\"410\"/>");
	
	$("#spiritBanner").click(function(){
		
			$("<div id=\"player\" style=\"display:none;width:750px;height:410px;z-index:-5000;\"><iframe style=\"z-index:-5000;\"width=\"750\" height=\"411\" src=\"http://www.youtube.com/embed/K5tSXur7HUw?rel=0&autoplay=1&autohide=1&loop=1&playlist=K5tSXur7HUw&modestbranding=1&wmode=transparent\" frameborder=\"0\" allowfullscreen></iframe></div>").appendTo($(this).parent());

			$(this).fadeOut('fast',function(){$("#player").show();});

	
	});
	
		$("#spiritBanner").mouseover(function(){ $(this).attr("src","http://images2.solestruck.com/homepageBannerImage/videoBanner_inspirit-hover.jpg");}).mouseout(function(){$(this).attr("src","http://images2.solestruck.com/homepageBannerImage/videoBanner_inspirit.jpg");});
	
}

// This is for SOLE-4141 by YES

function playInSpiritLookBookVideo()
{

	$("#in_spirit_lbookvideo").click(function(){
		
			$("<div id=\"player\" class=\"photobook\"><iframe style=\"z-index:-5000;\"width=\"700\" height=\"450\" src=\"http://www.youtube.com/embed/QxZpedtWCEA?rel=0&autoplay=1&autohide=1&loop=1&playlist=QxZpedtWCEA&modestbranding=1&wmode=transparent\" frameborder=\"0\" allowfullscreen></iframe></div>").appendTo($(this).parent());

			$(this).fadeOut('fast',function(){$("#player").show();});

	
	});
	
		$("#in_spirit_lbookvideoImg").mouseover(function(){ $(this).attr("src","http://images2.solestruck.com/homepageBannerImage/videoBanner_inspirit-hover.jpg");}).mouseout(function(){$(this).attr("src","http://images2.solestruck.com/homepageBannerImage/videoBanner_inspirit.jpg");});
	
}

function playNightRiderLookBookVideo()
{
	
	$("#night_rider_lbookvideo").click(function(){
		
			$("<div id=\"player\" class=\"photobook\"><iframe style=\"z-index:-5000;\"width=\"700\" height=\"450\" src=\"http://www.youtube.com/embed/6lewRND1wH4?rel=0&autoplay=1&autohide=1&loop=1&playlist=6lewRND1wH4&modestbranding=1&wmode=transparent\" frameborder=\"0\" allowfullscreen></iframe></div>").appendTo($(this).parent());

			$(this).fadeOut('fast',function(){$("#player").show();});

	
	});
	
		$("#night_rider_lbookvideoImg").mouseover(function(){ $(this).attr("src","http://images2.solestruck.com/homepageBannerImage/videoBanner_nightrider-hover.jpg");}).mouseout(function(){$(this).attr("src","http://images2.solestruck.com/homepageBannerImage/videoBanner_nightrider.jpg");});
	
}

// Upto here This is for SOLE-4141 by YES
$(window).resize(function(){ 
	if($.browser.mozilla && $.browser.version.indexOf("1.")!=-1 && $("img[src~='homepageBannerImage']").length>0)
	{
	var left=$($("table")[0]).offset().left; 
		if(left>0)
		{
			$("#coverUp").css("position","fixed").css("width",(left-2)+"px").css("background-color","#ffffff").css("top","0px").css("height",$(document).height()+"px");
			$("#coverUp1").css("left",(left-10)+"px");
		}
		else
		{
			$("#coverUp").css("position","fixed").css("width","0px").css("background-color","#ffffff").css("top","0px").css("height",$(document).height()+"px");
			$("#coverUp1").css("left","0px");
		}
	}

	});
	
	
	

function removeCommentFromHomepage()
{
	if($.browser.mozilla && $.browser.version.indexOf("1.")!=-1 && $("img[src~='homepageBannerImage']").length>0)
	{
		var tableTop=$($("table")[1]).offset().top;
		var tableHeight=$($("table")[1]).height();
		var nextTableTop=$($("table")[2]).offset().top;
		var left=$($("table")[0]).offset().left;
		var divTop=tableTop+tableHeight+1;
		var divHeight=(tableTop+tableHeight)-nextTableTop-20;
		if(left>0)
		{
			$("<div id=\"coverUp\"></div>").appendTo("body");
			$("<div id=\"coverUp1\"></div>").appendTo("body");
			$("#coverUp").css("position","fixed").width((left-2)+"px").css("background-color","#ffffff").css("top","0px").height($(document).height()+"px");
			$(".header_banner").remove();
			$("#coverUp1").css("position","fixed").css("width","760px").css("background-color","#ffffff").css("top",divTop+"px").css("height","13px");
			$("#coverUp1").css("left",(left-10)+"px");
		}
		else
		{
			$("<div id=\"coverUp\"></div>").appendTo("body");
			$("<div id=\"coverUp1\"></div>").appendTo("body");
			$("#coverUp").css("position","fixed").width("0px").css("background-color","#ffffff").css("top","0px").height($(document).height()+"px");
			$(".header_banner").remove();
			$("#coverUp1").css("position","fixed").css("width","760px").css("background-color","#ffffff").css("top",divTop+"px").css("height","13px");
			$("#coverUp1").css("left","0px");
		}
		
	}
	
}

function restrictAcneFromIDP()
{
	precacheAcneIDPImg();
	
        if($(".title_new").length>0)
        {
 			var brandName=trim($(".title_new").text().substring(0,$(".title_new").text().indexOf($(".title_new em").text())));
             if(brandName.toLowerCase().indexOf("acne")!=-1)
                {
			
                    $("#addtobutton").hide();
					$("#sizeSelect").hide();
$("<a href=\"javascript:void(0);\" style=\"cursor:pointer;font-size: 13px;margin-top: 22px;float: left;margin-left: 1px;\" onclick=\"showAcnePopup();\"><img src=\"http://images2.solestruck.com/images/btn_add_crt_nobuy.gif\" width=\"114\" height=\"25\"/></a>").insertAfter("#addtobutton");
addAcnePopup();
                }
     
        }


		 if($(".ShoeBoxTexts b").length>0)
            {
            	$(".ShoeBoxTexts b").each(function(){
            	
                            if($(this).text().toLowerCase()=="acne")
                            {
                                    $(this).parent().parent().children("div").children("a[href~='addItem']").attr("href","#").hide();
                            }
                    
            	});
            }
            
            if($(".prod_base").length>0)
            {
            	
            	 var brands=countriesRestricted[ctry].split(",");
            	$(".prod_base").each(function(){
            		
                    	
                    		
                    
                    	
                                if($($($($(this).children()[2]).children("ul li")[0]).children()[0]).text().toLowerCase()=="acne")
                                {
                                        $(this).parent().parent().children("div").children("a[href~='addItem']").attr("href","#").hide();
                                        $($(this).children()[3]).find(".btn_addtocart").hide();
                                }
                       
            		
            	});
            	
            	
            }

}

function addAcnePopup()
{
	var htmlStr="<div id=\"emailUsDialogAcne\" style=\"display:none;border:1px solid #ccc;position: fixed; top:30%; left: 33%; z-index: 5000;background-color:#fff;width:460px;height:345px;padding-top:21px; \">";
	htmlStr+="<h1 id=\"oneele\" style=\"font-family:chalet;font-size:28px;font-weight:normal;margin-top:30px;margin-left:20px;color:#555\">in-store exclusive</h1>"; 
	htmlStr+="<h3 id=\"twoele\" style=\"font-size: 12px;margin-left: 19px;color: #444;\">Call 800-494-1260 or complete this form to request more information.</h3>";
	htmlStr+="<div  id=\"threeele\" style=\"float:right;color:#555;cursor:pointer;margin-top: -83px;margin-right: 10px;\" onclick=\"closeAcnePopup();\">[x]</div>"; 
	htmlStr+="<div id=\"fourele\" style=\"width:100%;border-top:1px solid #ccc;margin-top:10px;\"></div>"; 
	htmlStr+="<div id=\"fiveele\" style=\"background-color:#e5e5e5;\">"; 
	htmlStr+="<div id=\"sixele\" style=\"padding-top:10px;padding-bottom:5px;margin-left:10px;font-family:Tahoma;font-size:11px;color:#555;font-weight:bold;\">Your email address <span style=\"color:#d22e2e;\">*</span></div><input style=\"margin-left:10px;height:22px;width:430px;\" type=\"text\"  id=\"youremailaddressAcne\" />"; 
	htmlStr+="<div id=\"sevenele\" style=\"padding-top:10px;padding-bottom:5px;margin-left:10px;font-family:Tahoma;font-size:11px;color:#555; font-weight:bold;\">How can we help you ? <span style=\"color:#d22e2e;\">*</span></div><textarea style=\"margin-left:10px;height:125px;width:430px;\"  id=\"messageidAcne\"/>";
	htmlStr+="<div id=\"eightele\" style=\"width:100%;height:20px;\"></div>";
	htmlStr+="</div>"; 
	htmlStr+="<div id=\"nineele\" style=\"width:100%;border-top:1px solid #ccc;\"></div>"; 
	htmlStr+="<input type=\"image\" id=\"sendMailButtonAcne\" style=\"cursor:pointer;margin-top:10px;margin-left:10px;\" width=\"98\" height=\"25\" src=\"http://images2.solestruck.com/images/click_to_email/send_clktoemail.jpg\" onmouseout=\"this.src='http://images2.solestruck.com/images/click_to_email/send_clktoemail.jpg';\" onmouseover=\"this.src='http://images2.solestruck.com/images/click_to_email/send_clktoemail_hover.jpg';\" onclick=\"sendAcneMail('http://"+location.host+"/'); return false;\">";

	htmlStr+="</div>"; 
	$("body").append(htmlStr);
	browserRelatedChanges();
	$("#colorSelected").attr("onchange","changeShoeColorAndSizeForAcne"+$("#colorSelected").attr("onchange").toString().substring($("#colorSelected").attr("onchange").toString().indexOf("("),$("#colorSelected").attr("onchange").length));
	
	
	$("a img[onclick|='changeShoeColor']").each(function(){


	$(this).removeAttr("onclick");
	});
	
	$("#sizerangelist li a").removeAttr("onclick");
	

}

function browserRelatedChanges()
{
	if($.browser.msie && $.browser.version.indexOf("7")!=-1)
	{
		$("#emailUsDialogAcne").css("height","360px");
		$("#fiveele").css("margin-top","-18px");
		$("#sendMailButtonAcne").css("margin-top","-5px");
	}
}

function showAcnePopup()
{
	$("#emailUsDiv").fadeIn('fast');
	$("#emailUsDialogAcne").fadeIn('slow');
}

function sendAcneMail(hostname)
{
	if($("#youremailaddressAcne").val().length>0 && $("#messageidAcne").val().length>0 && isEmailId($("#youremailaddressAcne").val()))
	{
		
		var brandName=$(".title_new em").parent().text().split('\n')[1];
		if($.browser.msie && $.browser.version.indexOf("7")!=-1)
		{
			brandName=$(".title_new em").parent().text().toString();
		}
		
		$.ajax({
			url:hostname+'clickToEmail.do',
			method:'post',
			data:{'method':'sendEmail','addr':$("#youremailaddressAcne").val(),'order':'Acne -'+$(".title_new em").text()+'('+$("#colorSelected").val().substring($("#colorSelected").val().indexOf("(")+1,$("#colorSelected").val().indexOf(")"))+')','msg':$("#messageidAcne").val()},
			dataType:'html',
			success:function(html)
			{
				showAcneSentMsg();
			}
		});
	}
	else
	{
		if($("#youremailaddressAcne").val().length<=0)
		{
			
				$("#youremailaddressAcne").css("border","1px solid #d22e2e");
		}
		else
		{
			$("#youremailaddressAcne").css("border","1px solid #000");
		}
		
		if($("#messageidAcne").val().length<=0)
		{
			$("#messageidAcne").css("border","1px solid #d22e2e");
		}
		else
			{
				$("#messageidAcne").css("border","1px solid #000");
			}
		
		if(!isEmailId($("#youremailaddressAcne").val()))
		{
			$("#youremailaddressAcne").css("border","1px solid #d22e2e");
		}
		else
		{
			$("#youremailaddressAcne").css("border","1px solid #000");
		}
		
		
	}
	
}

function isEmailId(mailId)
{
	
		   var emailRegEx = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;	
		if(mailId.length>0)
		{
			if(emailRegEx.test(mailId) == false)		      
			      return false;
			   else
				   return true;
		}	   
		else
		{
			return false;
		}
		   
			
}

function trimAcne(s)
{
	var l=0; var r=s.length -1;
	while(l < s.length && s[l] == ' ')
	{	l++; }
	while(r > l && s[r] == ' ')
	{	r-=1;	}
	return s.substring(l, r+1);
}

function showAcneSentMsg()
{
	var htmlStr="";
	htmlStr+="<h1 id=\"oneele\" style=\"font-family:chalet;font-size:28px;font-weight:normal;margin-top:30px;margin-left:20px;color:#555\">in-store exclusive</h1>"; 
	htmlStr+="<h3 id=\"twoele\" style=\"font-size: 12px;margin-left: 19px;color: #444;\">Call 800-494-1260 or complete this form to request more information.</h3>";
	htmlStr+="<div id=\"threeele\" style=\"float:right;color:#555;cursor:pointer;margin-top: -83px;margin-right: 10px;\" onclick=\"closeAcnePopup();\">[x]</div>";
	htmlStr+="<div id=\"fourele\" style=\"width:100%;border-top:1px solid #ccc;margin-top:10px;\"></div>"; 
	htmlStr+="<div id=\"fiveele\" style=\"background-color:#e5e5e5;\">"; 
	htmlStr+="<div style=\"width:100%;height:50px;\"></div>";
	htmlStr+="<h1 style=\"font-size: 23px;margin-left: 67px;font-weight: normal;\">Your message has been sent.</h1>"; 
	htmlStr+="<div style=\"width:100%;height:10px;\"></div>";
	htmlStr+="<h3 style=\"color:#aaa;margin-left:31px\">Thanks and we'll get back to you shortly.</h3>";
	htmlStr+="<div style=\"width:100%;height:50px;\"></div>";
	htmlStr+="</div>"; 
	htmlStr+="<div style=\"width:100%;border-top:1px solid #ccc;\"></div>"; 
	htmlStr+="<div style=\"width:100%;height:30px;\"></div>";

	
	$("#emailUsDialogAcne").html(htmlStr);
	browserRelatedChanges();
}

function showAcnePopup()
{
	$("#emailUsDiv").fadeIn('fast');
	$("#emailUsDialogAcne").fadeIn('slow');
}

function closeAcnePopup()
{

	$("#emailUsDialogAcne").fadeOut('fast');
	$("#emailUsDiv").fadeOut('slow');
	var htmlStr="";
	htmlStr+="<h1 id=\"oneele\" style=\"font-family:chalet;font-size:28px;font-weight:normal;margin-top:30px;margin-left:20px;color:#555\">in-store exclusive</h1>"; 
	htmlStr+="<h3 id=\"twoele\" style=\"font-size: 12px;margin-left: 19px;color: #444;\">Call 800-494-1260 or complete this form to request more information.</h3>";
	htmlStr+="<div id=\"threeele\" style=\"float:right;color:#555;cursor:pointer;margin-top: -83px;margin-right: 10px;\" onclick=\"closeAcnePopup();\">[x]</div>"; 
	htmlStr+="<div id=\"fourele\" style=\"width:100%;border-top:1px solid #ccc;margin-top:10px;\"></div>"; 
	htmlStr+="<div id=\"fiveele\" style=\"background-color:#e5e5e5;\">"; 
	htmlStr+="<div id=\"sixele\" style=\"padding-top:10px;padding-bottom:5px;margin-left:10px;font-family:Tahoma;font-size:11px;color:#555;font-weight:bold;\">Your email address <span style=\"color:#d22e2e;\">*</span></div><input style=\"margin-left:10px;height:22px;width:430px;\" type=\"text\"  id=\"youremailaddressAcne\" />"; 
	htmlStr+="<div id=\"sevenele\" style=\"padding-top:10px;padding-bottom:5px;margin-left:10px;font-family:Tahoma;font-size:11px;color:#555; font-weight:bold;\">How can we help you ? <span style=\"color:#d22e2e;\">*</span></div><textarea style=\"margin-left:10px;height:125px;width:430px;\"  id=\"messageidAcne\"/>";
	htmlStr+="<div id=\"eightele\" style=\"width:100%;height:20px;\"></div>";
	htmlStr+="</div>"; 
	htmlStr+="<div id=\"nineele\" style=\"width:100%;border-top:1px solid #ccc;\"></div>"; 
	htmlStr+="<input type=\"image\" id=\"sendMailButtonAcne\" style=\"cursor:pointer;margin-top:10px;margin-left:10px;\" width=\"98\" height=\"25\" src=\"http://images2.solestruck.com/images/click_to_email/send_clktoemail.jpg\" onmouseout=\"this.src='http://images2.solestruck.com/images/click_to_email/send_clktoemail.jpg';\" onmouseover=\"this.src='http://images2.solestruck.com/images/click_to_email/send_clktoemail_hover.jpg';\" onclick=\"sendAcneMail('http://"+location.host+"/'); return false;\">";
	
	$("#emailUsDialogAcne").hide();
	$("#emailUsDialogAcne").html(htmlStr);
	browserRelatedChanges();
}

function precacheAcneIDPImg()
{
	var img=new Image();
	img.src='http://images2.solestruck.com/images/btn_add_crt_nobuy.gif';
}

function disableAddtoCartInPopUp()
{
	if(showpopupwindow)
	{
		if(showpopupwindow.document.getElementById("ShoeImage").src.replace(/-/g,' ').split('/')[3].toLowerCase().indexOf("acne")!=-1)
        {

            
                   	showpopupwindow.document.getElementById("images").style.display='none';
				
				

        }
	}
}

function changeShoeColorForAcne(newColor,colorTitle,colorId,colornameid,itemTypeId)
{
		document.getElementById("archive").style.display="block";
	if(document.getElementById("colorSelected")!= null ){
	document.getElementById("colorSelected").value = colornameid;
	}
	document.getElementById("showviewimage").innerHTML = "";
	changeShoeColorAndSizeForAcne(colornameid,itemTypeId);
}



function changeShoeColorAndSizeForAcne(newColor,itemTypeId){



var colorTitle = newColor.substring(newColor.lastIndexOf("(")+1,newColor.lastIndexOf(")"));



var colorTitleSelected = colorTitle.replace(/-/g," ");

if(colorTitleSelected.length>23)
{
	colorTitleSelected=colorTitleSelected.substring(0,22)+"...";
}


	document.getElementById("shoecolorTitle").innerHTML = colorTitleSelected;
	var colorid = newColor.substring(newColor.lastIndexOf("-")+1);

	var imgurl = newColor.substring(0,newColor.lastIndexOf("-")+1);
	newColor = imgurl;

	document.getElementById("upper").src=  newColor+ "010101.jpg";
	document.getElementById("toe").src=  newColor+ "010102.jpg";
	document.getElementById("instep").src=  newColor+ "010103.jpg";
	document.getElementById("outstep").src=  newColor+ "010104.jpg";

	document.getElementById("showupper").src=  newColor+ "010401.jpg";
	document.getElementById("showtoe").src=  newColor+ "010402.jpg";
	document.getElementById("showinstep").src=  newColor+ "010403.jpg";
	document.getElementById("showoutstep").src=  newColor+ "010404.jpg";

	if(itemTypeId!=2)
	{
		document.getElementById("heel").src=  newColor+ "010105.jpg";
		document.getElementById("sole").src=  newColor+ "010106.jpg";		
		document.getElementById("showheel").src=  newColor+ "010405.jpg";
		document.getElementById("showsole").src=  newColor+ "010406.jpg";
	}	

	document.getElementById("shoeimage").src = newColor + "010404.jpg";

	document.itemDetailForm.colorID.value = colorid;

	document.getElementById("colorSelect").value = colorid;	
	
	
	var SizeArray = new Array();	
	var ArrayExactSize = new Array();
	if(document.getElementById("archive") != null)
		document.getElementById("archive").style.display="block";
	if(document.getElementById("box_popup") != null)
	{
		/*document.getElementById("box_popup").style.display="block";
	
		var img = document.getElementById('box_popup');
		if (window.addEventListener) { 
		img.addEventListener('click', sizealert, false);
		}
		else {
		img.attachEvent('onClick', sizealert);
		} */
	}  
	if(document.getElementById("archiveSize") != null)
		document.getElementById("archiveSize").style.display="none";
	
	
		if(colorid == "12968"){

			SizeArray["0"] = "4";
		}

	
		if(colorid == "12968"){

			SizeArray["1"] = "4.5";
		}

	
		if(colorid == "12968"){

			SizeArray["2"] = "5";
		}

	
		if(colorid == "12968"){

			SizeArray["3"] = "5.5";
		}

	
		if(colorid == "12966"){

			SizeArray["4"] = "6";
		}

	
		if(colorid == "12967"){

			SizeArray["5"] = "6";
		}

	
		if(colorid == "12968"){

			SizeArray["6"] = "6";
		}

	
		if(colorid == "12970"){

			SizeArray["7"] = "6";
		}

	
		if(colorid == "12971"){

			SizeArray["8"] = "6";
		}

	
		if(colorid == "12972"){

			SizeArray["9"] = "6";
		}

	
		if(colorid == "12968"){

			SizeArray["10"] = "6.5";
		}

	
		if(colorid == "12966"){

			SizeArray["11"] = "7";
		}

	
		if(colorid == "12967"){

			SizeArray["12"] = "7";
		}

	
		if(colorid == "12968"){

			SizeArray["13"] = "7";
		}

	
		if(colorid == "12969"){

			SizeArray["14"] = "7";
		}

	
		if(colorid == "12970"){

			SizeArray["15"] = "7";
		}

	
		if(colorid == "12971"){

			SizeArray["16"] = "7";
		}

	
		if(colorid == "12972"){

			SizeArray["17"] = "7";
		}

	
		if(colorid == "12968"){

			SizeArray["18"] = "7.5";
		}

	
		if(colorid == "12966"){

			SizeArray["19"] = "8";
		}

	
		if(colorid == "12967"){

			SizeArray["20"] = "8";
		}

	
		if(colorid == "12968"){

			SizeArray["21"] = "8";
		}

	
		if(colorid == "12970"){

			SizeArray["22"] = "8";
		}

	
		if(colorid == "12971"){

			SizeArray["23"] = "8";
		}

	
		if(colorid == "12972"){

			SizeArray["24"] = "8";
		}

	
		if(colorid == "12968"){

			SizeArray["25"] = "8.5";
		}

	
		if(colorid == "12966"){

			SizeArray["26"] = "9";
		}

	
		if(colorid == "12967"){

			SizeArray["27"] = "9";
		}

	
		if(colorid == "12968"){

			SizeArray["28"] = "9";
		}

	
		if(colorid == "12970"){

			SizeArray["29"] = "9";
		}

	
		if(colorid == "12971"){

			SizeArray["30"] = "9";
		}

	
		if(colorid == "12972"){

			SizeArray["31"] = "9";
		}

	
		if(colorid == "12968"){

			SizeArray["32"] = "9.5";
		}

	
		if(colorid == "12966"){

			SizeArray["33"] = "10";
		}

	
		if(colorid == "12967"){

			SizeArray["34"] = "10";
		}

	
		if(colorid == "12968"){

			SizeArray["35"] = "10";
		}

	
		if(colorid == "12970"){

			SizeArray["36"] = "10";
		}

	
		if(colorid == "12971"){

			SizeArray["37"] = "10";
		}

	
		if(colorid == "12972"){

			SizeArray["38"] = "10";
		}

	
		if(colorid == "12968"){

			SizeArray["39"] = "10.5";
		}

	
		if(colorid == "12968"){

			SizeArray["40"] = "11";
		}

	
		if(colorid == "12972"){

			SizeArray["41"] = "11";
		}

	
		if(colorid == "12968"){

			SizeArray["42"] = "11.5";
		}

	
		if(colorid == "12968"){

			SizeArray["43"] = "12";
		}

	
		if(colorid == "12968"){

			SizeArray["44"] = "12.5";
		}

	
		if(colorid == "12968"){

			SizeArray["45"] = "13";
		}

	
		if(colorid == "12968"){

			SizeArray["46"] = "13.5";
		}

	
		if(colorid == "12968"){

			SizeArray["47"] = "14";
		}

		

	
	
	var  noOfRows=ArrayExactSize.length/9;
	
	noOfRows=Math.floor(noOfRows);	

	for(var i=0; i<ArrayExactSize.length; i++)
	{
		/* Creating Sizes dynamically under Size Tab based on the color selected */
		var currentUL = document.getElementById('sizerangelist');
		var addLI = document.createElement('li');

		if((i+1)==ArrayExactSize.length)
		{		
		}
		else if((i+1)==9)
		{
			addLI.className="sizeborderB";
		}
		else if((noOfRows==1) && (ArrayExactSize.length==9))
		{
			addLI.className="sizeborderR"
		}
		else if((i+1)<(noOfRows*9))
		{
			addLI.className="sizeborderRB";
		}
		else{
			addLI.className="sizeborderR";
		}			

		var addAnchor = document.createElement('a');
		var index = (countLi()+1);
		addAnchor.id = 'idForSize' + index;
		addAnchor.href = '#';
		addAnchor.className = 'sizeBg';
		addAnchor.onclick = function (){
			selectSizeList(this.id)
		};
		
		var addLITN = document.createTextNode(ArrayExactSize[i]);
		addAnchor.appendChild(addLITN);
		addLI.appendChild(addAnchor);
		currentUL.appendChild(addLI);
	}
	
	//Setting the colorTitle, SalePrice, Colroid as global values
	setTheValueOfGlobalVariable('lColorId',colorid);
	setTheValueOfGlobalVariable('colorTitle',colorTitle);
	setTheValueOfGlobalVariable('salePrice',salePriceArray[colorid]);

	// Code to display Sale price according to Shoe Color
	
	if(salePriceArray[colorid]==null)
	{
		salePriceArray[colorid]=0;	
		setTheValueOfGlobalVariable('salePrice',salePriceArray[colorid]);
	}

	if((salePriceArray[colorid])>0) {
		if(document.getElementById("retailprice") != null)
		{
			document.getElementById("retailprice").className = "original_price";	
			document.getElementById("saleprice").innerHTML = '$' + salePriceArray[colorid];
	
			var discount = Math.round(((lRetailPrice - salePriceArray[colorid])/lRetailPrice)*100);
			document.getElementById("discountpercentage").innerHTML = '('+discount+'% OFF)';
		}		
	}	
	else {
		if(document.getElementById("saleprice") != null)
		{
			document.getElementById("saleprice").innerHTML = '&nbsp';
			document.getElementById("discountpercentage").innerHTML = '&nbsp';
			document.getElementById("retailprice").className = "RetailPrice";
		}		
	}

} //End changeShoeColorAndSize 



function putLookBookVideoLeatherExtensions()
{
	img1 = new Image();
    img1.src = "http://images2.solestruck.com/homepageBannerImage/leatherex-lg.jpg";
	img2 = new Image();
    img2.src = "http://images2.solestruck.com/homepageBannerImage/leatherex-lg-hover.jpg";

	if($(".look_book_banner").length>0){
    var aObj=$("img[src*='homepageBannerImage']").parent();
	$(aObj).removeAttr("href");
	$(aObj).html("<img id=\"spiritBanner\" style=\"cursor:pointer;\" src=\"http://images2.solestruck.com/homepageBannerImage/leatherex-lg.jpg\" width=\"750\" height=\"410\"/>");
	
	$("#spiritBanner").click(function(){
		
			$("<div id=\"player\" style=\"display:none;width:750px;height:410px;z-index:-5000;\"><iframe style=\"z-index:-5000;\"width=\"750\" height=\"411\" src=\"http://www.youtube.com/embed/xINKk6MJO14?rel=0&autoplay=1&autohide=1&loop=1&playlist=xINKk6MJO14&modestbranding=1&wmode=transparent\" frameborder=\"0\" allowfullscreen></iframe></div>").appendTo($(this).parent());

			$(this).fadeOut('fast',function(){$("#player").show();});

	
	});
	
		$("#spiritBanner").mouseover(function(){ $(this).attr("src","http://images2.solestruck.com/homepageBannerImage/leatherex-lg-hover.jpg");}).mouseout(function(){$(this).attr("src","http://images2.solestruck.com/homepageBannerImage/leatherex-lg.jpg");});
	}
	
}	



function startCounter()
{
	if($("img[src$='no_item_new.gif']").length<=0 && location.href.indexOf("flash-sale-matiko-senso-irregular-choice")!=-1)
		t=setInterval(function(){decrement();},1000);
}

function decrement()
{
	if(interval>0)
	{
		interval-=1000;
		formatDate();
	
	}
	else
	{
		clearInterval(t);
		location=location;
		disableFlashSale();
	}
}



function formatDate()
{
	var remain=interval;
	var hours=parseInt(remain/3600000);
	if(hours>0)
		remain=remain-(hours*3600000);
		
	var minutes=parseInt(remain/60000);
	
	if(minutes>0)
		remain=remain-(minutes*60000);
		
	
	var seconds=parseInt(remain/1000);
	

	if(hours>9)
	$("#hour").text(hours.toString());
	else
	$("#hour").text('0'+hours.toString());
	if(minutes>9)
	$("#min").text(minutes.toString());
	else
	$("#min").text('0'+minutes.toString());
	if(seconds>9)
	$("#sec").text(seconds.toString());
	else
	$("#sec").text('0'+seconds.toString());
}

