<!--

// **************************************
// Handle Popup Windows
var wnd; 
var popupDefault='width=450,height=492,status=no,,resizable=yes';
var popupBig='width=650,height=600,status=no,scrollbars,resizable=yes';

//get title
//get url
//generate email this page url
function emailthispage (url) {
	title = document.title;
	surl = location.href;
	url = url+'?title='+title+'&amp;surl='+surl;
	launchWindow(wnd,url,1,popupDefault);
}

function loadWindow ( url, options ) {
	return window.open(url, '_blank', options);
}

function launchWindow( wnd, url, override, options ) {
	if (!wnd) { 
		//Variable not defined yet.
		return loadWindow(url, options);
	} else {
		if (wnd.closed) {
			// Wnd was previous open, but is no longer. Open it.
			return loadWindow(url, options);
		} else {
			if(!override) {
				// Window is already open.  Forget this request, and just give the popup focus.
				wnd.focus();
				return wnd;
			} else {
				// Window is already open.  Give it focus, and change to the new page instead.
				wnd.focus();
				wnd.location.href=url;
				return wnd;
			}
		}
	}
}




var isNav = 0;
if (navigator.appName=="Netscape"&&parseFloat(navigator.appVersion)<5) isNav=1;


function find_x() {
	//finds and returns the x resolution
	var windowWidth
	if (isNav) {
		//alert('window.innerWidth='+window.innerWidth);
		windowWidth=window.innerWidth;
	} else {
		//alert('document.body.clientWidth='+document.body.clientWidth);
		windowWidth=document.body.clientWidth;
	}
	return windowWidth;
}


var offset=0;
var animCurrentFrame=0;
var animFrameCount;
var animFromX;
var animFromY;
var Mytmr;

function obj(name) {
	if (document.all)
		return document.all[name];
	else if (document.getElementsByName && document.getElementsByName(name)[0])
		return document.getElementsByName(name)[0];
	else if (document.getElementById && document.getElementById(name))
		return document.getElementById(name);
}

//Netscape doesn't have an integer-based "left" or "top" property for objects.
//This function takes "150px" and converts it to a numeric 150
function pix(st) {
	return new Number(st.substring(0, st.length-2));
}

function animateThis(o,animToX,animToY,ms) {
	window.clearInterval(Mytmr);
	animCurrentFrame=0;
	animFromX=pix(obj(o).style.left);
	animFromY=pix(obj(o).style.top);

	animDistanceX=(animFromX-animToX)*-1;
	animDistanceY=(animFromY-animToY)*-1;

	animFrameRate=60;
	animFrameInterval=1000/animFrameRate;
	animFrameCount=Math.round(ms/animFrameInterval);

	animOffsetPerFrameX=animDistanceX / animFrameCount;
	animOffsetPerFrameY=animDistanceY / animFrameCount;

	Mytmr=window.setInterval("animateInterval('"+o+"',"+animToX+","+animToY+","+animOffsetPerFrameX+","+animOffsetPerFrameY+");", animFrameInterval/2);

	return false;
}

function animateInterval(o, animToX, animToY, animOffsetPerFrameX, animOffsetPerFrameY){
	animCurrentFrame++;
	//obj('debug').innerHTML=animCurrentFrame+'/'+animFrameCount+ ' - (' + pix(obj(o).style.left) + ','+pix(obj(o).style.top)+') - (' + animOffsetPerFrameX + ','+animOffsetPerFrameY+')';
	CurrentX=Math.round(animFromX+(animOffsetPerFrameX*animCurrentFrame));
	CurrentY=Math.round(animFromY+(animOffsetPerFrameY*animCurrentFrame));
	obj(o).style.left=CurrentX.toString()+'px';
	obj(o).style.top=CurrentY.toString()+'px';
	if(animCurrentFrame==animFrameCount) {
		window.clearInterval(Mytmr);
	}
}

function center_it(o) {
	//moves the element to the center
	var movingID1 = obj(o);

	//set off-set for layers.
	obj(o).style.left=Math.round((find_x()/2)+172);
	offset = pix(obj(o).style.left);
	//alert('left='+obj(o).style.left+'; width='+obj(o).clientWidth);
	return offset;
}

// Find the X coordinate of an object on the screen.
function documentFindX(o) {
	var sumX = 0
	if(o.parentNode.offsetParent) {
		sumX = documentFindX(o.offsetParent);
	}
	return sumX+o.offsetLeft;
}

// Find the Y coordinate of an object on the screen.
function documentFindY(o) {
	var sumY = 0
	if(o.parentNode.offsetParent) {
		sumY = documentFindY(o.offsetParent);
	}
	return sumY+o.offsetTop;
}

var adminAutoClear;
var adminSectionID;
var adminContentID;
var adminContentExternal;
var adminTemplate;

//onmouseout and over for span tags.
function adminHideBorders() {
	obj('contentBorder').style.display='none';
	obj('sectionBorder').style.display='none';
}

