// JavaScript Document

//Get Browser Type IE or Netscape based
var ie = null
var nn = null
if(document.all){
	ie=true;
}else{
	nn=true;
}
//Missing Icon placeholder
var defaultImage = '/skin_default/templateimages/content/NoImageAvailable_sm.jpg'


/*********************************************************************
'######################################################################
'#### PINDAR : KW : JQUERY CODE THAT CONTROLS:
'#### PINDAR : KW : Top Menu
'#### PINDAR : KW : Side Category Menu
'#### PINDAR : KW : Product Page Tabs
'######################################################################

/****************** PINDAR: KW: MAIN DROP DOWN MENU *****************/

var timeout    = 500;
var closetimer = 0;
var ddmenuitem = 0;

//SETTING UP OUR POPUP
//0 means disabled; 1 means enabled;
//var popupStatus = 0;

function loadQuotePopup(){
	//loads popup only if it is disabled
	//if(popupStatus==0){
	//if (($("#printQuote").style.display != null) && ($("#printQuote").style.display == 'none'))
	//{
		$("#backgroundPopup").css({"opacity": "0.0"});
		$("#backgroundPopup").fadeIn("slow");
		$("#printQuote").fadeIn("slow");
		//popupStatus = 1;
	//}
}

function disableQuotePopup(){
	//disables popup only if it is enabled
	//if(popupStatus==1){
	//if (($("#printQuote").style.display == null) || ($("#printQuote").style.display != 'none'))
	//{
		$("#backgroundPopup").fadeOut("slow");
		$("#printQuote").fadeOut("slow");
		//popupStatus = 0;
	//}
}

function centerQuotePopup(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#printQuote").height();
	var popupWidth = $("#printQuote").width();
	//centering
	$("#printQuote").css({"position": "absolute","top": windowHeight/2-popupHeight/2,"left": windowWidth/2-popupWidth/2});
	//only need force for IE6
	//$("#backgroundPopup").css({"height": windowHeight});
}

function loadCustomPopup(popupIndex){
	//make sure all open popups are closed - we can only open one at a time
	$("#customPopup1").fadeOut("slow");
	$("#customPopup2").fadeOut("slow");
	$("#customPopup3").fadeOut("slow");
	$("#customPopup4").fadeOut("slow");
	$("#customPopup5").fadeOut("slow");
	$("#customPopup6").fadeOut("slow");
	$("#customPopup7").fadeOut("slow");
	$("#customPopup8").fadeOut("slow");
	$("#customPopup9").fadeOut("slow");
	$("#customPopup10").fadeOut("slow");
	$("#customPopup11").fadeOut("slow");
	$("#customPopup12").fadeOut("slow");
	$("#customPopup13").fadeOut("slow");
	$("#customPopup14").fadeOut("slow");
	$("#customPopup15").fadeOut("slow");
	$("#customPopup16").fadeOut("slow");
	$("#customPopup17").fadeOut("slow");
	$("#customPopup18").fadeOut("slow");
	$("#customPopup19").fadeOut("slow");
	$("#customPopup20").fadeOut("slow");
	$("#backgroundPopup").fadeOut("slow");
	
	//load the selected popup
	$("#backgroundPopup").css({"opacity": "0.0"});
	$("#backgroundPopup").fadeIn("slow");	
	$("#customPopup" + popupIndex).fadeIn("slow");
}

function disableCustomPopup(popupIndex){
	//disables the selected popup
	$("#backgroundPopup").fadeOut("slow");
	$("#printQuote").fadeOut("slow");	
	$("#customPopup" + popupIndex).fadeOut("slow");
}

function centerCustomPopup(popupIndex){
	var popupHeight;
	var popupWidth;
	
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	
	popupHeight = $("#customPopup" + popupIndex).height();
	popupWidth = $("#customPopup" + popupIndex).width();
	
	//centering
	//$("#customPopup" + popupIndex).css({"position": "absolute","top": windowHeight/2-popupHeight/2,"left": windowWidth/2-popupWidth/2});			
	$("#customPopup" + popupIndex).css({"position": "absolute","top": $(document).scrollTop(),"left": windowWidth/2-popupWidth/2});

	//only need force for IE6
	$("#backgroundPopup").css({"height": windowHeight});
}

function loadPtdvPopup(){
	//load the selected popup
	$("#backgroundPopup").css({"opacity": "0.0"});
	$("#backgroundPopup").fadeIn("slow");	
	$("#ptdvPopup").fadeIn("slow");
}

function disablePtdvPopup(){
	//disables the selected popup
	$("#backgroundPopup").fadeOut("slow");
	$("#ptdvPopup").fadeOut("slow");
}

function centerPtdvPopup(){
	var popupHeight;
	var popupWidth;
	
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	
	popupHeight = $("#ptdvPopup").height();
	popupWidth = $("#ptdvPopup").width();
	
	//centering
	//$("#ptdvPopup" + popupIndex).css({"position": "absolute","top": windowHeight/2-popupHeight/2,"left": windowWidth/2-popupWidth/2});			
	$("#ptdvPopup").css({"position": "absolute","top": $(document).scrollTop(),"left": windowWidth/2-popupWidth/2});

	//only need force for IE6
	$("#backgroundPopup").css({"height": windowHeight});
}

function loadLoginPopup(){
	//load the selected popup
	$("#backgroundPopup").css({"opacity": "0.0"});
	$("#backgroundPopup").fadeIn("slow");	
	$("#loginPopup").fadeIn("slow");
}

function disableLoginPopup(){
	//disables the selected popup
	$("#backgroundPopup").fadeOut("slow");
	$("#loginPopup").fadeOut("slow");
}

function loadClickToCallPopup(){
	//load the selected popup
	$("#backgroundPopup").css({"opacity": "0.0"});
	$("#backgroundPopup").fadeIn("slow");	
	$("#clickToCallPopup").fadeIn("slow");
}

function disableClickToCallPopup(){
	//disables the selected popup
	$("#backgroundPopup").fadeOut("slow");
	$("#clickToCallPopup").fadeOut("slow");
}

function centerLoginPopup(){
	var popupHeight;
	var popupWidth;
	
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	
	popupHeight = $("#loginPopup").height();
	popupWidth = $("#loginPopup").width();
	
	//centering
	//$("#ptdvPopup" + popupIndex).css({"position": "absolute","top": windowHeight/2-popupHeight/2,"left": windowWidth/2-popupWidth/2});			
	$("#loginPopup").css({"position": "absolute","top": $(document).scrollTop(),"left": windowWidth/2-popupWidth/2});

	//only need force for IE6
	$("#backgroundPopup").css({"height": windowHeight});
}

