//  Declaration of Global Variables

//  Holds the current rgn value after zoom in or out.
var rgn_zoom="";
//  Declares zoom, which represents the magnification of the image.
var zoom_out = 0;
var zoom_in  = 0;
//  Declares x, which represents the x position of the image
var x = 0;
//  Declares y, which represents the y position of the image
var y = 0;
//  height of the image, always true
var hei=1;
//  Image aspect ratio: aspect = imgWidth/imgHeight
var aspect = 1;
var n=0;
var m=0;
var imgWidth=0;
var imgHeight=0;
//  Determine if browser is Netscape 4
var nn4 = (document.layers)?true:false;
//  Determine if browser is Netscape 6
var nn6=document.getElementById&&!document.all;

sNum = 0;
bNum = 0;


// Set browser type
var isNetscape = false;
var isIE = false;
if (navigator.appName.toLowerCase().indexOf("microsoft") == -1){
	isNetscape = true;
}else{
	isIE = true;
}
	
function updateBilling(param) {
	document.location = param + "\x26bID=" + bNum + "\x26sID=" + sNum
}


function refreshwin(sDemoInfoNumber, sUpdateAffinity) {
	var undefined
	if (sDemoInfoNumber == ""){sDemoInfoNumber = null}
	if (sUpdateAffinity == ""){sUpdateAffinity = null}
	
	if (sDemoInfoNumber != null && top.demoCommentsFooter != undefined)
	{
		var demoURL = "demoinfo/demoComments.asp?FileID="+sDemoInfoNumber

		/* Check to see if the application is in a subdirectory starting with sw
		  if so grab the subdirectory value from the pathname */
		
		if (location.pathname.indexOf('sw') >= 1)
		{
			demoURL = location.pathname.substring(0,location.pathname.indexOf('/',1)+1) + demoURL
		}
		else
		{
			// else assume the application is in the root of the web server
			demoURL = "/" + demoURL
		}
	
		top.demoCommentsFooter.location.replace(demoURL);
	}
	
	if (sUpdateAffinity != null && top.affinityFooter != undefined)
	{
		//alert(top.affinityFooter.document.readyState)
		if(isIE && top.affinityFooter.document.readyState == 'loading')
		{
			var id = setTimeout('top.affinityFooter.location.reload(true)', 2000);
		}
		else
		{
			top.affinityFooter.location.reload(true);
		}
	}
}


function OpenCalculator(filename)
{
	NewWindow = window.open(filename,"","border=0,resizable=1,location=0,directories=0,status=1,menubar=0,scrollbars=1,toolbar=0,width=600,height=500" );
}

function show(id)
{
	var ns4 = (document.layers)? true : false
	var ie4 = (document.all)? true : false
	//if (ns4) document.layers[id].visibility = "show"
	if (ie4) document.all[id].style.visibility = "visible"
	


}


function hide(id)
{

	var ns4 = (document.layers)?true:false
	var ie4 = (document.all)?true:false
	//if(ns4) document.layers[id].visibility = "hide"
	//if(ns4) document.forms[0].DELIVERY_PREFERENCE.disabled = true
	if (ie4) document.all[id].style.visibility = "hidden"


}

function ValidateEMail(strEMail)
{
	var nLen;
	
	if((nLen = strEMail.length) == 0)
	{
		return false;
	}
	
	//check that @ and dot exists
	//check that dot is after @
	//check for a character before @
	//check for a character in between @ and dot
	//check for 3 chars after dot
	var nAtIndex = strEMail.indexOf("@", 0);
	var nDotIndex= strEMail.indexOf(".", nAtIndex+2);
	if(nAtIndex <= 0 || nDotIndex == -1) 
		//removed or statement on 4/19/01 (bmaphis, etensity) due to validation failures of multiple doted email addresses
		//|| strEMail.substr(nDotIndex, nLen - nDotIndex - 1).length != 2)
	{
		return false;
	}
	
	return true;
}

