/****************************************************************************************************************************/
/*                                              CONTROL - Scrollable mercahnts                                              */
/****************************************************************************************************************************/
var delayb4scroll=0 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1 //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=''

function scrollmarquee(){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
else
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}

function initializemarquee(){
/*cross_marquee=document.getElementById("vmarquee")
cross_marquee.style.top=0
marqueeheight=document.getElementById("marqueecontainer").offsetHeight
actualheight=cross_marquee.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marquee.style.height=marqueeheight+"px"
cross_marquee.style.overflow="scroll"
return
}
setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)*/
}

if (window.addEventListener)
window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
window.onload=initializemarquee






/****************************************************************************************************************************/
/*                                            CONTROL - FAQ Questions and Answers                                          */
/****************************************************************************************************************************/
var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only

if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
		if(el.style.display != "block"){ //DynamicDrive.com change
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") //DynamicDrive.com change
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
if (cookievalue!="")
document.getElementById(cookievalue).style.display="block"
}
}

function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate




/****************************************************************************************************************************/
/*                                                  CONTROL - Clock real time                                               */
/****************************************************************************************************************************/
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")

function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
//change font size here
var cdate="<small><font color='000000' face='Arial'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" "+hours+":"+minutes+":"+seconds+" "+dn
+"</b></font></small>"
if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock").innerHTML=cdate
else
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate()
function goforit(){
if (document.all||document.getElementById)
setInterval("getthedate()",1000)
}



function reset()
{
	document.contactform.strfirstname.value='';
	document.contactform.stremail.value='';
	document.contactform.strsubject.value='';
	document.contactform.strpostcode.value='';
	document.contactform.strcomment.value='';

}



/****************************************************************************************************************************/
/*                                           CONTROL - Marquee for Latest/Special offers                                    */
/****************************************************************************************************************************/
var marqueewidth="170px";
var marqueeheight="20px";
var marqueespeedH=2;
var marqueebgcolor="#FFFFFF";
var iedom=document.all||document.getElementById;
var actualwidth='';
var cross_marqueeH, ns_marquee;
//Pause marquee onMousever (0=no. 1=yes)?
var pauseitH=1;

function populate(){
if (iedom){
cross_marqueeH=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee;
if(cross_marqueeH!=null){
cross_marqueeH.style.left=parseInt(marqueewidth)+8+"px";
cross_marqueeH.innerHTML=marqueecontent;
actualwidth=document.all? temp.offsetWidth : document.getElementById("temp").offsetWidth;
}
}
else if (document.layers){
ns_marquee=document.ns_marquee.document.ns_marquee2;
ns_marquee.left=parseInt(marqueewidth)+8;
ns_marquee.document.write(marqueecontent);
ns_marquee.document.close();
actualwidth=ns_marquee.document.width;
}
if(cross_marqueeH!=null)
	lefttime=setInterval("scrollmarqueeH()",20);
}

function scrollmarqueeH(){
if (iedom){
if (parseInt(cross_marqueeH.style.left)>(actualwidth*(-1)+8))
cross_marqueeH.style.left=parseInt(cross_marqueeH.style.left)-copyspeedH+"px";
else
cross_marqueeH.style.left=parseInt(marqueewidth)+8+"px";
}
else if (document.layers)
{
if (ns_marquee.left>(actualwidth*(-1)+8))
ns_marquee.left-=copyspeedH;
else
ns_marquee.left=parseInt(marqueewidth)+8;
}
}

marqueespeedH=(document.all)? marqueespeedH : Math.max(1, marqueespeedH-1); //slow speed down by 1 for NS
var copyspeedH=marqueespeedH;
var pausespeedH=(pauseitH==0)? copyspeedH: 0;


