/*============== Strings ==============*/
String.prototype.pad = function(c, n) 
{
	var result = this;
  	
  	while(result.length < n) 
  	{
  		result = c + result; 
  	}
  
  	return result;
}

String.prototype.trim = function() 
{
	sInString = this;
  	sInString = sInString.replace( /^\s+/g, "" );// strip leading
  	
  	return sInString.replace( /\s+$/g, "" );// strip trailing
}

/*============== Page Setup ==============*/
gcLastPage   = GetCk("gcNav","CurPg");
gcNextPane   = "";
gcNextTab    = "";
glArriving   = false;
glRefreshing = false;
glReturning  = false;
oArgs        = null;  

if (typeof cPageId=="string") 
{ 
	SetCk("gcNav", "CurPg", cPageId, true); 
}
else
{
	SetCk("gcNav", "CurPg", "", true); 
}
  
function PageSetup() 
{
    var oFld
    
    if (cPageId == gcLastPage) 
    {
        glRefreshing = true;
        gcNextPane   = GetCk(cPageId,"Pane");
        gcNextTab    = GetCk(cPageId,"Tab");
    }
    else 
    {
        oFld = document.getElementById("Pane");

        if (oFld && oFld.value.length > 0) 
        { 
            glReturning = true; 
            gcNextPane  = oFld.value;
            oFld        = document.getElementById("Tab");
            
            if (oFld && oFld.value.length > 0) 
            { 
                gcNextTab = oFld.value;
            }
        }
        else 
        { 
            glArriving = true; 
            var oArgs  = GetQueryArgs("&");

            if (oArgs.Pane) 
            { 
                gcNextPane = oArgs.Pane; 
            }
            else if (typeof cFirstPane!="undefined") 
            {
                gcNextPane = cFirstPane;
            } 
            else 
            {
                gcNextPane = "1";
            }

            if (oArgs.Tab) 
            { 
                gcNextTab = parseInt(oArgs.Tab); 
            }
            else if (typeof nFirstTab!="undefined")  
            {
                gcNextTab  = nFirstTab; 
            } 
            else 
            {
                gcNextTab  = 11; 
            }
        }
    }
    
    // this line can be removed once all pages set cPageId before loading RGS.js
    SetCk("gcNav", "CurPg", cPageId, true);
}

function PageCleanup() 
{
	// SetCk("gcNav", "CurPg", "", true)
}
  

/*============== Misc ==============*/
function NormalizeEvent(ev) 
{
	var oRetVal;
  	
  	if (ev)
  	{
  		oRetVal = ev;
  	}
  	else
  	{
  		oRetVal = window.event;
  	}
  	if (!oRetVal.target)
  	{
  		oRetVal.target = oRetVal.srcElement;
  	}
  	return oRetVal;
}

function IsFromHere(cRfr) 
{
	if (cRfr.length==0)
	{
		return true;
	}
  	else if (/www.jacquardproducts.com/.test(cRfr)) 
  	{
  		return true;
  	}
  	else
  	{
  		return false;
  	}
}

function rOver(oImg) 
{
	var cSrc = oImg.src;
  	var rRO  = /_ro\./;
  
  	if (!rRO.test(cSrc)) 
  	{
  		oImg.src = cSrc.replace(/.jpg/,"_ro.jpg");
  	}
}

function rOut(oImg) 
{
	var cSrc = oImg.src;
  	var rRO  = /_ro\./;
  
  	if (rRO.test(cSrc))
  	{
  		oImg.src = cSrc.replace(/_ro.jpg/,".jpg");
  	}
}

function xRand(nFirst, nLast) 
{
	var nRange = nLast - nFirst;
  	var nRNum  = Math.round(nRange * Math.random());
  
  	return nFirst + nRNum;
}

/*============== Computed Styles ==============*/
function xTop(oEl) 
{
	var cTop;
  
  	if (oEl.currentStyle)
  	{
  		cTop = oEl.currentStyle["top"]; 
  	}
  	else if (window.getComputedStyle) 
  	{
  		cTop = document.defaultView.getComputedStyle(oEl,null).getPropertyValue("top"); 
  	}
  	return parseInt(cTop);
}

function xBottom(oEl)
{ 
	return ( xTop(oEl) + xHeight(oEl) ); 
}

function xLeft(oEl) 
{
	var cLeft;
  
  	if (oEl.currentStyle)
  	{
  		cLeft = oEl.currentStyle["left"]; 
  	}
  	else if (window.getComputedStyle) 
  	{
  		cLeft = document.defaultView.getComputedStyle(oEl,null).getPropertyValue("left"); 
  	}
  	return parseInt(cLeft);
}