function ValidateThisForm(myForm)
{
	var strEMail = myForm.elements["EMAIL_ENTRY"].value;
	
	
	if(!ValidateEMail(strEMail))
	{
		alert("The following is not a Valid EMail Address:\r\n\r\n"+strEMail+"\r\n");
		return false;
	}

	return true;
}

function Pcertify() 
{ 
popupWin = window.open('http://www.bbbonline.org/cks.asp?id=201031314362213911','Participant','location=no,scrollbars=yes,width=450,height=300'); 
window.name = 'opener'; 
}

function RGC_Pcertify() 
{ 
popupWin = window.open('http://www.bbbonline.org/cks.asp?id=201031314362213911&rgc=true','Participant','location=no,scrollbars=yes,width=450,height=300'); 
window.name = 'opener'; 
}

function OpenNewWindow(WindowPicture,WindowParameters)
{
	NewWindow=window.open("","NewOne", WindowParameters);
	NewWindow.document.write ("<HTML><HEAD><TITLE>");
	NewWindow.document.write ("Enlarged Picture");
	NewWindow.document.write ("</TITLE></HEAD>");
	NewWindow.document.write ("<body bgcolor=#000066 link=#FFFFFF vlink=#CCCCCC alink=#0000FF text=#FFFFFF>");
	NewWindow.document.write ("<P ALIGN=CENTER>");
	NewWindow.document.write ("<B><FONT face='Verdana, Arial, Helvetica, sans-serif' size='2' COLOR='#FFFFFF'>");
	NewWindow.document.write ("Click the picture to close this window");
	NewWindow.document.write ("</FONT></P>");
	NewWindow.document.write ("<P ALIGN=CENTER>");
	NewWindow.document.write ("<A HREF='JavaScript:this.close()'><IMG SRC=");
	NewWindow.document.write (WindowPicture);
	NewWindow.document.write ("></A>");
	NewWindow.document.write ("</P>");
	NewWindow.document.write ("</BODY></HTML>");
	NewWindow.document.close();
	return false;
}

