﻿// JScript File
var dynamicZoomURL = "";

// Change An Image
function ChangeImage( imgID, imgsrc, imgwidth, imgheight )
{
   if( document.getElementById( imgID ) )
	{ 
	   (document.getElementById(imgID)).src = imgsrc; 
	   (document.getElementById(imgID)).width = imgwidth; 
	   (document.getElementById(imgID)).height = imgheight; 
	}
}

function ChangeImageSrc( imgObj, imgsrc )
{
   imgObj.src = imgsrc;
}

function ChangeImageOnCLick( imgID, onclickStr )
{
   if( document.getElementById( imgID ) )
	{ 
	   (document.getElementById( imgID )).onclick = onclickStr; 
	}
}

function SwapProdImg(  imgID, imgsrc, zoomurl, imgwidth, imgheight  )
{
   if( document.getElementById( imgID ) )
	{ 
	   (document.getElementById(imgID)).src = imgsrc; 
	   (document.getElementById(imgID)).width = imgwidth; 
	   (document.getElementById(imgID)).height = imgheight; 
	   dynamicZoomURL = zoomurl;
	}  
}

function ZoomImage( imgurl )
{
   window.open( imgurl,'_Zoom','menubar=no,height=500,width=450,scrollbars=yes,resizable=yes,top=10,left=10');
}

function ProductImageZoom( zoomURL )
{
   if( dynamicZoomURL.length == 0 )
   {
      window.open( zoomURL, '_Zoom','menubar=no,height=500,width=450,scrollbars=yes,resizable=yes,top=10,left=10');
   }
   else
   {
      window.open( dynamicZoomURL, '_Zoom','menubar=no,height=500,width=450,scrollbars=yes,resizable=yes,top=10,left=10');   
   }
}

function clearTxtBox( elemObj )
{
   if (elemObj.defaultValue == elemObj.value) 
   {
      elemObj.value = ""
   }
}

function HideDiv( divID )
{
	if( document.getElementById(divID) )
	{	
	  (document.getElementById(divID)).style.display = "none";
	}
}

function ShowDiv( divID )
{
	if( document.getElementById(divID) )
	{
	  (document.getElementById(divID)).style.display = "";
	}
}

function ShowDivImgZoom( divID, imgID, imgsrc )
{
	if( document.getElementById(divID) )
	{
		(document.getElementById(divID)).style.display = "";
		if( document.getElementById( imgID ) )
		{ 
			(document.getElementById(imgID)).src = imgsrc; 
		}
	}
}

function HelpLoad( zoomURL, width, height )
{
	window.open( zoomURL, '_Zoom','menubar=no,height=' + height + ',width=' + width + ',scrollbars=yes,resizable=yes,top=10,left=10');   
}

$(document).ready(function() {		
	$('#Searchtb').focus(function(){
		if ($(this).val()=="Enter Search Terms")
		{
			$(this).val('').css('color', '#000');
		}
	}).blur(function(){
		if ($(this).val()=='')
		{
			$(this).val("Enter Search Terms").css('color', '#666');
		}
	}).keydown(function(e) {
		if(e.keyCode == 13) {
			doSearch();
			return false;
		}
	});
	$('.searchSubmit').click(doSearch);
});

function doSearch()
{
	if( $('#Searchtb').val() != "Enter Search Terms" )
	{
		window.location=BaseUrl+"/search.aspx?searchstr=" + $('#Searchtb').val();
	}
}

function SignUpPop( pgUrl )
{
   var emladdr = (document.getElementById('ctl00$tbEmailSignUp')).value;
   //alert( 'This eml val: ' + emladdr );
   if( emladdr.length > 0 )
   {
      if( emladdr != "Enter Email Address" ) 
      {
			if( pgUrl.length > 0 )
			{
				pgUrl = pgUrl + '?eml=' + emladdr;
				window.open( pgUrl, '_Zoom','menubar=no,height=500,width=600,scrollbars=yes,resizable=yes,top=10,left=10');
			}
      }
      else
      {
			alert('Please enter your email address');
      }
   }
   else
   {
		alert('Please enter your email address');
   }
} 