function xRight(oEl) 
{
	return ( xLeft(oEl) + xWidth(oEl) ); 
}

function xHeight(oEl) 
{
	var cHt;
  
  	if (oEl.currentStyle) 
  	{
  		cHt = oEl.currentStyle["height"]; 
  	}
  	else if (window.getComputedStyle)
  	{
  		cHt = document.defaultView.getComputedStyle(oEl,null).getPropertyValue("height"); 
  	}
  	return parseInt(cHt);
}

function xWidth(oEl) 
{
	var cW;
  	
  	if (oEl.currentStyle)
  	{
  		cW = oEl.currentStyle["height"]; 
  	}
  	else if (window.getComputedStyle)
  	{
  		cW = document.defaultView.getComputedStyle(oEl,null).getPropertyValue("height"); 
  	}
  	return parseInt(cW);
}

function GetWindowHeight() 
{
	var myHeight = 0;
  
  	if( typeof( window.innerHeight ) == 'number' ) 
  	{
    	//Non-IE
    	myHeight = window.innerHeight;
  	} 
  	else if( document.documentElement && document.documentElement.clientHeight ) 
  	{
    	//IE 6+ in 'standards compliant mode'
    	myHeight = document.documentElement.clientHeight;
  	}
  	else if( document.body && document.body.clientHeight ) 
  	{
    	//IE 4 compatible
    	myHeight = document.body.clientHeight;
  	}
  	return myHeight;
}

function GetWindowWidth() 
{
	var myWidth = 0;
  
  	if( typeof( window.innerWidth ) == 'number' ) 
  	{
    	//Non-IE
    	myWidth = window.innerWidth;
  	}
  	else if( document.documentElement && document.documentElement.clientWidth ) 
  	{
    	//IE 6+ in 'standards compliant mode'
    	myWidth = document.documentElement.clientWidth;
  	} else if( document.body && document.body.clientWidth ) 
  	{
    	//IE 4 compatible
    	myWidth = document.body.clientWidth;
  	}
  	return myWidth;
}

/*============== Cookies ==============*/
function GetLocalCookie(tcId) 
{
	var oCookies = GetCookies();
   
   	if (oCookies[cPageId] && oCookies[cPageId][tcId]) 
   	{
   		return oCookies[cPageId][tcId]; 
   	}
   	else 
   	{
   		return false;
   	}
 }
 
function SetLocalCookie(tcId, tcVal, tcPath, tcPageId) 
{
	if (arguments.length < 2) 
	{
		return;
	}
   	if (typeof tcId != "string") 
   	{
   		return;
   	}
   	if (typeof tcVal != "string")
   	{
   		return;
   	}
   	if (typeof tcPageId != "string") 
   	{
   		tcPageId = cPageId; 
   	}
 
   	var oCookies = GetCookies();
     
   	if (!oCookies[tcPageId]) 
   	{
   		oCookies[tcPageId] = new Object(); 
   	}
     
   	oCookies[tcPageId][tcId] = tcVal;
     
   	var cCookie = "";
     
   	for (var cId in oCookies[tcPageId]) 
   	{
     	if (cCookie.length > 0)
     	{
     		cCookie = cCookie + "&"; 
     	}
     	cCookie = cCookie + cId + ":" + oCookies[tcPageId][cId];  
   	}
   	
   	cCookie = tcPageId + "=" + cCookie;
   	
   	if (typeof tcPath=="string")
   	{ 
   		cCookie = cCookie + "; path=" + tcPath; 
   	}

	document.cookie = cCookie;
}
   

/*============== Cookies: new 6/28/2006 ==============*/
function GetCk(tcGroup, tcId) 
{
	var oCookies = GetCookies();
   
   	if (oCookies[tcGroup] && oCookies[tcGroup][tcId])
   	{
   		return oCookies[tcGroup][tcId]; 
   	}
   	else
   	{
   		return false;
   	}
}