function MM_jumpMenu(targ,selObj,restore)
{ 
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

//Define a constructor method called Ts_zoom for our class.
//Use it to initialize properties that will be different for each individual util object
function Ts_zoom(rgn, image_ID, layer_ID, zoom,initialURL) {
	//Initialize object properties
        this.orgn = rgn;
	this.ozoom = zoom;
	this.initialURL=initialURL;

	rgn_zoom = rgn;
	this.image_ID_zoom = image_ID;
	this.layer_ID_zoom = layer_ID;
	this.szoom = zoom;
		

	//Define methods for the objects
	this.scroll_d = Scroll_d;
	this.mapZoomout = MapZoomout;
	this.mapZoomin = MapZoomin;
	this.pan = Pan;
	this.zoomOut = ZoomOut;
	this.mouseZoom = MouseZoom;
	this.reset_zoom = Reset_zoom;
	this.fullReset = fullReset;

        if( rgn.length > 7 ) {
          c1 = rgn.indexOf( "," );
          x = parseFloat( rgn.substr( 0, c1 ) );
          c2 = rgn.indexOf(",",(c1+1) );
          y = parseFloat( rgn.substr( (c1+1), (c2-c1-1) ) );
          c1 = rgn.lastIndexOf(",");
          hei = parseFloat( rgn.substr(c1+1) );
          n = parseInt( Math.log(1/hei)/Math.log(zoom) );
        }
}


function fullReset () {
  this.reset_zoom();

  if( ""+this.initialURL != "undefined" ) {
    if (document.layers && this.layer_ID_zoom != "no"){  //Netscape browser with layers
      document.layers[this.layer_ID_zoom].src=this.initialURL;
    }else{
      document.images[this.image_ID_zoom].src=this.initialURL;
    }
  }
}


//Shift image to different directions
function Scroll_d(direction){
	//alert("rgn_s="+this.rgn);
	if(direction=="left") x -= hei/5;
	if(direction=="right") x += hei/5;
	if(direction=="down") y -= hei/5;
	if(direction=="up") y += hei/5;
	if (document.layers){//Netscape browser
		if (this.layer_ID_zoom == "no"){
			imgWidth=document.images[this.image_ID_zoom].width;
			imgHeight=document.images[this.image_ID_zoom].height;
		}else{
			imgWidth=document.layers[this.layer_ID_zoom].document.images[this.image_ID_zoom].width;
			imgHeight=document.layers[this.layer_ID_zoom].document.images[this.image_ID_zoom].height;
		}
	}else{	
		imgWidth=document.images[this.image_ID_zoom].width;
		imgHeight=document.images[this.image_ID_zoom].height;
	}
	aspect = imgWidth/imgHeight;
	//shrink the zoom point when necessary.
	if (x<0||x==0) x=0+0.001/hei;
	if (x+hei*aspect>aspect) x=aspect-hei*aspect-0.001/hei;//correct some round off error as well
	if (y<0) y=0;
	if (y+hei>1) y=1-hei;
	//real stuff here
	rgn_zoom = x + "," + y + "," + (hei*aspect) + "," + hei;
	
	//Replace rgn and display image
	cmp_zoom(rgn_zoom, this.image_ID_zoom, this.layer_ID_zoom);
}//Scroll(direction)

//Click the "-" image map to zoom out
function MapZoomout(){
	if (n > 0 ) {
		this.zoomOut();
		//shrink the zoom point when necessary.
		if (x<0) x=0;
		if (x+hei>1) x=0.999-hei;
		if (y<0) y=0;
		if (y+hei>1) y=1-hei;
        //real stuff here
		rgn_zoom = x + "," + y + "," + (hei*aspect) + "," + hei;
	//Replace rgn and display image
	cmp_zoom(rgn_zoom, this.image_ID_zoom, this.layer_ID_zoom);	
	}
}

//Click the "+" image map to zoom in
function MapZoomin(){
if(n<6){
//	alert("MapZoomout");
	if (document.layers){//Netscape browser 4.x browser
		if (this.layer_ID_zoom == "no"){
			imgWidth=document.images[this.image_ID_zoom].width;
			imgHeight=document.images[this.image_ID_zoom].height;
		}else{
			imgWidth=document.layers[this.layer_ID_zoom].document.images[this.image_ID_zoom].width;
			imgHeight=document.layers[this.layer_ID_zoom].document.images[this.image_ID_zoom].height
		}
	}else if (!nn6) {//IE browser
		imgWidth=document.images[this.image_ID_zoom].width;
		imgHeight=document.images[this.image_ID_zoom].height;
	}else if (nn6) {//NN6 browser
		imgWidth=document.images[this.image_ID_zoom].width;
		imgHeight=document.images[this.image_ID_zoom].height;
	}

	aspect = imgWidth/imgHeight;
	xx=0.5*imgWidth;
	yy=0.5*imgHeight;
	//alert("n0=" +n);
	n=n+1;
	//alert("n1=" +n);	
	//zoom=1.6;
	zoom_in = this.szoom
	zoomfactor=Math.pow(zoom_in,1-n);
	hei = hei/zoom_in ;
	x =x+xx*zoomfactor*aspect/(imgWidth)-hei*aspect/2;
	y =y+yy*zoomfactor/(imgHeight)-hei/2;
	//shrink the zoom point when necessary.
	if (x<0) x=0;
	if (x+hei*aspect>aspect) x=aspect-hei*aspect;
	if (y<0) y=0;
	if (y+hei>1) y=1-hei;
	//real stuff here
	rgn_zoom = x + "," + y + "," + (hei*aspect) + "," + hei;
	//Replace rgn and display image
	cmp_zoom(rgn_zoom, this.image_ID_zoom, this.layer_ID_zoom);
	}
}//MapZoomin()

function ZoomOut(){
	if(hei<1){
		m=m+1;
		n=n-1;
		//zoom=0.625;
		zoom_out = 1/this.szoom;
		zoomfactor=Math.pow(zoom_out,1-m);	
		//Get zoom point
		x =x-(hei/zoom_out-hei)/2;
		y =y-(hei/zoom_out-hei)/2;
		hei = hei/zoom_out ;
	}
}  //ZoomOut()

//gets called when pan with ShiftKey and mouse
function Pan(evt){
	if (document.layers){
		if (this.layer_ID_zoom == "no"){
			x1 = document.images[this.image_ID_zoom].x;
			y1 = document.images[this.image_ID_zoom].y;
			xx=eval(evt.x) - x1 -12;
			yy=eval(evt.y) - y1;
		}else{
			xx=eval(evt.x);
			yy=eval(evt.y);
		}
	}else if (!nn6) {
		if (this.layer_ID_zoom == "no"){
			l = getImgLeft(this.image_ID_zoom);
			t = getImgTop(this.image_ID_zoom);
			xx=eval(event.clientX)-eval(l);
			yy=eval(event.clientY)-eval(t);



		}else{
			l=document.all[this.layer_ID_zoom].style.left.split("p")[0];// get the left of the image
			t=document.all[this.layer_ID_zoom].style.top.split("p")[0];// get the top of the image
			xx=eval(event.clientX)-eval(l);
			yy=eval(event.clientY)-eval(t);


		}
	}

	else if(nn6){
		if (this.layer_ID_zoom == "no"){
			l = document.images[this.image_ID_zoom].offsetLeft;
			t = document.images[this.image_ID_zoom].offsetTop;
			xx=eval(evt.clientX)-eval(l);
			yy=eval(evt.clientY)-eval(t);



		}else{
			l=document.getElementById(this.layer_ID_zoom).style.left.split("p")[0];// get the left of the image
			t=document.getElementById(this.layer_ID_zoom).style.top.split("p")[0];// get the top of the image
			xx=eval(evt.clientX)-eval(l);
			yy=eval(evt.clientY)-eval(t);



		}
	}
		x =x+(xx*hei/(imgWidth)-hei/2);
		y =y+(yy*hei/(imgHeight)-hei/2);
} //Pan(evt)

//This function is used when clicking on the image to zoom in and out
function MouseZoom(evt) {

	if(evt.button==1||evt.which==1){//left mouse
		//get the click point inside the image.
		if (document.layers){//Netscape 4.x browser
			if (this.layer_ID_zoom == "no"){
				imgWidth=document.images[this.image_ID_zoom].width;
				imgHeight=document.images[this.image_ID_zoom].height;
			}else{
				imgWidth=document.layers[this.layer_ID_zoom].document.images[this.image_ID_zoom].width;
				imgHeight=document.layers[this.layer_ID_zoom].document.images[this.image_ID_zoom].height
			}
			aspect = imgWidth/imgHeight;
			if(evt.modifiers & Event.ALT_MASK){//zoom out
				//event.returnValue=false;
				this.zoomOut();
			}
			else if(evt.modifiers & Event.SHIFT_MASK){
				this.pan(evt);	
			}
			else{
				if(n<6){
				n=n+1;	
				if (this.layer_ID_zoom == "no"){
					x1 = document.images[this.image_ID_zoom].x;
					y1 = document.images[this.image_ID_zoom].y;
					xx=eval(evt.x) - x1 -12;
					yy=eval(evt.y) - y1;
				}else{
					xx=eval(evt.x)-12;
					yy=eval(evt.y);
				}
				zoom_in = this.szoom;
				zoomfactor=Math.pow(zoom_in,1-n);
				hei = hei/zoom_in ;
				//wid = aspect*hei;
				x =x+xx*zoomfactor/(imgWidth)-hei/2;
				y =y+yy*zoomfactor/(imgHeight)-hei/2;	
				}
			}	
		}
		else if(!nn6) {//IE browser
			imgWidth=document.images[this.image_ID_zoom].width;
			imgHeight=document.images[this.image_ID_zoom].height;
			aspect = imgWidth/imgHeight;
			if(!event.altKey&&!event.shiftKey){//zoom in
				if(n<6){
				n=n+1;
				if (this.layer_ID_zoom == "no"){
					l = getImgLeft(this.image_ID_zoom);
					t = getImgTop(this.image_ID_zoom);				
				}else{
					l=document.all[this.layer_ID_zoom].style.left.split("p")[0];// get the left of the image
					t=document.all[this.layer_ID_zoom].style.top.split("p")[0];// get the top of the image
				}
//				xx=eval(event.clientX)-eval(l)-12;
//				yy=eval(event.clientY)-eval(t);
xx=eval(event.offsetX)
yy=eval(event.offsetY)

				zoom_in = this.szoom;
				zoomfactor=Math.pow(zoom_in,1-n);
				hei = hei/zoom_in ;
				x =x+xx*zoomfactor/(imgWidth)-hei/2;
				y =y+yy*zoomfactor/(imgHeight)-hei/2;
				}
			}
			else if(event.altKey){//zoom out
				this.zoomOut();
			}
			else if(event.shiftKey){
				this.pan(evt);	
			}
			event.cancelBubble=true;
		}
		else if(nn6) {//NN6 browser
			imgWidth=document.images[this.image_ID_zoom].width;
			imgHeight=document.images[this.image_ID_zoom].height;
			aspect = imgWidth/imgHeight;
			if(!evt.altKey&&!evt.shiftKey){//zoom in
				if(n<6){
				n=n+1;
				if (this.layer_ID_zoom == "no"){
					l = document.images[this.image_ID_zoom].offsetLeft;
					t = document.images[this.image_ID_zoom].offsetTop;
				}else{	
					l=document.getElementById(this.layer_ID_zoom).style.left.split("p")[0];// get the left of the image
					t=document.getElementById(this.layer_ID_zoom).style.top.split("p")[0];// get the top of the image
				}
	
				xx=eval(evt.clientX)-eval(l)-12;
				yy=eval(evt.clientY)-eval(t);



				//zoom=1.6;
				zoom_in = this.szoom;
				zoomfactor=Math.pow(zoom_in,1-n);
				hei = hei/zoom_in ;
				x =x+xx*zoomfactor/(imgWidth)-hei/2;
				y =y+yy*zoomfactor/(imgHeight)-hei/2;
				}
			}
			else if(evt.altKey){//zoom out
				this.zoomOut();
			}
			else if(evt.shiftKey){
				this.pan(evt);	
			}
		}
		//shrink the zoom point when necessary.
		if (x<0) x=0;
		if (x+hei*aspect>aspect) x=aspect-hei*aspect;
		if (y<0) y=0;
		if (y+hei>1) y=1-hei;
		//real stuff here
		rgn_zoom = x + "," + y + "," + (hei*aspect) + "," + hei;
		
		//Replace rgn and display image
		cmp_zoom(rgn_zoom, this.image_ID_zoom, this.layer_ID_zoom);
	
	}
}//MouseZoom(evt)

//This function is used to replace rgn in the current url and display images
function cmp_zoom(srgn, image_ID_zoom, layer_ID_zoom){
	//Declaration of Local Variables
	
	//Holds the part of the url before the rgn command
	var pre_rgn_string = "";
	//Holds the part of the url after the rgn command
	var post_rgn_string = "";
	//The position before the rgn command in the url
	var s1 = 0;
	//The position after the rgn command in the url
	var s2 = 0;
	//holds the url of the main image in the html file
	var str = "";
	var rRgn = "rgn=" + srgn;
	var rImage = image_ID_zoom;
	var rLayer = layer_ID_zoom;
	//Get the url of the main image in the html file
	if (document.all || document.getElementById) { //If IE 4+ or NN6
		str = document.images[rImage].src;
	}
	else if (document.layers) {//If NN4.x
		if (rLayer == "no"){
			str = document.images[rImage].src;
		}else{
			str = document.layers[rLayer].document.images[rImage].src;
		}
	}
	
	//Search the old rgn command and replace it with the new rgn command
	s1 = str.lastIndexOf("rgn=");
	if (s1 == -1) {   //Determine if there is the rgn command in the url or not
		s1 = str.lastIndexOf("&wid=")
		pre_rgn_string = str.substr(0, s1);
		post_rgn_string = str.substr(s1);
		str = pre_rgn_string + "&" + rRgn + post_rgn_string;
	}else {
		s2 = str.indexOf("&", s1);
		pre_rgn_string = str.substr(0, s1);
		post_rgn_string = str.substr(s2);
		str = pre_rgn_string + rRgn + post_rgn_string;
	}
	
	//Set the url of the main image in the html file after replacing the old rgn command
	if (document.all || document.getElementById) { //If IE 4+ or NN6
		document.images[rImage].src=str;
	}
	else if (document.layers) {//If NN4.x
			if (rLayer == "no"){
				document.images[rImage].src=str;
			}else{
				document.layers[rLayer].document.images[rImage].src=str;
			}
	}
	else {
		alert("Unrecognized Browser Detected");
	}
}
//Reset Zoom Component
function Reset_zoom (){
	//Reset the x position of the image in zoom component
	x = 0;
	//Reset the y position of the image in zoom component
	y = 0;
	n=0;
	m=0;
	hei=1;
	//Reset rgn
	rgn_zoom = this.orgn;
    if( this.orgn.length > 7 ) {
        c1 = this.orgn.indexOf( "," );
        x = parseFloat( this.orgn.substr( 0, c1 ) );
        c2 = this.orgn.indexOf(",",(c1+1) );
        y = parseFloat( this.orgn.substr( (c1+1), (c2-c1-1) ) );
        c1 = this.orgn.lastIndexOf(",");
        hei = parseFloat( this.orgn.substr(c1+1) );
        n = parseInt( Math.log(1/hei)/Math.log(this.ozoom) );
    }
}

// Get the left coordinate of the Image
function getImgLeft(imgElem) {
	xPos = eval(imgElem).offsetLeft;
	tempEl = eval(imgElem).offsetParent;
  	while (tempEl != null) {
  		xPos += tempEl.offsetLeft;
  		tempEl = tempEl.offsetParent;
  	}
	return xPos;
}
// Get the top coordinate of the Image
function getImgTop(imgElem) {
	yPos = eval(imgElem).offsetTop;
	tempEl = eval(imgElem).offsetParent;
	while (tempEl != null) {
  		yPos += tempEl.offsetTop;
  		tempEl = tempEl.offsetParent;
  	}
	return yPos;
}

function openBrWindow(htmlPage,w,h) { //v2.0

	newin=window.open(htmlPage,'','width='+w+',height='+h);
}
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) { //v3.0
  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); 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 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 openexpage(url) {
  newWindow=window.open(url, "Spanish", "height=450,width=470,toolbar=yes,resizable=yes,menubar=no,scrollbars=yes");
}

