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_reloadPage(init) {  // reloads the window if Nav4 resized //
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function TJKOpen(zHref){  // v0.1 by TJKDesign.com //
	var TJKwin;
	TJKwin=window.open(zHref,'TJKwin');
	TJKwin.focus();
	return false;
}

function TJKpopup(zaref,w,h){  // v0.1 by TJKDesign.com //
	var TJKwin;
	var settings = "width="+w+",height="+h+",scrollbars=yes,toolbar=yes,location=yes,menubar=yes,status=yes,resizable=yes";
	TJKwin=window.open(zaref.href,'TJKwin',settings);
	TJKwin.focus();
}

// This script is from projectseven.com //
// Originaly it is to be used with *UL* //
function P7_swapClass(){ // v1.4 by PVII //
 var i,x,tB,j=0,tA=new Array(),arg=P7_swapClass.arguments;
 if(document.getElementsByTagName){for(i=4;i<arg.length;i++){tB=document.getElementsByTagName(arg[i]);
  for(x=0;x<tB.length;x++){tA[j]=tB[x];j++;}}for(i=0;i<tA.length;i++){
  if(tA[i].className){if(tA[i].id==arg[1]){if(arg[0]==1){
  tA[i].className=(tA[i].className==arg[3])?arg[2]:arg[3];}else{tA[i].className=arg[2];}
  }else if(arg[0]==1 && arg[1]=='none'){if(tA[i].className==arg[2] || tA[i].className==arg[3]){
  tA[i].className=(tA[i].className==arg[3])?arg[2]:arg[3];}
  }else if(tA[i].className==arg[2]){tA[i].className=arg[3];}}}}
}
function P7_writeStyles(op,a){ // v1.5 by PVII  //
if(op==0||document.getElementById){var tS="<sty"+"le type=\"text/css\">";
// I changed the line below, original script at: www.projectseven.com //
tS+=a+"<"+"/sty"+"le>";document.write(tS);document.close();}
}
P7_writeStyles(1,'.closed div{display:none;}.open div{display:block;}');

// Feeding a POLL id or going Random //
// Hiding the poll tables from DOM-challenged UAs //
function TJKpoll(zPOLL){ // v0.1 by TJKDesign.com //
POLLids = ["4","20","21","26","19","24"];
var POLLid = POLLids [Math.floor(Math.random()*POLLids.length)];
if (zPOLL == null) zPOLL=POLLid;
   if(document.getElementById){  
      var S="<scr"+"ipt"; 
      S=S+" src='/pm/xlaabsolute.asp?p="+zPOLL;
      S=S+"' type='text/javascript'>";
      S=S+"</scr"+"ipt>";
      document.write(S);
   }
}
   
// TJKDesign | writing to non-DOM compliant UAs //
function TJKalert(mess){
if (!document.getElementById) {
document.write(mess)
}   
}   
function readCookie(name)
{ // www.quirksmode.org/js/cookies.html#script //
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function TJKpeekaboo() { // v0.1 by TJKDesign.com //
var zBackOut = "url(/img/backwrap.jpg) repeat-y #ececec";
var zBackIn = "none #ececec";
var zStyle = readCookie("StyleName");
if (zStyle == "c") {zBackOut = "url(/img/backwrap.jpg) repeat-y";zBackIn = "none";}
if (document.getElementById){
zBar = document.getElementById("leftbar");
zOnglet = document.getElementById("onglet");	
zWrapper = document.getElementById("wrapper");	
zContent =  document.getElementById("content");	
	if (zOnglet.style.left == "0px"){
		zBar.style.display="block";
		zOnglet.style.left="171px";
		zWrapper.style.background=zBackOut;
		zContent.style.margin="0 15px 0 190px";
		}else{
		zBar.style.display="none";
		zOnglet.style.left="0px";
		zWrapper.style.background=zBackIn;
		zContent.style.margin="0 0 0 30px";
		}
	return false;	
	}
return true;	
}

// The swaping of SRC values on the logo triggers a wierd bug in MSIE5.2 Mac //
// This is to make sure there is *no* swap in MSIE5.2 Mac unless the page is //
// Msie5Mac.asp. The one where we demonstrate the Bug //
function TJKswap(arg) { // v0.1 by TJKDesign.com //
zpage=MM_findObj("ieMacBug"); // This is the MSIE5MAC.ASP page //
isMac52=false;
if (!zpage && (navigator.appVersion.indexOf("Mac") != -1) && (navigator.userAgent.indexOf("MSIE") != -1) && (navigator.userAgent.indexOf("5.2") != -1)) isMac52=true;
if (isMac52) return;
zobj=MM_findObj("homegif");
if (arg=="show"){zobj.src="/img/homepic.gif";} else if (arg=="hide") {zobj.src="/img/clear.gif";}
}

function TJK_BreakOut(){ // v0.1 by TJKDesign.com //
 if (self != top) top.location.replace(self.location);
}
TJK_BreakOut();
function viewCart(){
	if (window.paypal && !paypal.closed){
		paypal.focus()
		}else{
		alert('Your shopping cart is empty or has been closed.')
		}
	return false;
}
// Make sure "href" values in your menu do not end with a "/" as in "http//www.mydomain.com/directory/"
// For help, read the article at: http://www.tjkdesign.com/articles/navigation_links_and_current_location.asp
function TJK_hank(zMenu,defaultPage,classToApply,leaveItAlone){// v1.7 Copyright (c) 2006 TJKDesign - Thierry Koblentz
//zMenu: the ID of the menu or any parent element 
//defaultPage: the page the server calls by default (index.htm, default.asp, index.php, etc.)
//classToApply: if you pass a class name here, the script won't replace the anchor with an EM, but instead will add it to the value of the class attribute in the "current" anchor. If there is none, then the attribute will be written along with this class name
//leaveItAlone: if you pass a class name here then the script will ignore (skip) any anchor containing this class name
//***********************************************************************//
if (document.getElementById && document.createElement && document.getElementById(zMenu)){
// taking care of URLs with no document name (for example: "http://www.tjkdesign.com/")
var strLocation = (top.location.pathname.lastIndexOf("/")+1 == top.location.pathname.length) ? top.location.hostname + top.location.pathname+defaultPage : top.location.hostname + top.location.pathname;
var a = document.getElementById(zMenu).getElementsByTagName("a");
		for (var x=0,i=a.length;x<i;x++){
// check if there is a value (a class name) set for the "leaveItAlone" variable
		var nothingToDo = (a[x] && a[x].className && a[x].className==leaveItAlone) ? true : false;
// we are allowed to take care of this one, now we check for href value and for fake Anchors
			if (!nothingToDo && a[x] && a[x].href && a[x].href.lastIndexOf("#")+1!=a[x].href.length){
// we check if the document is included in the URL path or, if there is a perfect match in case there is no document name in the href value (for example: http://www.tjkdesign.com/articles/)
				if (a[x].href.indexOf(strLocation,0)>0 || a[x].href == top.location.protocol + "//" + top.location.hostname + top.location.pathname){
// if there is no value set for the "classToApply" variable we replace the anchor with an EM element
						if (classToApply==""){
							var objNode = a[x];
							var strLink = objNode.firstChild.data;
// This is a nice way to do it, but in NN6 and FF 0.8 ULs get duplicated, as "phantom lists"
//							var objLink = document.createElement('em');
//							objLink.appendChild(document.createTextNode(strLink));
//							objNode.parentNode.replaceChild(objLink,objNode);
// Not as nice as the above, but offers better browser support							
							objNode.parentNode.innerHTML="<em>"+strLink+"</em>";	
// there is a value set for the "classToApply" variable so we style the anchor instead of replacing it with an EM
						}else{
							a[x].className += " "+classToApply;
					}
				}
			}
		}
	}
}

// From Simon Willison's Weblog
// http://simon.incutio.com/archive/2004/05/26/addLoadEvent
function addLoadEvent(func) {var oldonload = window.onload;if(typeof window.onload != 'function'){window.onload = func;}else{window.onload = function(){oldonload();func();}}}
addLoadEvent(function(){TJK_hank("TJKnav","default.asp","","menu nochild");});
addLoadEvent(function(){TJK_hank("frameMenu","default.asp","","");});
addLoadEvent(function(){TJK_hank("navframes","default.asp","","");});
addLoadEvent(function(){TJK_hank("popupMenu","default.asp","","");});
addLoadEvent(function(){TJK_hank("navPopup","default.asp","","");});
addLoadEvent(function(){TJK_hank("dropdownMenu","default.asp","","");});
addLoadEvent(function(){TJK_hank("navDropdown","default.asp","","");});