function SetCk(tcGroup, tcId, tcVal, tlGlobal, tcExpires) 
{
   	if (arguments.length < 3)
   	{
   		return; 
   	}
   	if (typeof tcGroup != "string")
   	{
   		return; 
   	}
   	if (typeof tcId != "string")
   	{
   		return;
   	}
   	if (typeof tcVal != "string")
   	{
   		return; 
   	}

   	if (arguments.length < 4)
   	{
   		tlGlobal = false;
   	}
   
   	if (tlGlobal && tcGroup.substring(0,2) != "gc") 
   	{
   		tcGroup = "gc" + tcGroup; 
   	}
   
   	var oCookies = GetCookies();
     
   	if (!oCookies[tcGroup])
   	{
   		oCookies[tcGroup] = new Object(); 
   	}
     
   	oCookies[tcGroup][tcId] = tcVal;
     
   	var cCookie = "";
     
   	for (var cId in oCookies[tcGroup]) 
   	{
    	if (cCookie.length > 0) 
    	{
    		cCookie = cCookie + "&"; 
    	}
     	cCookie = cCookie + cId + ":" + oCookies[tcGroup][cId];  
   	}
   	
   	cCookie = tcGroup + "=" + cCookie;
   	
   	if (tlGlobal)  
   	{
   		cCookie = cCookie + "; path=/"; 
   	}
   	if (tcExpires)
   	{ 
   		cCookie = cCookie + "; expires=" + tcExpires;
   	}
   
   	document.cookie = cCookie;
}

function GetCookies()
{
	return GetPairs(document.cookie, ";", "="); 
}
   
function GetPairs(cStr, cDelim1, cDelim2) 
{
	var aPairs, aPair, oPairs, cName, i;
  
  	oPairs = new Object();     
  	aPairs = cStr.split(cDelim1);
     
  	for (i=0; i<aPairs.length; i++) 
  	{
    	aPair = aPairs[i].split(cDelim2);
    	cName = aPair[0].trim();
    	
    	if ( /&/.test(aPair[1]) || /:/.test(aPair[1]) ) 
    	{
      		oPairs[cName] = GetPairs(aPair[1],"&",":"); 
      	}
    	else 
    	{
      		oPairs[cName] = aPair[1]; 
      	}
  	}
  	return oPairs;
}
   
/*============== Cookie Code Testing ==============*/
function ShowAll() 
{
	alert(document.cookie); 
}
   