function LILWindow(url)
{
	var intHeight = screen.height;
	var intWidth = screen.width;

	var winName = "newWin";
	var intXPos = 10;
	var intYpos = 10;

	var bTool = 'no';
	var	bLoc = 'no';
	var bStatus = 'no';
	var bMenu = 'no';
	var bScroll = 'yes';
	var bResize = 'yes';
	var bHist = 'no';

	var NS4Plus = (document.layers) ? 1 : 0;
	var IE4Plus = (document.all) ? 1 : 0;

	if (intWidth <= 800)
	{
		intWidth = 750;
		intHeight = 500;
	}
	else
	{
		if(IE4Plus)
		{
			intWidth = 955;
			intHeight = 668;
		}
		else
		{
			intWidth = 1000;
			intHeight = 668;
		}
	}

	strProp = '';
	strProp	= strProp + "toolbar=" + bTool + ",location=" + bLoc + ",status=" + bStatus + ",menubar=" + bMenu + ","
	strProp	= strProp + "scrollbars=" + bScroll + ",resizable=" + bResize + ",copyhistory=" + bHist + ",";
	strProp	= strProp + "width=" + intWidth + ",height=" + intHeight + ",left=" + intXPos + ",top=" + intYpos + "";

	window.open(url, winName, strProp);
}
function openWindow(url) {try{newWidnow=window.open(url, "", "width=650, height=650, scrollbars=yes, resizable=yes");} catch(e) {}}
function deleteinfo() {
window.open("shopcart_deleteinfo.html","","width=318,height=210,directories=no,location=no,menubar=no,scrollbars=no,status=yes,toolbar=no,resizable=yes,left=50,top=50");
}
function pickupinfo() {
window.open("shopcart_pickupinfo.html","","width=318,height=500,directories=no,location=no,menubar=no,scrollbars=no,status=yes,toolbar=no,resizable=yes,left=50,top=50");
}
function deliverinfo() {
window.open("shopcart_deliverinfo.html","","width=318,height=250,directories=no,location=no,menubar=no,scrollbars=no,status=yes,toolbar=no,resizable=yes,left=50,top=50");
}
function shipinfo() {
window.open("shopcart_shipinfo.html","","width=318,height=200,directories=no,location=no,menubar=no,scrollbars=no,status=yes,toolbar=no,resizable=yes,left=50,top=50");
}
function shippingcost() {window.open("estimateshippingdelivery.html","","width=500,height=320,directories=no,location=no,menubar=no,scrollbars=yes,status=yes,toolbar=no,resizable=yes,left=50,top=50");}