/****************************************************************************************************************************/
/*                                         CONTROL - Confirm Member Details slider layers                                   */
/****************************************************************************************************************************/
var featuredcontentglider={
	csszindex: 100,
	ajaxloadingmsg: '<b>Fetching Content. Please wait...</b>',
	glide:function(config, showpage, isprev){
		var selected=parseInt(showpage)
		if (selected>=config.$contentdivs.length){ //if no content exists at this index position
			alert("No content exists at page "+(selected+1)+"! Loading 1st page instead.")
			selected=0
		}
		var $target=config.$contentdivs.eq(selected)
		//Test for toggler not being initialized yet, or user clicks on the currently selected page):
		if (config.$togglerdiv.attr('lastselected')==null || parseInt(config.$togglerdiv.attr('lastselected'))!=selected){
			var $selectedlink=config.$toc.eq(selected)
			config.$next.attr('loadpage', (selected<config.$contentdivs.length-1)? selected+1+'pg' : 0+'pg')
			config.$prev.attr('loadpage', (selected==0)? config.$contentdivs.length-1+'pg' : selected-1+'pg')
			var startpoint=(isprev=="previous")? -config.startpoint : config.startpoint
			$target.css(config.leftortop, startpoint).css("zIndex", this.csszindex++) //hide content so it's just out of view before animating it
			var endpoint=(config.leftortop=="left")? {left:0} : {top:0} //animate it into view
			$target.animate(endpoint, config.speed)
			config.$toc.removeClass('selected')
			$selectedlink.addClass('selected')
			config.$togglerdiv.attr('lastselected', selected+'pg')
		}
	},

	getremotecontent:function(config){
		config.$glider.html(this.ajaxloadingmsg)
		$.ajax({
			url: config.remotecontent,
			error:function(ajaxrequest){
				config.$glider.html('Error fetching content.<br />Server Response: '+ajaxrequest.responseText)
			},
			success:function(content){
				config.$glider.html(content)
				featuredcontentglider.setuptoggler(config)
			}
		})
	},

	aligncontents:function(config){
		config.$contentdivs=$("#"+config.gliderid+" ."+config.contentclass)
		config.$contentdivs.css(config.leftortop, config.startpoint).css({height: config.$glider.height(), visibility: 'visible'}) //position content divs so they're out of view:
	},

	setuptoggler:function(config){
		this.aligncontents(config)
		config.$togglerdiv.hide()
		config.$toc.each(function(index){
				$(this).attr('pagenumber', index+'pg')
				if (index > (config.$contentdivs.length-1))
					$(this).css({display: 'none'}) //hide redundant "toc" links
		})
		var $nextandprev=$("#"+config.togglerid+" .next, #"+config.togglerid+" .prev")
		$nextandprev.click(function(event){ //Assign click behavior to 'next' and 'prev' links
			featuredcontentglider.glide(config, this.getAttribute('loadpage'), this.getAttribute('buttontype'))
			event.preventDefault() //cancel default link action
		})
		config.$toc.click(function(event){ //Assign click behavior to 'toc' links
			featuredcontentglider.glide(config, this.getAttribute('pagenumber'))
			event.preventDefault()
		})
		config.$togglerdiv.fadeIn(1000, function(){
			featuredcontentglider.glide(config, config.selected)
			if (config.autorotate==true){ //auto rotate contents?
				config.stepcount=0 //set steps taken
				config.totalsteps=config.$contentdivs.length*config.autorotateconfig[1] //Total steps limit: num of contents x num of user specified cycles)
				featuredcontentglider.autorotate(config)
			}
		})
		config.$togglerdiv.click(function(){
			featuredcontentglider.cancelautorotate(config.togglerid)
		})
	},

	autorotate:function(config){
		var rotatespeed=config.speed+config.autorotateconfig[0]
		window[config.togglerid+"timer"]=setInterval(function(){
			if (config.totalsteps>0 && config.stepcount>=config.totalsteps){
				clearInterval(window[config.togglerid+"timer"])
			}
			else{
				config.$next.click()
				config.stepcount++
			}
		}, rotatespeed)
	},

	cancelautorotate:function(togglerid){
		if (window[togglerid+"timer"])
			clearInterval(window[togglerid+"timer"])
	},

	getCookie:function(Name){ 
		var re=new RegExp(Name+"=[^;]+", "i") //construct RE to search for target name/value pair
		if (document.cookie.match(re)) //if cookie found
			return document.cookie.match(re)[0].split("=")[1] //return its value
		return null
	},

	setCookie:function(name, value){
		document.cookie = name+"="+value
	},

	init:function(config){
		$(document).ready(function(){
			config.$glider=$("#"+config.gliderid)
			config.$togglerdiv=$("#"+config.togglerid)
			config.$toc=config.$togglerdiv.children('.toc')
			config.$next=config.$togglerdiv.children('.next')
			config.$prev=config.$togglerdiv.children('.prev')
			config.$prev.attr('buttontype', 'previous')
			var selected=(config.persiststate)? featuredcontentglider.getCookie(config.gliderid) : config.selected
			config.selected=(isNaN(parseInt(selected))) ? config.selected : selected //test for cookie value containing null (1st page load) or "undefined" string	
			config.leftortop=(/up/i.test(config.direction))? "top" : "left" //set which CSS property to manipulate based on "direction"
			config.heightorwidth=(/up/i.test(config.direction))? config.$glider.height() : config.$glider.width() //Get glider height or width based on "direction"
			config.startpoint=(/^(left|up)/i.test(config.direction))? -config.heightorwidth : config.heightorwidth //set initial position of contents based on "direction"
			if (typeof config.remotecontent!="undefined" && config.remotecontent.length>0)
				featuredcontentglider.getremotecontent(config)
			else
				featuredcontentglider.setuptoggler(config)
			$(window).bind('unload', function(){ //clean up and persist
				config.$togglerdiv.unbind('click')
				config.$toc.unbind('click')
				config.$next.unbind('click')
				config.$prev.unbind('click')
				if (config.persiststate)
					featuredcontentglider.setCookie(config.gliderid, config.$togglerdiv.attr('lastselected'))
				config=null
				
			})
		})
	}
}