function adminContentBorderOn(o,color)
  {
		clearTimeout(adminAutoClear);
		var contentBorder=obj('contentBorder');
		if(contentBorder.style.display!='inline'){ contentBorder.style.display='inline' };
		contentBorder.style.left=documentFindX(o);
		contentBorder.style.top=documentFindY(o);
		contentBorder.style.width=o.offsetWidth;
		contentBorder.style.height=o.offsetHeight;
		contentBorder.style.borderColor=color;
		contentBorder.clickTarget=o;
		contentBorder.title = o.title;
		clearTimeout(adminAutoClear);
		adminSectionID = o.sectionID;
		adminContentID = o.contentID;
		adminContentExternal = o.contentExternal;
		adminTemplate = o.template;
  }

 function adminContentBorderOff()
  {
		//adminHideBorders();
	}

 function adminSectionBorderOn(o,color)
  {
		clearTimeout(adminAutoClear);
		var sectionBorder=obj('sectionBorder');
		if(sectionBorder.style.display!='inline'){ sectionBorder.style.display='inline' };
		sectionBorder.style.left=documentFindX(o)-3;
		sectionBorder.style.top=documentFindY(o)-3;
		sectionBorder.style.width=o.offsetWidth+6;
		sectionBorder.style.height=o.offsetHeight+6;
		sectionBorder.style.borderColor=color;
		sectionBorder.clickTarget=o;
		clearTimeout(adminAutoClear);
  }

 function adminSectionBorderOff()
  {
		obj('sectionBorder').style.display='none';
  }

	function adminContentUp() {
		if(adminContentID!=0) {
			window.parent.ContentMoveUp(adminSectionID,adminContentID);
		} else {
			alert('Sorry, there are no elements that can be moved in this section.  Try adding one first.');
		}
		window.event.cancelBubble=true;
	}

	function adminContentDown() {
		if(adminContentID!=0) {
			window.parent.ContentMoveDown(adminSectionID,adminContentID);
		} else {
			alert('Sorry, there are no elements that can be moved in this section.  Try adding one first.');
		}
		window.event.cancelBubble=true;
	}

	function adminContentAdd() {
		window.parent.ContentAdd(adminSectionID,adminContentID);
		window.event.cancelBubble=true;
	}

	function adminContentDelete() {
		if(adminContentID!=0) {
			if(window.confirm('Are you sure you want to remove this content block from the page?')){
				window.parent.ContentDelete(adminSectionID,adminContentID);
			}
		} else {
			alert('Sorry, there are no elements that can be moved in this section.  Try adding one first.');
		}
		window.event.cancelBubble=true;
	}

	function adminContentEdit() {
		//alert('ContentEdit::'+adminContentID+'::'+adminSectionID);
		if (adminContentExternal==1) {
			alert('This is an external content block, and cannot be edited. ('+adminTemplate+')');
		} else {
			window.parent.ContentEdit(adminSectionID,adminContentID);
		}
		window.event.cancelBubble=true;
	}
	
	//handles create account check
	function CopyField(Source,Destination) {
		BackupField(Destination);
		Destination.value=Source.value;
	}

	function BackupField(Field) {
		Field.OldValue=Field.value;
	}

	function CopyFieldOnly(Source,Destination) {
		Destination.value=Source.value;
	}

	function RestoreField(Destination) {
		Destination.value=Destination.OldValue;
	}
	
	function ShipSameAsBillClick() {
		if(document.frmAccount.same_info.checked) {
			CopyField( document.frmAccount.Bill_First   , document.frmAccount.Ship_First    );
			CopyField( document.frmAccount.Bill_Last    , document.frmAccount.Ship_Last     );
			CopyField( document.frmAccount.Bill_Company , document.frmAccount.Ship_Company  );
			CopyField( document.frmAccount.Bill_Phone1  , document.frmAccount.Ship_Phone1   );
			CopyField( document.frmAccount.Bill_Phone2  , document.frmAccount.Ship_Phone2   );
			CopyField( document.frmAccount.Bill_Fax     , document.frmAccount.Ship_Fax      );
			CopyField( document.frmAccount.Bill_Address1, document.frmAccount.Ship_Address1 );
			CopyField( document.frmAccount.Bill_Address2, document.frmAccount.Ship_Address2 );
			CopyField( document.frmAccount.Bill_City    , document.frmAccount.Ship_City     );
			CopyField( document.frmAccount.Bill_State   , document.frmAccount.Ship_State    );
			CopyField( document.frmAccount.Bill_Province, document.frmAccount.Ship_Province );
			CopyField( document.frmAccount.Bill_Zip     , document.frmAccount.Ship_Zip      );
			CopyField( document.frmAccount.Bill_Country , document.frmAccount.Ship_Country  );
		} else {
			RestoreField(document.frmAccount.Ship_First    );
			RestoreField(document.frmAccount.Ship_Last     );
			RestoreField(document.frmAccount.Ship_Company  );
			RestoreField(document.frmAccount.Ship_Phone1   );
			RestoreField(document.frmAccount.Ship_Phone2   );
			RestoreField(document.frmAccount.Ship_Fax      );
			RestoreField(document.frmAccount.Ship_Address1 );
			RestoreField(document.frmAccount.Ship_Address2 );
			RestoreField(document.frmAccount.Ship_City     );
			RestoreField(document.frmAccount.Ship_State    );
			RestoreField(document.frmAccount.Ship_Province );
			RestoreField(document.frmAccount.Ship_Zip      );
			RestoreField(document.frmAccount.Ship_Country  );
		}
	}
	
	//toggle for glossary page.
function getObj(name) {
	if (document.getElementById) {
		return document.getElementById(name);
	} else if (document.all) {
		return document.all[name];
	} else {
	return document.layers[name];
	}
}

function closeAll(number) {
		var div;
 		for (var i=1; i<number; i++)
    {
				div=getObj('q' + i);
				div.style.display = "none";
    }
}

function toggle(that) {
closeAll(85);
	if (that.style.display == "none") {
		that.style.display = "inline";
	} else {
		that.style.display = "none";
	}
}


//-->    