function setPageChange(val) {
	document.productListForm.pageChange.value=val;
	document.productListForm.jumpToPage1.value=val;
	document.productListForm.jumpToPage2.value=val;
}

function shoppinglist() {
 monitorWindow = window.open("",'newWin','width=600, height=500, directories=no,location=no,menubar=no,scrollbars=yes,status=yes,toolbar=no,resizable=yes,left=50,top=50');
  monitorWindow.location="/lowes/lkn?action=printMyCart";
  
}

// newWindow added for the new templates to open diagrams 072705
var win = null;
function newWindow(mypage,myname,w,h,features) {
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
if (winl < 0) winl = 0;
if (wint < 0) wint = 0;
var settings = 'height=' + h + ',';
settings += 'width=' + w + ',';
settings += 'top=' + wint + ',';
settings += 'left=' + winl + ',';
settings += features;
win = window.open(mypage,myname,settings);
win.window.focus();

}

// newWindow added for the sos pages - 090905
function opensospage(url,param) {
newWindow=window.open(url, "" ,param);

}

//newfix for Windows patch and active x issues with flash - 041706

function writeObj(obj) {
	document.write(obj);
}

 
//call the "onclick" event of the "find" button 
//if the user press "enter/return"
// e = event object passed from function invocation, 
// control= input control where event occurs