function ShowPairs(oPairs) 
{
	for (var cName in oPairs) 
	{
    	if (typeof oPairs[cName] == "object") 
    	{
      		for (var cName2 in oPairs[cName]) 
      		{
        		alert( cName + ":SubCookie name: " + cName2);
        		alert( cName + ":SubCookie Val: " + oPairs[cName][cName2] ); 
      		}
    	}
    	else 
    	{
      		alert( "Cookie name: " + cName);
      		alert( "Cookie Val: " + oPairs[cName] ); 
      	}
  	}    
}
/*============== Page Bar Menu ==============*/
function MainMenu(iItemCnt) 
{
	this.cFirstPane    = "1";
   	this.cCurBtn       = "1";
   	this.cSelectedBtn  = "/_images/buttons/dot1green.jpg";
   	this.cNormalBtn    = "/_images/buttons/dot1blue.jpg";
   	this.cHoverBtn     = "/_images/buttons/dot1red.jpg";
   	this.cJLogo        = "/_images/logos/jacquard_a.jpg"
   
   	if (cPlatform=="MacIntosh") 
    {
    	this.cJLogoRo = "/_images/logos/jacquard_c.jpg";
    }
    else 
    {
    	this.cJLogoRo = "/_images/logos/jacquard_b.jpg";
    }
   
   	this.iItemCount    = iItemCnt;
   	this.oPanes        = new Object();
   	this.AddPane       = function(oPane) {this.oPanes[oPane.cPaneId] = oPane;}                      
   	this.HideContent   = function() { for (var oPane in this.oPanes) {this.oPanes[oPane].Hide();}  }  

   	this.SaveState = function() 
   	{
     	document.cookie = "Pane=" + this.cCurBtn;
     	SetLocalCookie("Pane",this.cCurBtn);
     	SetCk(cPageId, "Pane", this.cCurBtn);
     	
     	if (document.getElementById("Pane")) 
     	{
       		document.getElementById("Pane").value = this.cCurBtn; 
       	}
   	}
     
   	this.Show = function() 
   	{
    	if (!IsFromHere(document.referrer)) 
    	{
    		cPaneNum = this.cFirstPane;
    	}
     	else
     	{
       		cPaneNum = GetCookie("Pane");
       		
       		if (cPaneNum.length == 0) 
       		{
       			cPaneNum = this.cFirstPane; 
       		}
       		if (cPaneNum > this.iItemCount || cPaneNum < this.cFirstPane)
       		{
       			cPaneNum = this.cFirstPane;
       		}
     	}
     	this.ItemClick(cPaneNum);
   	}
   
   	this.ItemOver = function(cBtn) 
   	{
    	if (!(cBtn == this.cCurBtn)) 
    	{
       		var oBtn = document.getElementById("pbBtn" + cBtn);
       		
       		if (oBtn) 
       		{
       			oBtn.src = this.cHoverBtn;
       		}
       		
       		document.getElementById("pbDiv" + cBtn).className = "Btn bHov";
     	}
   	}
   	
   	this.ItemOut  = function ItemOut(cBtn) 
   	{
    	if (!(cBtn == this.cCurBtn)) 
    	{
       		document.getElementById("pbTxt" + cBtn).className = "pbTxt";
       		document.getElementById("pbDiv" + cBtn).className = "Btn bStd";
       		
       		var oBtn = document.getElementById("pbBtn" + cBtn);
       
       		if (oBtn) 
       		{
       			oBtn.src = this.cNormalBtn;
       		}
     	}
   	}
   	
   	this.ItemClick = function ItemClick(cBtnNum,iTab) 
   	{
    	this.cCurBtn = cBtnNum;
     	this.SetDefaultStyleAll();
     
     	if (cBtnNum != "0") 
     	{
     		this.SetSelectedStyle(cBtnNum); 
     	}
     
     	this.HideContent();   
     	this.oPanes["c"+cBtnNum].Show(iTab);
     	this.SaveState();  
     }

   	this.SetSelectedStyle = function SetSelectedStyle(cBtn) 
   	{
    	document.getElementById("pbTxt" + cBtn).className = "pbTxtSel";
     	document.getElementById("pbDiv" + cBtn).className = "Btn bSel";
     	  
     	var oBtn = document.getElementById("pbBtn" + cBtn)
     
     	if (oBtn) 
     	{
     		oBtn.src = this.cSelectedBtn;
     	}  
	} 

   	this.SetDefaultStyleAll = function() 
   	{
    	for (var i=1; i<=this.iItemCount; i++) 
    	{
        	document.getElementById("pbDiv" + i).className = "Btn bStd";
        	document.getElementById("pbTxt" + i).className = "pbTxt";
        	   
        	var oBtn = document.getElementById("pbBtn" + i);
        
        	if (oBtn) 
        	{
        		oBtn.src = this.cNormalBtn;
        	}
		}
	}

   	this.LogoOver = function(oLogo) 
   	{
    	if (oMM.cCurBtn != "0")
    	{
    		oLogo.style.cursor 	= "pointer";
    		oLogo.src			= this.cJLogoRo
    	}
     	else
     	{
     		oLogo.style.cursor = "default";
     	}
     }
   
   	this.LogoOut = function(oLogo) 
   	{
   		oLogo.src = this.cJLogo;
   	}

   	this.LogoClick = function(oLogo) 
   	{
    	oMM.ItemClick('0');
     	
     	oLogo.src 			= this.cJLogo;
     	oLogo.style.cursor 	= "default";
   	}

   	this.SetHeight = function() 
   	{
    	nHt = GetWindowHeight();
    	
    	for (var oPane in this.oPanes) 
    	{
    		this.oPanes[oPane].SetHeight(nHt);
    	}
   	}
   
}
/*-------------- End: Page Bar Menu --------------*/
  
/*============== Tile Menu ==============*/
function TileMenu() 
{
	this.ItemOver = function (oDiv, cArrId) 
	{
    	oDiv.className = "TileBtn tbHov";
    	
      	document.getElementById("Arrow" + cArrId).style.visibility = "visible";  
	}
    
    this.ItemOut = function SMItemOut(oDiv, cArrId) 
    {
    	oDiv.className = "TileBtn";
      
      	document.getElementById("Arrow" + cArrId).style.visibility = "hidden";  
	}  

    this.OnClick = function (oDiv, cPath, cPane, cTab) 
    {
    	oDiv.className = "TileBtn tbSel";
      	
      	GoTo(cPath, cPane, cTab);
      	
      	return false;  
	}
}
/*-------------- End: Tile Menu --------------*/

/*============== Panes ==============*/

Pane.oPane 					= null; 

Pane.prototype.Show       	= function()
{
	this.oPane.style.visibility = "visible"; this.LoadImages();
}

Pane.prototype.Hide = function()
{
	this.oPane.style.visibility = "hidden";
}

Pane.prototype.LoadImages = function() {}

function Pane() {}

stdPane.prototype = new Pane();
tabPane.prototype = new Pane();