/****************************************************************************************************************************/
/*                                         CONTROL - Translucent for Latest/Special offers                                  */
/****************************************************************************************************************************/

var scroller_width='140px';
var scroller_height='80px';
var bgcolor='#FFFFFF';
var pause=4000;

var curpos=scroller_height*(1);
var degree=10;
var curcanvas="canvas0";
var curindex=0;
var nextindex=1;
var scrollercontent=new Array();
var ie4=document.all;
var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1;

function moveslide(){
if (curpos>0){
curpos=Math.max(curpos-degree,0);
tempobj.style.top=curpos+"px";
}
else{
clearInterval(dropslide);
if (crossobj.filters){
//crossobj.filters.alpha.opacity=100;
crossobj.style.filter = 'alpha(opacity=100)';
}
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=1;
nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1";
tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas);
tempobj.innerHTML=scrollercontent[curindex];
nextindex=(nextindex<scrollercontent.length-1)? nextindex+1 : 0;
setTimeout("rotateslide()",pause);
}
}

function rotateslide(){
if (ie4||dom){
resetit(curcanvas);
crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas);
crossobj.style.zIndex++;
if (crossobj.filters)
{
//document.all.canvas0.filters.alpha.opacity=20;
//document.all.canvas1.filters.alpha.opacity=20;
document.all.canvas0.style.filter = 'alpha(opacity=20)';
document.all.canvas1.style.filter = 'alpha(opacity=20)';
}
else if (crossobj.style.MozOpacity)
document.getElementById("canvas0").style.MozOpacity=document.getElementById("canvas1").style.MozOpacity=0.2;
var temp='setInterval("moveslide()",50)';
dropslide=eval(temp);
curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0";
}
else if (document.layers){
crossobj.document.write(scrollercontent[curindex]);
crossobj.document.close();
}
curindex=(curindex<scrollercontent.length-1)? curindex+1 : 0;
}

function resetit(what){
curpos=parseInt(scroller_height)*(1);
var crossobj=ie4? eval("document.all."+what) : document.getElementById(what);
crossobj.style.top=curpos+"px";
}