function checkEnterOnMastheadFindZip(e, control){ 
	var characterCode 
	var inputID = control.id; //gets the id of the input control where event occurs
	try{	
		if(e && e.which){ //if which property of event object is supported (Netscape4)
			e = e
			characterCode = e.which //character code is contained in NN4's which property
		}
		else{
			e = event
			characterCode = e.keyCode //character code is contained in IE's keyCode property
		}
		
		if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
			callOnClick(e,inputID); // call event 
			return false 		}
		else{
			return true 
		}
	}catch(e){
		return true
	}
}

// call the onclick event associated 
// to the "find" button with ID = 'img_' + anInputID
function callOnClick(e, anInputID){
		var call = document.getElementById("img_" + anInputID).onclick;
		call(e);
}


//  Javascript to encode / decode url parameters. 
//  Script is fully compatible with UTF-8 encoding. 
//  autor:lucas.mari@neoris.com
var Url = {

	// public method for url encoding
	encode : function (string) {
		return escape(this._utf8_encode(string));
	},

	// public method for url decoding
	decode : function (string) {
		return this._utf8_decode(unescape(string));
	},

	// private method for UTF-8 encoding
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";

		for (var n = 0; n < string.length; n++) {

			var c = string.charCodeAt(n);

			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}

		}

		return utftext;
	},

	// private method for UTF-8 decoding
	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;

		while ( i < utftext.length ) {

			c = utftext.charCodeAt(i);

			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}

		}

		return string;
	}

}
// Parse an URL string starting from the "action" parameter
// to the end of url.
// autor: lucas.mari@neoris.com
function parseURLForProductAccess(anURL){
	var start = anURL.indexOf("/lowes/");
	var stop  = anURL.length;
	if(start > 0){
		start += 7;
	}else{
		return '/lowes/lkn?action=home';
	}
	return anURL.substring(start,stop);
}