function stdPane(cPaneId) 
{
	this.cPaneId   = cPaneId;
  	this.oPane     = document.getElementById(cPaneId);
  	this.oImages   = new Object();
  
  	this.SetHeight = function(nWinHt) 
  	{
    	if (!nWinHt) 
    	{
    		nWinHt = GetWindowHeight();
    	}
    
    	var oPanePos = getElementPosition(this.oPane);    
    
    	if (cBrwName=="MSIE")
    	{
    		var iSub = 10;
    	}
    	else 
    	{
    		var iSub = 44; 
    	}    
    
    	this.oPane.style.height = nWinHt - iSub - oPanePos.top;
    }
  	
  	this.LoadImages = function() 
  	{
    	for (var cProp in this.oImages) 
    	{ 
      		oEl = document.getElementById(cProp);
      		
      		if (oEl) 
      		{
      			oEl.src = this.oImages[cProp]; 
      		}
    	}
  	}
}

function tabPane(cPane, iFirstTab, iLastTab) 
{
	this.cPaneId   = cPane;
  	this.iFirstTab = iFirstTab;
  	this.iLastTab  = iLastTab;
  	this.iCurTab   = "";
  	this.cTabClass = "Tab";
  	this.oImages   = new Object();
  
  	this.oPane  = document.getElementById(this.cPaneId);
  	this.oTabs  = new Object();
  	this.oPages = new Object();

  	for (i=this.iFirstTab; i<=this.iLastTab; i++) 
  	{
    	var cTabId  		= "Tab" + i;
    	var cPgId 			= "Page" +  i;
    	this.oTabs[cTabId] 	= document.getElementById(cTabId);
    	this.oPages[cPgId] 	= document.getElementById(cPgId);
  	}
    
  	this.LoadImages = function(iTab) 
  	{
    	var cTabId, oEl;
    
    	cTabId = "Page" + iTab;
        
    	if (this.oImages[cTabId]) 
    	{
      		for (var i=0; i<this.oImages[cTabId].length; i++) 
      		{
        		oEl = document.getElementById( this.oImages[cTabId][i][0] );
        		
        		if (oEl) 
        		{
          			oEl.src = this.oImages[cTabId][i][1];
        		}
      		}
    	}
  	}

  	this.SetHeight = function(nWinHt) 
  	{
    	if (!nWinHt)
    	{
    		nWinHt = GetWindowHeight();
    	}
    	
    	var oPos = getElementPosition(this.oPane);
    
    	if (cBrwName=="MSIE")
    	{
    		var iSub = 10;
    	}
    	else
    	{
    		var iSub = 10; 
    	}
    
    	var oPanePos = getElementPosition(this.oPane);
    	
    	this.oPane.style.height = nWinHt - oPanePos.top - iSub;
    	
    	for (var cPag in this.oPages) 
    	{
      		var oPagePos = getElementPosition(this.oPages[cPag]);
      		this.oPages[cPag].style.height = nWinHt - oPagePos.top - iSub; 
    	}
  	}

  	this.Hide = function() 
  	{
    	this.oPane.style.visibility = "hidden";
    
    	for (var cTab in this.oTabs)  
    	{ 
     		this.oTabs[cTab].style.visibility = "hidden";  
     		
     		var oImg = this.oTabs[cTab].getElementsByTagName("img");
     		
     		if (oImg[0])
     		{
     			oImg[0].style.visibility = "hidden"; 
     		}
     		if (oImg[1])
     		{
     			oImg[1].style.visibility = "hidden"; 
     		}
    	}
    	for (var cPag in this.oPages)
    	{
    		this.oPages[cPag].style.visibility = "hidden"; 
    	}
  	}
  
  	this.Show = function(iTab) 
  	{
    	if (typeof iTab != "number") 
    	{
      		cTab = GetCookie("Tab");
      		
      		if (cTab.length == 0)
      		{
      			iTab = this.iFirstTab;
      		}
      		else
      		{
      			iTab = parseInt(cTab);
      		}
      	}
      
    	if (iTab < this.iFirstTab || isNaN(iTab))
    	{
    		iTab = this.iFirstTab;
    	}
    
    	if (iTab > this.iLastTab)
    	{
    		iTab = this.iLastTab;
    	}
    
    	this.Hide();
    
    	for (var cTab in this.oTabs)
    	{
    		this.oTabs[cTab].style.visibility = "visible"; 
    	}
    	
    	this.oPages["Page" + iTab].style.visibility = "visible";

    	this.SelectTab(iTab);
    	
    	this.oPane.style.visibility = "visible";
  	}
  
  	this.SelectTab = function(iTab) 
  	{
    	this.iCurTab = iTab;
    
    	for (var cPag in this.oPages)
    	{
    		this.oPages[cPag].style.visibility = "hidden"; 
    	}
    
    	for (var cTab in this.oTabs) 
    	{ 
      		this.oTabs[cTab].className = this.cTabClass + " tStd"; 
      		oImg = this.oTabs[cTab].getElementsByTagName("img");

      		if (oImg[1])
      		{
      			oImg[1].style.visibility = "hidden";
      			oImg[0].style.visibility = "visible";
      		} // hide only top image
      		else if (oImg[0])
      		{
      			oImg[0].style.visibility = "hidden"; 
      		}
    	}

    	oTab 			= this.oTabs["Tab" + this.iCurTab];
    	oTab.className 	= this.cTabClass + " tSel";
    	
    	oImg = oTab.getElementsByTagName("img");
    
    	if (oImg[1])
    	{
    		oImg[1].style.visibility = "visible"; 
    	}
    	else if (oImg[0])
    	{
    		oImg[0].style.visibility = "visible"; 
    	}
    
    	this.oPages["Page" + iTab].style.visibility = "visible";
    	this.SaveState();
    	this.LoadImages(iTab);
  	}
    
  	this.TabOver = function(iTab) 
  	{
    	if (iTab != this.iCurTab) 
    	{
    		this.oTabs["Tab"+iTab].className =  this.cTabClass + " tHov";
    	}  
    }
   
  	this.TabOut = function(iTab)
  	{
  		if(iTab != this.iCurTab)
  		{
  			this.oTabs["Tab"+iTab].className =  this.cTabClass + " tStd";
  		}
  	}

  	this.SaveState = function() 
  	{
    	document.cookie = "Tab=" + this.iCurTab;
    	
    	SetLocalCookie("Tab", this.iCurTab.toString());
    	SetCk( cPageId, "Tab", this.iCurTab.toString() );
    
    	if (document.getElementById("Tab")) 
    	{
      		document.getElementById("Tab").value = this.iCurTab; 
      	}
  	}   
}