function startit(){
crossobj=ie4? eval("document.all."+curcanvas) : dom? document.getElementById(curcanvas) : document.tickernsmain.document.tickernssub;
if (crossobj!=null)
{
if (ie4||dom){
crossobj.innerHTML=scrollercontent[curindex];
rotateslide();
}
else{
document.tickernsmain.visibility='show';
curindex++;
setInterval("rotateslide()",pause);
}
}
}


/************************ Message Errors *************************************/
function showErrorMessage(msg)
{	
	var xposition = (screen.width / 2) - 150;
	var layer = document.getElementById("errormessage");
	msg = "<table width='100%' cellpadding='5' cellspacing='0'><tr><td align='right'><a href='#' onclick='closeErrorMessage()'>x</a>&nbsp;&nbsp;</td></tr></table><p>" + msg + "</p>";
	layer.innerHTML = msg;
	layer.style.visibility = 'visible';
	layer.style.MozOpacity = 0.90;
	layer.style.left = xposition + "px";
}

function closeErrorMessage()
{
	var layer = document.getElementById("errormessage");
	layer.style.visibility = 'hidden';
}
/*****************************************************************************/



/* Security Programs */
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
/*****************************************************************************/



function ChangeHeigh(layer)
{
	if (layer == 1)
	{
		lyr1 = document.getElementById("glidecontent1");
		lyr2 = document.getElementById("glidecontent2");
		lyr1.style.visibility = 'visible';
		lyr2.style.visibility = 'hidden';
	}
	else
	{
		lyr1 = document.getElementById("glidecontent1");
		lyr2 = document.getElementById("glidecontent2");
		lyr2.style.visibility = 'visible';
		lyr1.style.visibility = 'hidden';
	}
}


function EnableContinue()
{
	
	button = document.getElementById("action");
	checkbox = document.getElementById("checkterm");
	
	if(checkbox.checked)
		document.contactform.action.disabled=false;
	else
		document.contactform.action.disabled=true;

}

function SubmitOnMouseOver()
{
	
	document.contactform.action.style.cursor="hand";	
}

function printSelection(node){

  var content=node.innerHTML
  var pwin=window.open('','print_content','width=300px,height=300px');

  pwin.document.open();
  pwin.document.write('<html><body onload="window.print()">'+content+'</body></html>');
  pwin.document.close();
 
  setTimeout(function(){pwin.close();},1000);

}

function BatchProcess(node)
{
	
	layer1 = document.getElementById("hidde1");
	layer2 = document.getElementById("hidde2");
	layer3 = document.getElementById("hidde3");
	layer4 = document.getElementById("hidde4");
	if(node)
	{
		layer1.style.visibility = 'visible';
		layer2.style.visibility = 'visible';
		layer3.style.visibility = 'visible';
		layer4.style.visibility = 'visible';
	}
	else
	{
		layer1.style.visibility = 'hidden';
		layer2.style.visibility = 'hidden';
		layer3.style.visibility = 'hidden';
		layer4.style.visibility = 'hidden';
	}

}



// Help Layer Visible/Hidden
var cX = 0; var cY = 0; var rX = 0; var rY = 0;
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }
function AssignPosition(d,stx,sty) {
if(self.pageYOffset) {
	rX = self.pageXOffset;
	rY = self.pageYOffset;
	}
else if(document.documentElement && document.documentElement.scrollTop) {
	rX = document.documentElement.scrollLeft;
	rY = document.documentElement.scrollTop;
	}
else if(document.body) {
	rX = document.body.scrollLeft;
	rY = document.body.scrollTop;
	}
if(document.all) {
	cX += rX; 
	cY += rY;
	}
d.style.left = (cX-stx) + "px";
d.style.top = (cY+sty) + "px";
}
function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d,stx,sty) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd,stx,sty);
dd.style.display = "block";
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
if(dd.style.display == "none") { dd.style.display = "block"; }
else { dd.style.display = "none"; }
}
function SubmitViewReport()
{
	checkbox = document.getElementById("checkterm");
	
	warninglyr = document.getElementById("warning");

	if(checkbox.checked)
		location.href = "shopcustrequest.asp";
	else
		warninglyr.style.visibility = 'visible';
	
}