function centerClickToCallPopup(){
	var popupHeight;
	var popupWidth;
	
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	
	popupHeight = $("#clickToCallPopup").height();
	popupWidth = $("#clickToCallPopup").width();
	
	//centering
	//$("#ptdvPopup" + popupIndex).css({"position": "absolute","top": windowHeight/2-popupHeight/2,"left": windowWidth/2-popupWidth/2});			
	$("#clickToCallPopup").css({"position": "absolute","top": $(document).scrollTop(),"left": windowWidth/2-popupWidth/2});

	//only need force for IE6
	$("#backgroundPopup").css({"height": windowHeight});
}

function PindarMenu_open()
{  //PindarMenu_canceltimer();
   PindarMenu_close();
   ddmenuitem = $(this).find('ul').css('visibility', 'visible');}

function PindarMenu_close()
{  if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

function PindarMenu_timer()
{  closetimer = window.setTimeout(PindarMenu_close, timeout);}

function PindarMenu_canceltimer()
{  if(closetimer)
   {  window.clearTimeout(closetimer);
      closetimer = null;}}

$(document).ready(function()
{ 
   //$('[class="NoArrowNav"]').bind('mouseover', PindarMenu_open)

   //$('[class="NoArrowNav"]').bind('mouseout',  PindarMenu_close)
});

$(document).ready(function()
{  $('#HomeMenu > li').bind('mouseover', PindarMenu_open)
   $('#HomeMenu > li').bind('mouseout',  PindarMenu_close)});
   
document.onclick = PindarMenu_close;

/***************** PINDAR: KW: END MAIN DROP DOWN MENU *************/

/***************** PINDAR: KW: START COLLAPSIBLE CATEGORY MENU ************/
	function initMenus() {
	
	/*
	'######################################################################
	'#### PINDAR : KW : Find out how many menu levels we need to hide
	'#### PINDAR : KW : Set as a Cookie in config.asp
	'#### PINDAR : KW : Loop through after reading the cookie to build up
	'#### PINDAR : KW : The number of UL levels to hide
	'#### PINDAR : KW : Also See what market type it is as the differing
	'#### PINDAR : KW : Number of sub-levels affects the way
	'######################################################################
	*/
	
	 TempLevelscookieExists = document.cookie.indexOf('HideMenuLevels');
	
     if (TempLevelscookieExists != -1) 		
		{	
			MenuLevels = readCookie("HideMenuLevels");
			//alert("TempLevels "+TempLevels);
			//var TempLevelsArray = TempLevels.split("=");
			//var MenuLevels = TempLevelsArray[1];
		}
	else
		{
			//var MenuLevels = 3;
			var MenuLevels = 3;
		}
	

	 TempMarketcookieExists = document.cookie.indexOf('MarketType');
	
     if (TempMarketcookieExists != -1) 		
		{	
			MarketType = readCookie("MarketType");
		//	alert("TempMarket "+TempMarket);
			//var TempMarketArray = TempMarket.split("=");
	   		//var MarketType = TempMarketArray[1];
		}
	else
		{
			var MarketType = "C";
		}
		
	MenuItemcookieExists = document.cookie.indexOf('PreviousMenuItem');
	
     if (MenuItemcookieExists != -1) 		
		{	
			PreviousMenuItem = readCookie("PreviousMenuItem");
			//var TempParent = TempMenuItemSettings.split("=");
			//var PreviousMenuItem = TempParent[1];
		}
	else
		{
			var PreviousMenuItem = 0;
		}

	
	var ListString = "";
	
	for (i=1;i<=MenuLevels;i++)
	{
		ListString = ListString +" ul";
	}
	

	
	
		
	//Set A Default Value for the parent Cat ID
		
	var ParentCatID = 0;

	/*
	'######################################################################
	'#### PINDAR : KW : Find Parent ID Of the current Menu Item
	'######################################################################
	*/
	$('ul.categorymenu'+ListString).hide();
	
	
	//'#### PINDAR : KW : Find out the parent ID so we can open the Menu at the appropriate Level
			var variable = "strParents";
			var catVariable = "CAT_ID";
			var ParentString = "";
			var catID = "";
			var query = window.location.search.substring(1); 
			
			var vars = query.split("&");
			  for (var i=0;i<vars.length;i++) 
			  {
				 var pair = vars[i].split("=");
					if (pair[0] == variable) 
					{
						 ParentString = pair[1];
					}
					if (pair[0] == catVariable) 
					{
						 catID = pair[1];
					}					
			   } 
			   
			  
			/*
	
			'#### PINDAR : KW : The following keeps the menu expanded
			'#### PINDAR : KW : According to the category you're on

			*/
				var mySplitResult = ParentString.split(",");
				
				var TotalParents = (mySplitResult.length)-1;
				
/*				for(ML = 2; ML <= TotalParents; ML ++)
					{
						ParentCatID = mySplitResult[ML];
						var selectedCat = $("#C_"+ParentCatID);
						
						var parentLink = $("#A_"+ParentCatID);

							
						$(selectedCat).slideToggle("medium");
						
						$(parentLink).toggleClass("expanded").toggleClass("collapsed")
						
					}
				
			//if we are on a category landing page, expand the category menu
			//mdw
			selectedCat = $("#C_"+catID);
			$(selectedCat).slideToggle("medium");
	*/
	
	//'#### PINDAR : KW : START Open Menu Code

	$('ul.categorymenu li a').click(
		function() {
			
			
				
		
			/*'#### PINDAR : KW : Write Out Current Parent Category and
			  '#### PINDAR : KW : Hide Menu/Market Type to a cookie
			  '#### PINDAR : KW : So that we can close the correct
			  '#### PINDAR : KW : Menu Item when opening another
			*/  

			//Create Cookies
			 createCookie('HideMenuLevels',MenuLevels, 1);
			 createCookie('MarketType',MarketType, 1);
			 createCookie('PreviousMenuItem',ParentCatID, 1);
			
		
			/***************
			'#### PINDAR : KW : 	
			COMMENTED OUT AS Current ML site leaves the previously clicked items open
			
			Note: Code below not fully checked!
			
			*****************/
			//Hide Previously Opened Menu Item if we're now on a new item
			
		//	if(PreviousMenuItem=="0" || PreviousMenuItem == ParentCatID)
		//	{
				//Close all items as we're on the top anyway
		//		$('ul.categorymenu ' + ListString	).hide();
		//		var ItemToClose = $("#C_"+PreviousMenuItem);
		//		$(ItemToClose).slideToggle("medium");
		//		$(ItemToClose).hide();
		//		$(ItemToClose).toggleClass("expanded").toggleClass("collapsed");
	
		//	}
		//	else
		//	{
				//Close Specific Item
		//		var ItemToClose = $("#C_"+PreviousMenuItem);
		//		$(ItemToClose).slideToggle("medium");
		//		$(ItemToClose).hide();
		//		$(ItemToClose).toggleClass("collapsed");

		//	}	
			
/*			if($(this).hasClass('collapsed') || $(this).hasClass('expanded'))
			{
			$(this).toggleClass("expanded").toggleClass("collapsed").find("+ ul").slideToggle("medium");
			}
			else if($(this).hasClass('expanded'))
			{
			//alert("expanded");
			}
			else
			{
			$(this).find("+ ul").slideToggle("medium");
			}
*/
		}

	);

	$('ul.purchmenu li input').click(
		/*function() {
			//we now have category landing pages so we don't want to expand the menu here.
			if($(this).hasClass('collapsed') || $(this).hasClass('expanded'))
			{
				$(this).toggleClass("expanded").toggleClass("collapsed").find("+ ul").slideToggle("medium");
			}
			else if($(this).hasClass('expanded'))
			{
			//alert("expanded");
			}
			else
			{
			$(this).find("+ ul").slideToggle("medium");
			}
		}*/
		
		function() {
			$("input[id^='BillTo']").removeClass("hiddenexpanded").addClass("hiddencollapsed");
						
			//hide the contacts if they show
			var contactVisible = false;
			if ($('#ContactMenuHeaderDiv').hasClass("hiddenexpanded"))
			{
				contactVisible = true;
				$('#ContactMenuHeaderDiv').slideUp('medium');
				$('#ContactMenuHeaderDiv').removeClass("hiddenexpanded").addClass("hiddencollapsed");
				$("ul[id$='Contact']").slideUp('medium');
				$("ul[id$='Contact']").removeClass("hiddenexpanded").addClass("hiddencollapsed")
				$("input[id$='Contact']").removeAttr("checked"); 
			}

			//hide the shiptos if they show
			var shipToVisible = false;
			if ($('#ShipToMenuHeaderDiv').hasClass("hiddenexpanded"))
			{	
				shipToVisible = true;
				$('#ShipToMenuHeaderDiv').slideUp('medium');
				$('#ShipToMenuHeaderDiv').removeClass("hiddenexpanded").addClass("hiddencollapsed");
				$("ul[id$='ShipTo']").slideUp('medium');
				$("ul[id$='ShipTo']").removeClass("hiddenexpanded").addClass("hiddencollapsed")
				$("input[name='BillToShipTo']").removeAttr("checked"); 
			}
			
			//hide the Add New if it shows
			var addNewVisible = false;
			if ($('#AddNewAddress').hasClass("hiddenexpanded"))
			{
				addNewVisible = true;			
				$('#AddNewAddress').slideUp('medium');
				$('#AddNewAddress').removeClass("hiddenexpanded").addClass("hiddencollapsed");	
			}
			
			//clear the new contact if there is any
			$("input[id^='NewContact']").val(''); 
			$("input[id^='NewContact']").attr("disabled", true); 
			$('ul.purchmenushiptocontact li input.radio').removeAttr("checked");
			$('#purchmenusubmit').attr("disabled", true); 
			$('#purchmenusubmit').attr("src", "/skin_default/templateimages/content/continueDisabled.jpg");
			
			//show the shiptos for the selected bill to
			if ($(this).attr("id") == "BillToAddNew")
			{
				if (shipToVisible == true)
				{
					setTimeout(function(){$('#AddNewAddress').slideDown('medium');}, 400);
				}
				else
				{
					$('#AddNewAddress').slideDown('medium');
				}
				$('#AddNewAddress').addClass("hiddenexpanded").removeClass("hiddencollapsed");
				
				//scroll to the appropriate part of the screen.
				//pause for a moment to make sure the div is correctly positioned
				//$('html, body').animate({scrollTop: $('#AddNewAddress').offset().top - 50}, 1500);
				setTimeout(function(){$('html, body').animate({scrollTop: $('#AddNewAddress').offset().top - 50}, 1500);}, 400);
			}
			else
			{
				if (addNewVisible == true)
				{
					setTimeout(function(){$('#ShipToMenuHeaderDiv').slideDown('medium');}, 400);
					setTimeout(function(){$('#ShipToMenuHeaderDiv').addClass("hiddenexpanded").removeClass("hiddencollapsed");}, 400);
					$('#' + $(this).attr("id") + "ShipTo").slideToggle('medium');
					
					//scroll to the appropriate part of the screen.
					setTimeout(function(){$('html, body').animate({scrollTop: $('#ShipToMenuHeaderDiv').offset().top - 50}, 1500);}, 400);
				}
				else
				{
					$('#ShipToMenuHeaderDiv').slideDown('medium');
					$('#ShipToMenuHeaderDiv').addClass("hiddenexpanded").removeClass("hiddencollapsed");
					$('#' + $(this).attr("id") + "ShipTo").slideToggle('medium');
					
					//scroll to the appropriate part of the screen.
					$('html, body').animate({scrollTop: $('#ShipToMenuHeaderDiv').offset().top - 50}, 1500);
				}
			}
		}
	);

	$('ul.purchmenushipto li input').click(
		function() {
			$("input[id^='BillTo'][id*='ShipTo']").removeClass("hiddenexpanded").addClass("hiddencollapsed");
			
			//hide the contacts if they show
			var contactVisible = false;
			if ($('#ContactMenuHeaderDiv').hasClass("hiddenexpanded"))
			{
				contactVisible = true;
				$('#ContactMenuHeaderDiv').slideUp('medium');
				$('#ContactMenuHeaderDiv').removeClass("hiddenexpanded").addClass("hiddencollapsed");
				$("ul[id$='Contact']").slideUp('medium');
				$("ul[id$='Contact']").removeClass("hiddenexpanded").addClass("hiddencollapsed")
			}
			
			//hide the Add New if it shows
			var addNewVisible = false;
			if ($('#AddNewAddress').hasClass("hiddenexpanded"))
			{
				addNewVisible = true;
				$('#AddNewAddress').slideUp('medium');
				$('#AddNewAddress').removeClass("hiddenexpanded").addClass("hiddencollapsed");				
			}			
			
			//clear the new contact if there is any
			$("input[id^='NewContact']").val(''); 
			$("input[id^='NewContact']").attr("disabled", true); 
			$('ul.purchmenushiptocontact li input.radio').removeAttr("checked");
			$('#purchmenusubmit').attr("disabled", true); 
			$('#purchmenusubmit').attr("src", "/skin_default/templateimages/content/continueDisabled.jpg");
			
			if ($(this).attr("id") == "BillToShipToAddNew")
			{
				if (contactVisible == true)
				{
					setTimeout(function(){$('#AddNewAddress').slideDown('medium');}, 400);
				}
				else
				{
					$('#AddNewAddress').slideDown('medium');
				}
				$('#AddNewAddress').addClass("hiddenexpanded").removeClass("hiddencollapsed");
				
				//scroll to the appropriate part of the screen.
				//pause for a moment to make sure the div is correctly positioned
				//$('html, body').animate({scrollTop: $('#AddNewAddress').offset().top - 50}, 1500);
				setTimeout(function(){$('html, body').animate({scrollTop: $('#AddNewAddress').offset().top - 50}, 1500);}, 400);
			}
			else
			{
				if (addNewVisible == true)
				{
					//show the contacts for the selected shipto 
					setTimeout(function(){$('#ContactMenuHeaderDiv').slideDown('medium');}, 400);
					setTimeout(function(){$('#ContactMenuHeaderDiv').addClass("hiddenexpanded").removeClass("hiddencollapsed");}, 400);
					$('#' + $(this).attr("id") + "Contact").slideDown('medium');
					
					//scroll to the appropriate position
					setTimeout(function(){$('html, body').animate({scrollTop: $('#ContactMenuHeaderDiv').offset().top - 50}, 1500);}, 400);
				}
				else
				{
					//show the contacts for the selected shipto 
					$('#ContactMenuHeaderDiv').slideDown('medium');
					$('#ContactMenuHeaderDiv').addClass("hiddenexpanded").removeClass("hiddencollapsed");
					$('#' + $(this).attr("id") + "Contact").slideDown('medium');
					
					//scroll to the appropriate position
					$('html, body').animate({scrollTop: $('#ContactMenuHeaderDiv').offset().top - 50}, 1500);
				}
			}
		}
	);	
	
	$('ul.purchmenushiptocontact li input.radio').click(
		function() {
				if ($(this).attr("id") == "BillToShipToContactAddNew")
				{
					$("input[id^='NewContact']").removeAttr("disabled"); 
				}
				else
				{
					$("input[id^='NewContact']").attr("disabled", true); 
				}
				
				$('#purchmenusubmit').removeAttr("disabled"); 
				$('#purchmenusubmit').attr("src", "/skin_default/templateimages/content/continue.jpg");
		}
	);
	
	$('ul.purchmenu li a').mouseover(
		function() {
			//$(this).css("color","#D8781A");
		}
	);	
	
	$('ul.purchmenu li a').mouseout(
		function() {
			//$(this).css("color","black");
		}
	);
	
	$('ul.purchmenushipto li a').mouseover(
		function() {
			//$(this).css("color","#D8781A");
		}
	);	
	
	$('ul.purchmenushipto li a').mouseout(
		function() {
			//$(this).css("color","black");
		}
	);
	
	$('ul.purchmenushiptocontact li a').mouseover(
		function() {
			//$(this).css("color","#D8781A");
		}
	);	
	
	$('ul.purchmenushiptocontact li a').mouseout(
		function() {
			//$(this).css("color","black");
		}
	);
	
//	$('#purchmenusubmit').click(
//		function() {
//			$('#AddNewAddress').hide();
//			$('#AddNewAddressHeader').hide();
//			$('html, body').animate({scrollTop: $('#MainPageContainer').offset().top}, 1500);
//		}
//	);	

//	$('#showPrintQuote').click(
//		function() {
//			$('#printQuote').slideDown('medium');
//		}
//	);	
	
//	$('#hidePrintQuote').click(
//		function() {
//			$('#printQuote').slideUp('medium');
//		}
//	);	

	$("#printQuoteButton").click(function(){
		//centering with css
		centerQuotePopup();
		//load popup
		loadQuotePopup();
	});
	
	$("#popupClose").click(function(){
		disableQuotePopup();
	});
	
	$("#backgroundPopup").click(function(){
		disableQuotePopup();
		disableCustomPopup(1);
		disableCustomPopup(2);
		disableCustomPopup(3);
		disableCustomPopup(4);
		disableCustomPopup(5);
		disableCustomPopup(6);
		disableCustomPopup(7);
		disableCustomPopup(8);
		disableCustomPopup(9);
		disableCustomPopup(10);
		disableCustomPopup(11);
		disableCustomPopup(12);
		disableCustomPopup(13);
		disableCustomPopup(14);
		disableCustomPopup(15);
		disableCustomPopup(16);
		disableCustomPopup(17);
		disableCustomPopup(18);
		disableCustomPopup(19);
		disableCustomPopup(20);
		disablePtdvPopup();
		disableClickToCallPopup();
		disableLoginPopup();
	});
	
	$("#submitPrintQuote").click(function(){
		$('#Q_RequiredFailure').slideUp('medium');
		if (PrintQuoteRequiredCheck())
		{
			disableQuotePopup();
		}
		else
		{
			$('#Q_RequiredFailure').slideDown('medium');
		}
	});
	
	$("#customPopup1Trigger").click(function(){
		//centering with css
		centerCustomPopup(1);
		//load popup
		loadCustomPopup(1);
	});
	
	$("#customPopup2Trigger").click(function(){
		//centering with css
		centerCustomPopup(2);
		//load popup
		loadCustomPopup(2);
	});
	
	$("#customPopup3Trigger").click(function(){
		//centering with css
		centerCustomPopup(3);
		//load popup
		loadCustomPopup(3);
	});
	
	$("#customPopup4Trigger").click(function(){
		//centering with css
		centerCustomPopup(4);
		//load popup
		loadCustomPopup(4);
	});

	$("#customPopup5Trigger").click(function(){
		//centering with css
		centerCustomPopup(5);
		//load popup
		loadCustomPopup(5);
	});

	$("#customPopup6Trigger").click(function(){
		//centering with css
		centerCustomPopup(6);
		//load popup
		loadCustomPopup(6);
	});

	$("#customPopup7Trigger").click(function(){
		//centering with css
		centerCustomPopup(7);
		//load popup
		loadCustomPopup(7);
	});

	$("#customPopup8Trigger").click(function(){
		//centering with css
		centerCustomPopup(8);
		//load popup
		loadCustomPopup(8);
	});

	$("#customPopup9Trigger").click(function(){
		//centering with css
		centerCustomPopup(9);
		//load popup
		loadCustomPopup(9);
	});

	$("#customPopup10Trigger").click(function(){
		//centering with css
		centerCustomPopup(10);
		//load popup
		loadCustomPopup(10);
	});

	$("#customPopup11Trigger").click(function(){
		//centering with css
		centerCustomPopup(11);
		//load popup
		loadCustomPopup(11);
	});

	$("#customPopup12Trigger").click(function(){
		//centering with css
		centerCustomPopup(12);
		//load popup
		loadCustomPopup(12);
	});

	$("#customPopup13Trigger").click(function(){
		//centering with css
		centerCustomPopup(13);
		//load popup
		loadCustomPopup(13);
	});

	$("#customPopup14Trigger").click(function(){
		//centering with css
		centerCustomPopup(14);
		//load popup
		loadCustomPopup(14);
	});

	$("#customPopup15Trigger").click(function(){
		//centering with css
		centerCustomPopup(15);
		//load popup
		loadCustomPopup(15);
	});

	$("#customPopup16Trigger").click(function(){
		//centering with css
		centerCustomPopup(16);
		//load popup
		loadCustomPopup(16);
	});

	$("#customPopup17Trigger").click(function(){
		//centering with css
		centerCustomPopup(17);
		//load popup
		loadCustomPopup(17);
	});

	$("#customPopup18Trigger").click(function(){
		//centering with css
		centerCustomPopup(18);
		//load popup
		loadCustomPopup(18);
	});

	$("#customPopup19Trigger").click(function(){
		//centering with css
		centerCustomPopup(19);
		//load popup
		loadCustomPopup(19);
	});

	$("#customPopup20Trigger").click(function(){
		//centering with css
		centerCustomPopup(20);
		//load popup
		loadCustomPopup(20);
	});
	
	$("#customPopup1Close").click(function(){
		disableCustomPopup(1);
	});	
	
	$("#customPopup2Close").click(function(){
		disableCustomPopup(2);
	});	

	$("#customPopup3Close").click(function(){
		disableCustomPopup(3);
	});
	
	$("#customPopup4Close").click(function(){
		disableCustomPopup(4);
	});	
	
	$("#customPopup5Close").click(function(){
		disableCustomPopup(5);
	});	
	
	$("#customPopup6Close").click(function(){
		disableCustomPopup(6);
	});	
	
	$("#customPopup7Close").click(function(){
		disableCustomPopup(7);
	});	
	
	$("#customPopup8Close").click(function(){
		disableCustomPopup(8);
	});	
	
	$("#customPopup9Close").click(function(){
		disableCustomPopup(9);
	});	
	
	$("#customPopup10Close").click(function(){
		disableCustomPopup(10);
	});	
	
	$("#customPopup11Close").click(function(){
		disableCustomPopup(11);
	});	
	
	$("#customPopup12Close").click(function(){
		disableCustomPopup(12);
	});	
	
	$("#customPopup13Close").click(function(){
		disableCustomPopup(13);
	});	
	
	$("#customPopup14Close").click(function(){
		disableCustomPopup(14);
	});	
	
	$("#customPopup15Close").click(function(){
		disableCustomPopup(15);
	});	
	
	$("#customPopup16Close").click(function(){
		disableCustomPopup(16);
	});	
	
	$("#customPopup17Close").click(function(){
		disableCustomPopup(17);
	});	
	
	$("#customPopup18Close").click(function(){
		disableCustomPopup(18);
	});	
	
	$("#customPopup19Close").click(function(){
		disableCustomPopup(19);
	});	
	
	$("#customPopup20Close").click(function(){
		disableCustomPopup(20);
	});	
	
	$('[id^="ptdvPopupTrigger"]').click(function(){
		//trying to avoid reload flicker, show the iframe
		$("#framePtdv").fadeIn("slow");
		
		//open the popup
		//centering with css
		centerPtdvPopup();
		//load popup
		loadPtdvPopup();
	});
	
	$("#ptdvPopupClose").click(function(){
		disablePtdvPopup();
		
		//trying to avoid reload flicker, hide the iframe
		$("#framePtdv").fadeOut("slow");
	});	
	
	$("#loginPopupTrigger").click(function(){
		//open the popup
		//centering with css
		centerLoginPopup();
		//load popup
		loadLoginPopup();
	});	
	
	$("#clickToCallPopupTrigger").click(function(){
		//open the popup
		//centering with css
		centerClickToCallPopup();
		//load popup
		loadClickToCallPopup();
	});	
	
	$("#clickToCallPopupClose").click(function(){
		disableClickToCallPopup();
	});	

	$("#loginPopupClose").click(function(){
		disableLoginPopup();
	});	
}

	
$(document).ready(function() {initMenus();});


/***************** PINDAR: KW: END COLLAPSIBLE CATEGORY MENU **************/


/**************** PINDAR: KW: Product page tabs ***********************/

/*****END TABS ***/

var timeoutId = 0
var blnBannerInit = true;
//Used to determine in banner is hidden
var blnElemHidden = false;
//Used for fade out
var opacity
if(ie){
	opacity=100
}else{
	opacity=1	
}
var bannerCount = 0;
var aryBanners = new Array();



function loadCatalogue(aryProducts){
	var i = 0
	for(i=0;i<aryProducts.length;i++){
		//Product Id
		var pId = aryProducts[i][0];
		//Product Name
		var pName = aryProducts[i][1];
		//Product Image - Hero Products use the Product Id
		var pImage = aryProducts[i][2]+(aryProducts[i][2]==''?'':'/')+aryProducts[i][6];
		//Product Description - Not used
		var pDescription = aryProducts[i][3]
		//check image value is not empty
		var d = new Date();
		var imgcache = d.getFullYear().toString()+d.getMonth().toString()+d.getDate().toString()+d.getHours().toString();
		var img = new Image()
		img.id = 'rotatingBannerImage'
		img.setAttribute('alt',pName)
		img.src='uploads/images_homepage_heros/'+pImage+'.jpg?' + escape(imgcache)
		//If the Image does not exist then show a default image.
		img.onerror = function(){
								this.src = defaultImage
						  }
		var bannerLink = document.createDocumentFragment()
		//Create the link to the product page
		var aLink = document.createElement('a')
		
		if (aryProducts[i][4] == 'PRODUCT')
		{
			aLink.setAttribute("href","product.asp?P_ID="+pId+aryProducts[i][5])
		}
		
		if (aryProducts[i][4] == 'PAGE')
		{
			aLink.setAttribute("href","page.asp?ID="+pId+aryProducts[i][5])
		}
		
		aLink.setAttribute("title",pName)
		//Insert the image to the link.
		aLink.appendChild(img)
		//add the Image and Text holders to the docFrag
		bannerLink.appendChild(aLink)
		//add the docFrag to the array
		aryBanners.push(bannerLink)
	}
}

function displayBanners(){
	var elem = document.getElementById('home_region1')
	if(elem==null){
		return false;
	}
	if(aryBanners.length==0){
		return false;	
	}
	
	if(blnElemHidden==true){
		showElem()
	}
	//Exit if there are no banners
	if(bannerCount==aryBanners.length){
		bannerCount = 0	
	}
	elem.innerHTML =''
	elem.appendChild(aryBanners[bannerCount].cloneNode(true))
	bannerCount++
	//Force the image to fit the size of the div set in the Stylesheet
	//Might need fixing for IE
	var img = document.getElementById('rotatingBannerImage')
	//If the image doesn't exist then use a default image.
	if(img!=null){		
		img.onerror = function(){
				this.src=defaultImage;
		}
	}

	if(img.width>elem.clientWidth){
			img.width=elem.clientWidth
	}
	//Time used to rotate the banner
	timeoutId = setTimeout("hideElem()",6500)
	
	return true;
}
function hideElem(){
		
	var elem = document.getElementById('home_region1')
	if(document.all){
		elem.style.filter = 'alpha(opacity='+opacity+')';	
	}else{
		elem.style.opacity=opacity	
	}
	if(parseFloat(opacity)>0){
		if(ie){
			opacity=opacity-10
			elem.style.filter = 'alpha(opacity=' + opacity + ')';
		}else{
			opacity=opacity-0.1
			elem.style.opacity = opacity;
		}
		setTimeout("hideElem()",75)
	}else{
		blnElemHidden = true
		displayBanners()
	}
	

	
}

function showElem(){
	var elem = document.getElementById('home_region1')
	if(document.all){
		elem.style.filter = 'alpha(opacity='+opacity+')';	
	}else{
		elem.style.opacity=opacity	
	}

	var theVal
	if(ie){
		theVal = 100
	}else{
		theVal=1
	}
		
	if(parseFloat(opacity)<theVal){
		if(document.all){
			opacity=opacity+10
			elem.style.filter = 'alpha(opacity=' + opacity + ')';
		}else{
			opacity=opacity+0.1
			elem.style.opacity = opacity;
		}
		setTimeout("showElem()",50);
	}else{
		blnElemHidden =false;	
	}
}

//Speed Order Update script
function processSpeedOrder(frm){

	if(document.getElementById('quickOrderError')!=null){
		document.getElementById('quickOrderError').innerHTML = ''	
	}
	var productCode = ''
	var quantity = 0
	//Issue with IE not getting form items that have been dynamically set
	if(frm.strCode==null){
		var els = document.getElementById('speedorder').getElementsByTagName('INPUT')
		for(i=0;i<els.length;i++){
			var el = els[i]
			if(el.name=='strCode'){
				productCode = el.value
			}
			if(el.name=='numQuant'){
				quantity = el.value	
			}
		}
		
	}else{
		productCode = frm.strCode.value
		quantity = frm.numQuant.value	
	}
		
	if(productCode==''||quantity==''){
		displaySpeedOrderMessage('You did not enter a product code or quantity')	
		return false;
	}
	if(isNaN(quantity)){
		displaySpeedOrderMessage('Please enter numerical values only');
		frm.numQuant.value = 1;
		frm.numQuant.focus();
		return false;
	}
	if(parseInt(quantity)<1){
		displaySpeedOrderMessage('Please enter a number greater than zero');
		frm.numQuant.value = 1;
		frm.numQuant.focus();
		return false;
	}
	var speedProcess = document.getElementById('SpeedProcess')
	var spinner = document.getElementById('spinner')

	//Set the spinner going to show work being done
	speedProcess.style.display='none';
	spinner.style.display='block';
	addToBasket(quantity,productCode);
	
	return false;
}
var globalIntQty = 0
function addToBasket(intQty,strCode){
	globalIntQty = intQty
	try{
		var request = new ajaxObject('/ajaxMethods/speedOrder.asp',processAddToBasket);
		request.update("code="+strCode+"&qty="+intQty,'POST');
	}catch(err){
		displaySpeedOrderMessage('There was an error: ' + err.message)	
	}
	var i =0
	var t = getErrorDisplay();
}
function removeFromBasket(versionId, optionsList){
	try{
		var request = new ajaxObject('/ajaxMethods/removeFromBasket.asp',processAddToBasket);
		request.update("vId="+versionId+"&strOptions="+optionsList,'POST');
	}catch(err){
		displaySpeedOrderMessage('There was an error: ' + err.message)	
	}	
}
function processAddToBasket(responseText, responseStatus){
	try{
		if(responseStatus!=200){
			displaySpeedOrderMessage(responseText);
			return false;
		}
		var rs = eval(responseText);
		if(rs==null){
			//There was an error serverside
			displaySpeedOrderMessage('There was an error, please try again')
			return false;
		}
		if(rs.RecordCount==0&&rs.MethodName=='addToBasket'){
			//There was an error
			if(rs.SearchTerm=='')
			{
				displaySpeedOrderMessage('There were no products with the code you specified')
			}
			else if (rs.SearchTerm=='INSUFFICIENT STOCK')
			{
				displaySpeedOrderMessage('This clearance item is going fast and we don\'t have enough in stock to fill your current request.')
			}
			else
			{
				displaySpeedOrderMessage(rs.SearchTerm+' has more options, <a href="search.asp?strKeywords='+rs.SearchTerm+'">click here<\/a> to search')
			}
			return false;
		}
		
		//Add prodsto table
		addProductToDOM(rs)
		//Update the basket Values
		basketUpdate()
	}catch(err){
		displaySpeedOrderMessage("Line Number:"+ 235 +"\n"+err.message)			
	}
}



function addProductToDOM(rs){
	//Manipulate the QuickOrder Table
	var quickOrderTable
	try{
		quickOrderTable = document.getElementById('frmSpeedOrder').getElementsByTagName('TABLE')[0]
		if(quickOrderTable==null){
			quickOrderTable =createSpeedOrderTable();	
		}
		//Clone the node for appending later
		var inputRow = quickOrderTable.rows[quickOrderTable.rows.length-1].cloneNode(true);
		//Remove existing product rows
		for(i=quickOrderTable.rows.length-1;i>0;i--){
			quickOrderTable.deleteRow(quickOrderTable.rows.length-1);
		}
	}catch(err){
		displayErrorMessage('Line: 256\n'+err.message)	
	}
	try{
		for(i=0;i<rs.RecordCount;i++){
			var displayRow = quickOrderTable.insertRow(quickOrderTable.rows.length);
		
			var cDescription = displayRow.insertCell(0);
			var cQty = displayRow.insertCell(1);
			var cDelete = displayRow.insertCell(2);
			
			cDescription.innerHTML = rs.Records[i].productName;
			cQty.innerHTML = rs.Records[i].itemCount;
			cDelete.innerHTML = "<img src='images/delete.gif' style='cursor:pointer' onclick=\"removeFromBasket('" + rs.Records[i].versionId +"','"+ rs.Records[i].optionsList +"');this.src='images/spinner.gif';\" />";
		}
	}catch(err){
		displaySpeedOrderMessage('Cannot delete tables')
	}
	try{
		var newInputRow = quickOrderTable.insertRow(quickOrderTable.rows.length);
		createInsertRow(newInputRow)
	}catch(err){
		displaySpeedOrderMessage('Line 295' + err.message)	
	}
}

function createInsertRow(r){
	var c0,c1,c2
	try{
		c0 = r.insertCell(0);
		c1 = r.insertCell(1);
		c2 = r.insertCell(2);
		if(c0!=null){
			c0.className='productcode';
		}
		if(c1!=null){
			c1.className='quantity';
		}
		//c1.class='quantity';
	}catch(err){
		displaySpeedOrderMessage('Error initializing the cells: ' +err.message);
	}
	
	
	
	try{
	
		var txtQty = document.createElement('input');
		var txtCode = document.createElement('input');
		var btnSubmit = document.createElement('input');
		var imgSpinner = document.createElement('img');
		if(txtQty!=null){
			txtQty.setAttribute('type','text');
			txtQty.setAttribute('name','numQuant');
		}
		if(txtCode!=null){
			
			txtCode.setAttribute('type','text');
			txtCode.setAttribute('name','strCode');
		}
		if(btnSubmit!=null){
			btnSubmit.setAttribute('type','image');
			btnSubmit.setAttribute('id','SpeedProcess');
			btnSubmit.setAttribute('style','display:block');
			btnSubmit.setAttribute('src','/skin_default/templateimages/content/add_button.gif');
			btnSubmit.setAttribute('value','');
		}
		if(imgSpinner!=null){
			imgSpinner.setAttribute('id','spinner');
			imgSpinner.setAttribute('style','display:none');
			imgSpinner.setAttribute('src','images/spinner.gif');
			imgSpinner.setAttribute('name','spinner');
		}
	}catch(err){
		displaySpeedOrderMessage('Error setting values: ' +err.message)	;
	}

	try{		
		c0.appendChild(txtCode);
		c1.appendChild(txtQty);
		c2.appendChild(btnSubmit);
		c2.appendChild(imgSpinner);
	}catch(err){
		displaySpeedOrderMessage('Error adding objects: ' +err.message)	;
	}
	
}

//Creates the table for displaying the items the customer has just added via speed Order
function createSpeedOrderTable(){
	var table = document.createElement('table');
	try{		
		table.id = 'speedOrderDisplay'
		table.setAttribute('cellspacing','0')
		table.setAttribute('cellpadding','0')
		table.setAttribute('border','0')
	
		var formParent = document.getElementById('frmSpeedOrder').parentNode
		formParent.insertBefore(table,document.getElementById('frmSpeedOrder'))
	}catch(err){
		displaySpeedOrderMessage('Cannot create table: ' +err.message)	;	
	}
	return table;
}

//Updates the vie of the basket

function basketUpdate(){
	if(location.pathname=='/basket.asp'){
		location.reload(true)
		return false;
	}
	try{
		
		var request = new ajaxObject('/ajaxMethods/updateBasket.asp');
		request.update("",'POST');
		request.callback = function(responseText,responseStatus){
								if(responseStatus!=200){
									displaySpeedOrderMessage('Error refreshing items: Status' + responseStatus)	
									return false;	
								}
								var docFrag = document.createDocumentFragment()
								docFrag.innerHTML = responseText
								var basketText = document.getElementById('basketInfo')
								if(basketText==null){
									//alert('I am empty');
									return false;
								}
								basketText.innerHTML = docFrag.innerHTML
								
							}			
	}catch(err){
		displaySpeedOrderMessage('There was an error: ' + err.message)	
	}
	
	resetQuickOrderButtons()
	
	return false;
}

function resetQuickOrderButtons(){
	var speedProcess = document.getElementById('SpeedProcess')
	var spinner = document.getElementById('spinner')
	try{
		if(speedProcess!=null){
			speedProcess.style.display='block';
			spinner.style.display='none';		
		}
	}catch(err){
		displaySpeedOrderMessage('Error resetting buttons: ' +err.message)	;	
	}
}

function displaySpeedOrderMessage(strMessage){
	try{
		var elem = getErrorDisplay();
		elem.innerHTML = strMessage;
	}catch(err){
		alert('Error\nLine Number: '+err.lineNumber+'\nMessage: '+err.message)	;
	}
	resetQuickOrderButtons()
}
function getErrorDisplay(){
	var elem = document.getElementById('quickOrderError')
	if(elem==null){
		elem = document.createElement('div')
		elem.id = 'quickOrderError'
		document.getElementById('frmSpeedOrder').appendChild(elem)
	}
	return elem
}


/*

'######################################################################
'#### PINDAR : KW : My Account Page - Show Delivery Address
'######################################################################

*/

function UpdateShipping(id, TheForm)
	{
		if (document.getElementById)
		{
			obj = document.getElementById(id);
				if (obj.style.display == "none")
					{	
						/*
						Empty out fields
						*/
						TheForm.C_ShippingCompany.value=TheForm.C_CardholderCompany.value;
						TheForm.C_ShippingStreetAddress.value=TheForm.C_CardholderStreetAddress.value;
						TheForm.C_ShippingStreetAddress2.value=TheForm.C_CardholderStreetAddress2.value;
						TheForm.C_ShippingTownCity.value=TheForm.C_CardholderTownCity.value;
						TheForm.C_ShippingCounty.value=TheForm.C_CardholderCounty.value;
						TheForm.C_ShippingPostCode.value=TheForm.C_CardholderPostCode.value;
						TheForm.C_ShippingCountry.value = TheForm.C_CardholderCountry.value;
					
						/* Open up the form */
						obj.style.display = "";
					} 
					else 
					{
						obj.style.display = "none";
					}
		}
	}
	
/*
'######################################################################
'#### PINDAR : KW : ShowProcessing(DIV ID)
'#### PINDAR : KW : Function to hide the submit button and show 
'#### PINDAR : KW : A "spinner" so the user knows something is 
'#### PINDAR : KW : Happening after clicking a button
'######################################################################
*/

function ShowProcessing(ButtonDiv, ProcessDiv, SpinningImage)
{

objToHide = document.getElementById(ButtonDiv);
//objToHide.style.display = "none";
//objToHide.disabled = true;
objToHide.style.filter = 'alpha(opacity=0)';
objToHide.style.opacity = '0.0';
objToHide.style.height = '1px';



//(id=ButtonDiv).addClass("hidden");

		//$("#backgroundPopup").css({"opacity": "0.0"});
		//$("#backgroundPopup").fadeIn("slow");
		//$("#printQuote").fadeIn("slow");
		
objToShow = document.getElementById(ProcessDiv);
objToShow.style.display = "";

//$('#' + ButtonDiv).addClass("hidden");
//$('#' + ProcessDiv).removeClass("hidden");


/* 
'#### PINDAR : KW : Reset the spinner image source to the same grapic
'#### PINDAR : KW : IE stops animating GIFs when forms are submitted (!)
'#### PINDAR : KW : So reloading the source kicks the animation back in */

document.getElementById(SpinningImage).src = "/images/spinner.gif"
}

/*
'######################################################################
'#### PINDAR : KW : CheckShippingAccount(Form Name)
'#### PINDAR : KW : Checks to see if a user has selected the UPS/Fedex
'#### PINDAR : KW : Radio Button but not entered an account number
'#### PINDAR : KW : On Shipping Methods step of checkout
'#### PINDAR : KW : Or selected at least one shipping method
'######################################################################
*/

function CheckShippingAccount(TheForm)
{

var ErrorMsg = "";
var MethodSelected = 0;
var AccountPos = -1;

for( kt = 0; kt < TheForm.numShipMethod.length; kt++ )
	{
		if( TheForm.numShipMethod[kt].checked == true )
		{
			MethodSelected = 1;
		}	
		if( TheForm.numShipMethod[kt].value == "ACCOUNT" )
		{
			AccountPos = kt;
		}
	}
	
	if(TheForm.numShipMethod.value != undefined)
	{
		MethodSelected = 1;
	}
	
	if((AccountPos!=-1) && (TheForm.numShipMethod[AccountPos].checked) && (TheForm.C_FedexUpsAccount.value==''))
	{
		ErrorMsg = "<li>Please Enter Your FedEx or UPS Account Number<\/li>";	
	}

	
	if (MethodSelected == 0)
	{
		ErrorMsg = ErrorMsg + "<li>Please select your preferred shipping method from the options below<\/li>";
	}
		
	if(ErrorMsg!="")
	{
		document.getElementById('ErrorMessage').innerHTML = "<strong>The following problems occured:<\/strong><ol>"+ErrorMsg+"<\/ol>";
		document.getElementById('ErrorMessage').style.display = "";
		return false;	
	}
	else
	{
	 	ShowProcessing('FormSubmitProceed', 'ProcessingMsg', 'ShippingSpinner');
		return true;
	}

}

/*
'######################################################################
'#### PINDAR : KW : Check to see if we need to show the Facility
'#### PINDAR : KW : Form field in the checkout/account page
'######################################################################
*/

function CheckDestination(TheForm, BillingFieldDiv, ShippingFieldDiv)
{

	if(TheForm.C_DestinationType.value!='Facility')
	{
		document.getElementById(BillingFieldDiv).style.display = "none";
		document.getElementById(ShippingFieldDiv).style.display = "none";
	}
	else
	{
		document.getElementById(BillingFieldDiv).style.display = "";
		document.getElementById(ShippingFieldDiv).style.display = "";
	}
}

/*
'####################################################
'# ML : MW : Upcharges
'####################################################
*/
function LTLToggleLiftGateDiv()
{
	if (!$("#C_ReceivingDock").attr("checked"))
	{
		$("#ltlLiftGateDiv").show();
		$("#C_LTLLiftGate").attr('checked', true);
	}
	else
	{
		$("#C_LTLLiftGate").attr('checked', false);
		$("#C_LTLInsideDelivery").attr('checked', false);
		$("#ltlLiftGateDiv").hide();
	}
	LTLToggleInsideDeliveryDiv();
}

function LTLToggleInsideDeliveryDiv()
{
	if ($("#C_LTLLiftGate").attr("checked"))
	{
		$("#ltlInsideDeliveryDiv").show();
	}
	else
	{
		$("#C_LTLInsideDelivery").attr('checked', false);
		$("#ltlInsideDeliveryDiv").hide();
	}
}

/*

		<script language="javascript">
          function EnableDisableDIV() {
              if ($("#chkShowPersonal").attr("checked")) {
                  $("#dvPersonal").show();
              } else {
              $("#dvPersonal").hide();
              }  

			function HelloWorld()
			{
				alert("HelloWorld");
			}
          }          

      </script>
	  */