/*----------------- End Panes -----------------*/
function GoHome(cPane,cTab) 
{
	if (typeof cPane != "string")
	{
		cPane = "0";
	}
  	document.cookie="Pane=" + cPane + "; path=/"; 
  
  	if (typeof cTab != "string")
  	{
  		cTab = "";
  	}
  
  	var cCook = "Tab=" + cTab + "; path=/";
  
  	document.cookie = cCook;

  	window.location.href="/";
  	 
  	return false;
}

function GoTo(cPath, cPane, cTab, cFileName) 
{
	if (typeof cPath == "object") 
	{
    	var cTmp  = cPath.href;
    	var aPath = cTmp.split(".com"); 
    	cPath     = aPath[1];
	}
    
  	if (typeof cPane != "string") 
  	{
  		cPane = "1";
  	}
  	var cCook = "Pane=" + cPane + "; path=" + cPath;
  	document.cookie = "";
  	document.cookie = cCook;

  	if (typeof cTab != "string") 
  	{
  		cTab = "";
  	}
  	
  	var cCook = "Tab=" + cTab + "; path=" + cPath;
  	
  	document.cookie = cCook;

  	if (typeof cFileName=="string")
  	{
  		cPath = cPath + cFileName;
  	}
  
  	window.location.href=cPath; 
  
  	return false;
}

function getElementPosition(offsetTrail) 
{
	var offsetLeft  = 0
  	var offsetTop   = 0
  	
  	while (offsetTrail) 
  	{
    	offsetLeft += offsetTrail.offsetLeft;
    	offsetTop  += offsetTrail.offsetTop;
    	offsetTrail = offsetTrail.offsetParent;
  	}
  
  	if (navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined") 
  	{
    	offsetLeft += document.body.leftMargin;
    	offsetTop  += document.body.topMargin;
  	}
  
  	return {left:offsetLeft, top:offsetTop};
}


function PopDebug(cMsg) 
{
	var lDebug = GetCookie("Debug");
  
  	if (lDebug=="1")
  	{
  		alert(cMsg);
  	}
}


/*====================================================================
  ====================================================================*/
var lIsNN = (navigator.appName == "Netscape");
var lIsIE = (navigator.appName == "Microsoft Internet Explorer");
  
var geniVersion;
var gennVersion;
var gencVersion;
var gencShortVersion;
GetVersion();
  
var gencWsId;
var gencStyleId;
GetIds();
  
var cCursorStylePointer = "pointer";

if (lIsIE && geniVersion < 6)
{
	cCursorStylePointer = "hand"; 
}
    
function GetVersion() 
{
	var cBrand = "";
   
   	if (lIsNN) 
   	{
    	cBrand = "nn";
    	
    	var appVer = parseFloat(navigator.appVersion);
    
    	if (appVer < 5) 
    	{
     		gennVersion = appVer;
    	} 
    	else if (typeof navigator.vendorSub != "undefined") 
    	{
     		gennVersion = parseFloat(navigator.vendorSub);      
    	}
    	else
    	{
     		gennVersion = 0;
    	} 
   	}
   	else if (lIsIE) 
   	{
    	cBrand 			= "ie";
    	var ua 			= navigator.userAgent;
    	var MSIEOffset 	= ua.indexOf("MSIE");
    
    	if (MSIEOffset == -1) 
    	{
     		gennVersion = 0;
    	}
    	else 
    	{
     		gennVersion = parseFloat(ua.substring(MSIEOffset + 5, ua.indexOf(";", MSIEOffset)));
    	}
   	}
   	else 
   	{
    	cBrand 		= "xx"
    	gennVersion = 0;
   	}
   	
   	geniVersion = Math.floor(gennVersion); 
   	gencVersion = cBrand + gennVersion;
   	gencShortVersion = cBrand + geniVersion;
}
  
function GetIds() 
{
	if (lIsIE) 
	{
    	if (geniVersion >= 5) 
    	{
    		gencWsId = "wsa"; gencStyleId = gencShortVersion; 
    	}
    	else if (geniVersion == 4) 
    	{
    		gencWsId = "ws1"; gencStyleId = gencShortVersion; 
    	}
    	else
    	{
    		gencWsId = "ws0"; gencStyleId = ""; 
    	}
   	}
   	else if (lIsNN) 
   	{ 
    	if (geniVersion >= 5)
    	{ 
    		gencWsId = "wsa";
    		gencStyleId = gencShortVersion;
    	}
    	else if (geniVersion == 4)
    	{	
    		gencWsId = "ws1"; 
    		gencStyleId = "nn4"; 
    	}
    	else 
    	{
    		gencWsId = "ws0"; gencStyleId = ""; 
    	}
   	}
   	else
   	{
   		gencWsId = "ws0"; gencStyleId = ""; 
   	}
}

function GetEvent(oEvt) 
{
	if (oEvt)
	{
		oEvt.keyCode = oEvt.which; return oEvt; 
	}
   	if (window.event)
   	{
   		return window.event 
   	}
   	return null
}
  
function GetEvent2(oEvt) 
{
	if (oEvt)
	{
		oRet = oEvt; 
	}
   	if (window.event)
   	{
   		oRet = window.event; 
   	}
   
   	oRet.getKeyCode = function() 
   	{
    	if (oRet.charCode) 
    	{
    		return oRet.charCode; 
    	}
     	if (oRet.which)
     	{
     		return oRet.which;
     	}
     	else
     	{
     		return oRet.keyCode;
     	}
   	}
   
   	return oRet;
}

function GetTarget(oEvt) 
{
	oEvt = GetEvent(oEvt);
    
    if (oEvt) 
    {
    	if (oEvt.srcElement)
    	{
    		return oEvt.srcElement; 
    	}
      	else
      	{
      		return oEvt.target; 
      	}
    }
}
  
function GetCookie(cName) 
{
	var cCookies 	= document.cookie;
   	var iPos 		= cCookies.indexOf(cName);
   	var iEnd;
   
   	if (iPos == -1)
   	{
   		return ""; 
   	}
   
   	iBeg = (iPos + cName.length + 1)   
   	iEnd = cCookies.indexOf(";", iBeg)
   
   	if (iEnd == -1)
   	{
   		iEnd = cCookies.length;
   	}
   
   	cVal = cCookies.substring(iBeg, iEnd);
   
   	return cVal
}
  
/*--------------------------------begin object: RollOver------------------*/
function RollOver() 
{
	this.StdSrc = ""
   	this.ROSrc = ""
   
   	this.Over = Over;
   	this.Out = Out;
}
   
function MainLogoRO()  
{
	this.StdSrc = "/_images/logos/jacquard_a.jpg";
   	this.ROSrc = "/_images/logos/jacquard_b.jpg";
   
   	this.Over = Over;
   	this.Out = Out;
   	this.Click = MainLogo_Click;
}
   
function Over(oImg) 
{
	oImg.style.cursor = "pointer";
   	oImg.src = this.ROSrc;
}
  
function Out(oImg) 
{
	oImg.style.cursor = "default";
   	oImg.src = this.StdSrc;
}

function MainLogo_Click() 
{
	document.cookie = "page=0; path=/"
}
/*--------------------------------end object: RollOver------------------*/

/*---------------------------Begin Object: Table-----------------------*/
function Table() 
{
	this.HLRow  		= HLightRow;
   	this.UHLRow 		= StdLightRow;
   	this.cStdBgColor 	= "#BEEDF5";
   	this.cHlBgColor  	= "white";
}
  
function HLightRow(oCell, cColor) 
{
	var oRow;
    
    if (oCell) 
    {
    	if (oCell.parentNode.tagName == "TD")
    	{
    		oCell = oCell.parentNode; 
    	}
      	
      	if (oCell.tagName == "TD") 
      	{
        	oRow = oCell.parentNode;
        
        	if (oRow.id != "RowHdr") 
        	{
          		this.cStdBgColor 					= oRow.style.backgroundColor;
          		oRow.style.backgroundColor 			= this.cHlBgColor;
          		oRow.cells[0].style.backgroundColor = this.cHlBgColor;
        	}
		}
    }
}
 
function StdLightRow(oCell) 
{
	if (oCell)
	{
    	if (oCell.parentNode.tagName == "TD")
    	{
    		oCell = oCell.parentNode; 
    	}
      	if (oCell.tagName == "TD")
      	{
        	oRow = oCell.parentNode;
        
        	if (oRow.id != "RowHdr") 
        	{
          		oRow.style.backgroundColor 			= this.cStdBgColor;
          		oRow.cells[0].style.backgroundColor = this.cStdBgColor;
        	}
      	}
    }
}
/*---------------------------End Object: Table-----------------------*/

/*------------------------------------------Begin Object: ProjectMenu------------------------*/
function ProjectMenu() 
{
	this.cBorder 		= "solid white 2px";
  	this.cBorderOn 		= "outset 2px";
  	this.cBGColor 		= "";
  	this.cBGColorOn 	= "white";
  	this.cLinkWt 		= "normal";
  	this.cLinkWtOn 		= "bold";
  	this.cLinkColor		= "blue";
  	this.cLinkColorOn 	= "red";  
  	this.aShowAlso 		= new Array();

  	this.ItemOver 		= pm_over;
  	this.ItemOut 		= pm_out;
  	this.AddShowWhenOn 	= pm_AddShowAlso;
}
 
function pm_over(oItem) 
{
	oItem.style.border 			= this.cBorderOn;
  	oItem.style.backgroundColor = this.cBGColorOn;
  	
  	oLink = document.getElementById(oItem.id + "_Link");
  
  	if (oLink) 
  	{ 
   		oLink.style.color 		= this.cLinkColorOn;
   		oLink.style.fontWeight 	= this.cLinkWtOn; 
   	}

  	for (i=0; i<this.aShowAlso.length; i++) 
  	{
   		oObj = document.getElementById(oItem.id + this.aShowAlso[i]);
   
   		if (oObj)
   		{
   			oObj.style.visibility = "visible"; 
   		}
  	}
}
 
function pm_out(oItem) 
{
	oItem.style.border = this.cBorder;
  	oItem.style.backgroundColor = this.cBGColor;
  
  	oLink = document.getElementById(oItem.id + "_Link");
  
  	if (oLink) 
  	{ 
   		oLink.style.color = this.cLinkColor; 
   		oLink.style.fontWeight = this.cLinkWt; 
   	}

  	for (i=0; i<this.aShowAlso.length; i++) 
  	{
   		oObj = document.getElementById(oItem.id + this.aShowAlso[i]);
   	
   		if (oObj)
   		{
   			oObj.style.visibility = "hidden"; 
   		}
  	}
}

function pm_AddShowAlso(cId) 
{
	this.aShowAlso[this.aShowAlso.length] = cId;
}

/*---------------------------End Object: ProjectMenu-----------------------*/
function GetQueryArgs(cSep) 
{
    var oArgs, cQuery, aPairs;
    
    if (!cSep) 
    {
        cSep = ","; 
    }
 
    oArgs  = new Object();
    cQuery = location.search.substring(1);
    aPairs = cQuery.split(cSep);
    
    for(var i = 0; i < aPairs.length; i++) 
    {
        var pos = aPairs[i].indexOf('=');

        if (pos == -1) continue;

        var cArgName 	= aPairs[i].substring(0,pos);
        var cValue   	= aPairs[i].substring(pos+1);
        oArgs[cArgName] = unescape(cValue);
    }   
    return oArgs;
}
