

// here we define global variable
var ajaxdestination="";

function getdata(what,where) { // get data from source (what)
 try {
   xmlhttp = window.XMLHttpRequest?new XMLHttpRequest():
  		new ActiveXObject("Microsoft.XMLHTTP");
 }
 catch (e) { /* do nothing */ }

 document.getElementById(where).innerHTML ="<center><img src='loading.gif'></center>";
// we are defining the destination DIV id, must be stored in global variable (ajaxdestination)
 ajaxdestination=where;
 xmlhttp.onreadystatechange = triggered; // when request finished, call the function to put result to destination DIV
 xmlhttp.open("GET", what);
 xmlhttp.send(null);
  return false;
}

function triggered() { // put data returned by requested URL to selected DIV
  if (xmlhttp.readyState == 4) if (xmlhttp.status == 200) 
    document.getElementById(ajaxdestination).innerHTML =xmlhttp.responseText;
}

function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) 
	field.value = field.value.substring(0, maxlimit);
else
	document.getElementById("counterBox").value = maxlimit - field.value.length;
	//oElement = document.getElementById("counter");
	//oElement.style.innerHTML
	//document.getElementById("counter").innerHTML = maxlimit - field.value.length;
}

// Begin CORNERS JS

/* Nifty Corners Cube - rounded corners with CSS and Javascript
Copyright 2006 Alessandro Fulciniti (a.fulciniti@html.it)

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

var niftyOk=(document.getElementById && document.createElement && Array.prototype.push);
var niftyCss=false;

String.prototype.find=function(what){
return(this.indexOf(what)>=0 ? true : false);
}

var oldonload=window.onload;
if(typeof(NiftyLoad)!='function') NiftyLoad=function(){};
if(typeof(oldonload)=='function')
    window.onload=function(){oldonload();AddCss();NiftyLoad()};
else window.onload=function(){AddCss();NiftyLoad()};

function AddCss(){
niftyCss=true;
var l=CreateEl("link");
l.setAttribute("type","text/css");
l.setAttribute("rel","stylesheet");
l.setAttribute("href","/js/niftyCorners.css");
l.setAttribute("media","screen");
document.getElementsByTagName("head")[0].appendChild(l);
}

function Nifty(selector,options){
if(niftyOk==false) return;
if(niftyCss==false) AddCss();
var i,v=selector.split(","),h=0;
if(options==null) options="";
if(options.find("fixed-height"))
    h=getElementsBySelector(v[0])[0].offsetHeight;
for(i=0;i<v.length;i++)
    Rounded(v[i],options);
if(options.find("height")) SameHeight(selector,h);
}

function Rounded(selector,options){
var i,top="",bottom="",v=new Array();
if(options!=""){
    options=options.replace("left","tl bl");
    options=options.replace("right","tr br");
    options=options.replace("top","tr tl");
    options=options.replace("bottom","br bl");
    options=options.replace("transparent","alias");
    if(options.find("tl")){
        top="both";
        if(!options.find("tr")) top="left";
        }
    else if(options.find("tr")) top="right";
    if(options.find("bl")){
        bottom="both";
        if(!options.find("br")) bottom="left";
        }
    else if(options.find("br")) bottom="right";
    }
if(top=="" && bottom=="" && !options.find("none")){top="both";bottom="both";}
v=getElementsBySelector(selector);
for(i=0;i<v.length;i++){
    FixIE(v[i]);
    if(top!="") AddTop(v[i],top,options);
    if(bottom!="") AddBottom(v[i],bottom,options);
    }
}

function AddTop(el,side,options){
var d=CreateEl("b"),lim=4,border="",p,i,btype="r",bk,color;
d.style.marginLeft="-"+getPadding(el,"Left")+"px";
d.style.marginRight="-"+getPadding(el,"Right")+"px";
if(options.find("alias") || (color=getBk(el))=="transparent"){
    color="transparent";bk="transparent"; border=getParentBk(el);btype="t";
    }
else{
    bk=getParentBk(el); border=Mix(color,bk);
    }
d.style.background=bk;
d.className="niftycorners";
p=getPadding(el,"Top");
if(options.find("small")){
    d.style.marginBottom=(p-2)+"px";
    btype+="s"; lim=2;
    }
else if(options.find("big")){
    d.style.marginBottom=(p-10)+"px";
    btype+="b"; lim=8;
    }
else d.style.marginBottom=(p-5)+"px";
for(i=1;i<=lim;i++)
    d.appendChild(CreateStrip(i,side,color,border,btype));
el.style.paddingTop="0";
el.insertBefore(d,el.firstChild);
}

function AddBottom(el,side,options){
var d=CreateEl("b"),lim=4,border="",p,i,btype="r",bk,color;
d.style.marginLeft="-"+getPadding(el,"Left")+"px";
d.style.marginRight="-"+getPadding(el,"Right")+"px";
if(options.find("alias") || (color=getBk(el))=="transparent"){
    color="transparent";bk="transparent"; border=getParentBk(el);btype="t";
    }
else{
    bk=getParentBk(el); border=Mix(color,bk);
    }
d.style.background=bk;
d.className="niftycorners";
p=getPadding(el,"Bottom");
if(options.find("small")){
    d.style.marginTop=(p-2)+"px";
    btype+="s"; lim=2;
    }
else if(options.find("big")){
    d.style.marginTop=(p-10)+"px";
    btype+="b"; lim=8;
    }
else d.style.marginTop=(p-5)+"px";
for(i=lim;i>0;i--)
    d.appendChild(CreateStrip(i,side,color,border,btype));
el.style.paddingBottom=0;
el.appendChild(d);
}

function CreateStrip(index,side,color,border,btype){
var x=CreateEl("b");
x.className=btype+index;
x.style.backgroundColor=color;
x.style.borderColor=border;
if(side=="left"){
    x.style.borderRightWidth="0";
    x.style.marginRight="0";
    }
else if(side=="right"){
    x.style.borderLeftWidth="0";
    x.style.marginLeft="0";
    }
return(x);
}

function CreateEl(x){
return(document.createElement(x));
}

function FixIE(el){
if(el.currentStyle!=null && el.currentStyle.hasLayout!=null && el.currentStyle.hasLayout==false)
    el.style.display="inline-block";
}

function SameHeight(selector,maxh){
var i,v=selector.split(","),t,j,els=[],gap;
for(i=0;i<v.length;i++){
    t=getElementsBySelector(v[i]);
    els=els.concat(t);
    }
for(i=0;i<els.length;i++){
    if(els[i].offsetHeight>maxh) maxh=els[i].offsetHeight;
    els[i].style.height="auto";
    }
for(i=0;i<els.length;i++){
    gap=maxh-els[i].offsetHeight;
    if(gap>0){
        t=CreateEl("b");t.className="niftyfill";t.style.height=gap+"px";
        nc=els[i].lastChild;
        if(nc.className=="niftycorners")
            els[i].insertBefore(t,nc);
        else els[i].appendChild(t);
        }
    }
}

function getElementsBySelector(selector){
var i,j,selid="",selclass="",tag=selector,tag2="",v2,k,f,a,s=[],objlist=[],c;
if(selector.find("#")){ //id selector like "tag#id"
    if(selector.find(" ")){  //descendant selector like "tag#id tag"
        s=selector.split(" ");
        var fs=s[0].split("#");
        if(fs.length==1) return(objlist);
        f=document.getElementById(fs[1]);
        if(f){
            v=f.getElementsByTagName(s[1]);
            for(i=0;i<v.length;i++) objlist.push(v[i]);
            }
        return(objlist);
        }
    else{
        s=selector.split("#");
        tag=s[0];
        selid=s[1];
        if(selid!=""){
            f=document.getElementById(selid);
            if(f) objlist.push(f);
            return(objlist);
            }
        }
    }
if(selector.find(".")){      //class selector like "tag.class"
    s=selector.split(".");
    tag=s[0];
    selclass=s[1];
    if(selclass.find(" ")){   //descendant selector like tag1.classname tag2
        s=selclass.split(" ");
        selclass=s[0];
        tag2=s[1];
        }
    }
var v=document.getElementsByTagName(tag);  // tag selector like "tag"
if(selclass==""){
    for(i=0;i<v.length;i++) objlist.push(v[i]);
    return(objlist);
    }
for(i=0;i<v.length;i++){
    c=v[i].className.split(" ");
    for(j=0;j<c.length;j++){
        if(c[j]==selclass){
            if(tag2=="") objlist.push(v[i]);
            else{
                v2=v[i].getElementsByTagName(tag2);
                for(k=0;k<v2.length;k++) objlist.push(v2[k]);
                }
            }
        }
    }
return(objlist);
}

function getParentBk(x){
var el=x.parentNode,c;
while(el.tagName.toUpperCase()!="HTML" && (c=getBk(el))=="transparent")
    el=el.parentNode;
if(c=="transparent") c="#FFFFFF";
return(c);
}

function getBk(x){
var c=getStyleProp(x,"backgroundColor");
if(c==null || c=="transparent" || c.find("rgba(0, 0, 0, 0)"))
    return("transparent");
if(c.find("rgb")) c=rgb2hex(c);
return(c);
}

function getPadding(x,side){
var p=getStyleProp(x,"padding"+side);
if(p==null || !p.find("px")) return(0);
return(parseInt(p));
}

function getStyleProp(x,prop){
if(x.currentStyle)
    return(x.currentStyle[prop]);
if(document.defaultView.getComputedStyle)
    return(document.defaultView.getComputedStyle(x,'')[prop]);
return(null);
}

function rgb2hex(value){
var hex="",v,h,i;
var regexp=/([0-9]+)[, ]+([0-9]+)[, ]+([0-9]+)/;
var h=regexp.exec(value);
for(i=1;i<4;i++){
    v=parseInt(h[i]).toString(16);
    if(v.length==1) hex+="0"+v;
    else hex+=v;
    }
return("#"+hex);
}

function Mix(c1,c2){
var i,step1,step2,x,y,r=new Array(3);
if(c1.length==4)step1=1;
else step1=2;
if(c2.length==4) step2=1;
else step2=2;
for(i=0;i<3;i++){
    x=parseInt(c1.substr(1+step1*i,step1),16);
    if(step1==1) x=16*x+x;
    y=parseInt(c2.substr(1+step2*i,step2),16);
    if(step2==1) y=16*y+y;
    r[i]=Math.floor((x*50+y*50)/100);
    r[i]=r[i].toString(16);
    if(r[i].length==1) r[i]="0"+r[i];
    }
return("#"+r[0]+r[1]+r[2]);
}

// END  CORNERS JS

function hidediv(id,taboff) {
        //safe function to hide an element with a specified id
        if (document.getElementById) { // DOM3 = IE5, NS6
                document.getElementById(id).style.display = 'none';
        }
        else {
                if (document.layers) { // Netscape 4
                        document.id.display = 'none';
                }
                else { // IE 4
                        document.all.id.style.display = 'none';
                }
        }
        // switch tab image to off state
        document.getElementById(taboff).src = "/images/homepage/"+taboff+"_off.gif";
}

function showdiv(id,tab) {
        //safe function to show an element with a specified id
                  
        if (document.getElementById) { // DOM3 = IE5, NS6
                document.getElementById(id).style.display = 'block';
        }
        else {
                if (document.layers) { // Netscape 4
                        document.id.display = 'block';
                }
                else { // IE 4
                        document.all.id.style.display = 'block';
                }
        }
        // switch tab image to current selection
        document.getElementById(tab).src = "/images/homepage/"+tab+"_on.gif";
}




function ToggleQuickLinksMenu() {
   	QuickLinksMenu = document.getElementById('QuickLinksMenu');
  	QuickLinksButton = document.getElementById('QuickLinksButton');

   QuickLinksMenu.style.left = getposOffset(QuickLinksButton, "left") - 100;
   QuickLinksMenu.style.top = getposOffset(QuickLinksButton, "top") + QuickLinksButton.offsetHeight;

   if (QuickLinksMenu.style.visibility == "hidden") {
     	QuickLinksMenu.style.visibility = "visible";
     	QuickLinksMenu.style.display = 'block';
   } else {
     	QuickLinksMenu.style.visibility = "hidden";
     	QuickLinksMenu.style.display = 'none';
   }
 }
 
var origHeight, origWidth;
var coll = "";
var styleObj = "";
var isMac, isPC;
if (navigator.platform.indexOf('Mac') != -1) {
	isMac = true;
} else {
	isPC = true;
}

if (document.layers) {
	origWidth = innerWidth;
	origHeight = innerHeight;
} else if (document.all) {
	coll = "all.";
	//styleObj = ".style";
} else if (document.getElementById) {
	coll = "getElementById('";
	//styleObj = "').style";
	styleObj = "')";
}

function fixLayer(lname) {
	var fixedLayer;
	if (document.layers) {
		fixedLayer = "document." + lname;
	} else if (document.all) {
		fixedLayer = "document.all." + lname;
	} else if (document.getElementById) {
		fixedLayer = "document.getElementById('" + lname + "')";
	}
	return fixedLayer;
}

function fixLayerLong(lname) {
	var fixedLayer;
	
	if (document.layers) {
		//alert("document." + lname);
		fixedLayer = eval("document." + lname);
	} else {
		//alert("document." + coll + lname + styleObj);
		fixedLayer = eval("document." + coll + lname + styleObj);
	}
	return fixedLayer;
}


function swap(image, over) {
	if (over) {
		document.images[image].src = document.images[image].src.replace(/_off/gi, '_over');
	} else {
		document.images[image].src = document.images[image].src.replace(/_over/gi, '_off');
	}
}

function swapIconLbl(imagesrc,over) {
	if (over) {
		document.images['icon_lbl'].src = imagesrc;
	} else {
		document.images['icon_lbl'].src = '/img/spacer.gif';
	}
}

function writeToLayer(layerName,layerText) {
  layerObj = fixLayerLong(layerName);
	
  if (document.layers) {
    with (layerObj) {
      document.write(layerText);
      document.close();
    }
  } else if (document.all) {
    layerObj.innerHTML = layerText;
  } else if (document.getElementById) {
    layerObj.innerHTML = layerText;
  }
}

function printWin(thisURL) {
	popWin= window.open(thisURL,"printWin", "width=600,height=500,scrollbars=1,resizable=1,menubar=1,toolbar=1");
	popWin.focus();
}

function emailWin(thisURL) {
	popWin = window.open('/utils/email.html?pageurl=' + thisURL, "emailWin", "width=650,height=500,scrollbars=1,resizable=1,menubar=1,toolbar=1");
	popWin.focus();
}

//USE: <a href="javascript:nonPgSite('http://www.patchlink.com')">www.patchlink.com</a>
function nonPgSite(htmlUrl) {
var content1="<SCRIPT LANGUAGE='JavaScript'>function outtahere(url){window.opener.location=url;self.close();}</SCRIPT><html><head><title>You are now leaving the JDA Site</title></head><body bgcolor='#FFFFFF' onLoad='self.focus();' onBlur='self.focus();'>"
var content2="<"
var content3="<p align='center'>You are now leaving the JDA web site. Links to other sites are provided as a convenience to the user. JDA accepts no responsibility for the content of linked sites.</p>"
var content4="<br><p align='center'><form name='goingToNonPgSite'><input type='submit' name='submit' value='Continue' onclick=javascript:outtahere('" + htmlUrl + "') ;>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='submit' name='submit' value='Cancel' onclick='self.close()';></form></p></td></tr></table></body></html>"
if (document.all) {
	var xMax = screen.width, yMax = screen.height
	}
	else if (document.layers) {
			var xMax = window.outerWidth, yMax = window.outerHeight
			}
		else {
			var xMax = 640, yMax=480
			} 
var xOffset = (xMax - 390)/2, yOffset = (yMax - 290)/2; 
remote = window.open('','myRemote','width=390,height=290,screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+'','myWindow');
remote.document.write(content1+content2+content3+content4)
remote.focus()
remote.document.close()
}



//<a href="javascript:rs('details','path_to_file',500,270,0,1)"></a>
var remote=null;
function rs(n,u,w,h,x,no) {

if ( no == 1 ) {
  remote=window.open(u,n,'width='+w+',height='+h+',resizable=no,scrollbars=no,status=0');
}
if ( no == 2 ) {
  remote=window.open(u,n,'width='+w+',height='+h+',resizable=1,scrollbars=1,menubar=1,location=1,toolbar=1,status=0');
}
if ( no == 3 ) {
  remote=window.open(u,n,'width='+w+',height='+h+',resizable=yes,scrollbars=yes,status=1');
}
else {
  remote=window.open(u,n,'width='+w+',height='+h+',resizable=yes,scrollbars=yes,status=0');
}
if (remote != null) {
remote.focus();
if (remote.opener == null )
remote.opener = self;
}
if (x==1){return remote;}
}

function RS(n,u,w,h,x,no) {
	rs(n,u,w,h,x,no);
}

function showStatus(sMsg) {
    window.status = sMsg ;
    return true ;
}


// function for opening side DIV in subnav.
// USAGE: 
//	<td align="left" valign="top" class="sub_header"  onClick="toggleDiv('NAME'); return false;">Header Name Here</td>
//	<tr id="NAME">

function toggleDiv(e) {
  var imageTitle;
  var div = document.getElementById(e);
  var display = div.style.display;

  if (display == "none") {
    div.style.display = "";
    //imageTitle = "bluearrow2.gif";
  }
  else if (display == "") {
    div.style.display = "none";
    //imageTitle = "bluearrow.gif";
  }
}

//  Usage:
//  <a href="javascript:void(0)" onmousedown="displayToggle('PortalLayer');return false;">Change Portal</a>
//  <div id="PortalLayer" style="display:none;"><br>
//  </div>

function displayToggle(id) { 
var el = document.getElementById(id).style; 

if(el.display == "none") { 
el.display = ""; 
} 
else if(el.display == "") { 
el.display = "none"; 
} 
} 

function displayUpdateToggle(id) { 
var el = document.getElementById(id).style; 
//var temp = "bg" +id
//var elBG = document.getElementById(temp).style; 
var el2 = "arrow" + id;
var elbg = "bg" + id;
var elbgvar = document.getElementById(elbg); 

alert(el2);

if(el.display == "none") { 
	el.display = ""; 
	//elBG.backgroundColor = "#c0c0c0"; document.getElementById(elbg).style.backgroundColor = "#c0c0c0"; 
	
	document.getElementById(el2).innerHTML = "<img src='/images/ajax/minus.gif' width='14' height='14'><br>";
		setBgColor (elbg, 'cccccc');
	 // if(elbgvar.currentStyle)  {   
	 //	elbgvar.style.backgroundColor = "#c0c0c0"; 
	 // } else {  
	 // 	elbgvar.style.setProperty("background-color", "#c0c0c0"); 
	  //} 
} 
else if(el.display == "") { 
el.display = "none"; 
	//document.getElementById(elbg).style.backgroundColor = "#c0c0c0"; 
	document.getElementById(el2).innerHTML = "<img src='/images/ajax/minus.gif' width='14' height='14'><br>";
	//alert(elbg);
	setBgColor (elbg, 'efefef');
} 
} 


function displayPSToggle(id) { 
var el = document.getElementById(id).style; 
if(el.display == "none") { 
el.display = ""; 
document.images[el + 'img'].src = "/partners/img/11x11_arrow.gif";
} 
else if(el.display == "") { 
el.display = "none"; 
document.images[el + 'img'].src = "/img/spacer.gif";
} 
} 

function displayImageToggle(id) { 
var el = document.getElementById(id).style; 
if(el.display == "none") { 
el.display = ""; 
document.images[el + 'img'].src = "/img/div_plus.gif";
} 
else if(el.display == "") { 
el.display = "none"; 
document.images[el + 'img'].src = "/img/div_minus.gif";
} 
} 


//  Usage:
//  <input type="checkbox" name="c1" onclick="showMe('GuestNameDiv', this)">Show Hide Checkbox
//  <div id="GuestNameDiv" style="display:none">Content to display!</div>


function showMe (it, box) {
  var vis = (box.checked) ? "" : "none";
  document.getElementById(it).style.display = vis;
}
function showGuestMealNameDetails (it, box) {
  var vis = (box.checked) ? "" : "none";
  document.getElementById(it).style.display = vis;
  document.getElementById("GuestMealNameInfo").style.display = vis;
  document.getElementById("GuestMealNameField").style.display = vis; 
  document.getElementById("GuestMealNameText").style.display = vis;
  document.getElementById("GuestMealNameHeader").style.display = vis; 
}





function swapIconLbl(imagesrc,over) {
	if (over) {
		document.images['icon_lbl'].src = imagesrc;
	} else {
		document.images['icon_lbl'].src = '/img/spacer.gif';
	}
}



function option1(form,doc_name) 
	{
	//undate hidden ProductID field before posting
	form.ProductID.value = doc_name;
	document.theForm.submit();
	}
	
	
	
	
var dragapproved=false
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

function iecompattest(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function drag_drop(e){
if (ie5&&dragapproved&&event.button==1){
document.getElementById("dwindow").style.left=tempx+event.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
document.getElementById("dwindow").style.left=tempx+e.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+e.clientY-offsety+"px"
}
}

function initializedrag(e){
offsetx=ie5? event.clientX : e.clientX
offsety=ie5? event.clientY : e.clientY
document.getElementById("dwindowcontent").style.display="none" //extra
tempx=parseInt(document.getElementById("dwindow").style.left)
tempy=parseInt(document.getElementById("dwindow").style.top)

dragapproved=true
document.getElementById("dwindow").onmousemove=drag_drop
}

function loadwindow(url,width,height){
if (!ie5&&!ns6)
window.open(url,"","width=width,height=height,scrollbars=1")
else{
document.getElementById("dwindow").style.display=''
document.getElementById("dwindow").style.width=initialwidth=width+"px"
document.getElementById("dwindow").style.height=initialheight=height+"px"
document.getElementById("dwindow").style.left="30px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30+"px" : iecompattest().scrollTop*1+30+"px"
document.getElementById("cframe").src=url
}
}

function maximize(){
if (minrestore==0){
minrestore=1 //maximize window
document.getElementById("maxname").setAttribute("src","restore.gif")
document.getElementById("dwindow").style.width=ns6? window.innerWidth-20+"px" : iecompattest().clientWidth+"px"
document.getElementById("dwindow").style.height=ns6? window.innerHeight-20+"px" : iecompattest().clientHeight+"px"
}
else{
minrestore=0 //restore window
document.getElementById("maxname").setAttribute("src","max.gif")
document.getElementById("dwindow").style.width=initialwidth
document.getElementById("dwindow").style.height=initialheight
}
document.getElementById("dwindow").style.left=ns6? window.pageXOffset+"px" : iecompattest().scrollLeft+"px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset+"px" : iecompattest().scrollTop+"px"
}

function closeit(){
document.getElementById("dwindow").style.display="none"
}

function stopdrag(){
dragapproved=false;
document.getElementById("dwindow").onmousemove=null;
document.getElementById("dwindowcontent").style.display="" //extra
}


// FOR USE ON PRODUCT PAGES: 
function showContent(tab, name)
{

 selectedTab = tab;
  for(l = 0; l < tabs.length; l++)
  {
    document.getElementById(tabs[l]).style.display = (name == tabs[l]) ? 'block':'none';
    //document.getElementById("td"+tabs[l]).className = (name == tabs[l]) ? "tabLinkOn" : "tabLinkOff";
    document.getElementById("td"+tabs[l]).className = (name == tabs[l]) ? "tabOn" : "tabOff";
    document.getElementById("tdline"+tabs[l]).className = (name == tabs[l]) ? "lineOn" : "lineOff";

  }
  return false;
}


function showPSContent(tab, name)
{

 selectedTab = tab;
  for(l = 0; l < tabs.length; l++)
  {
    document.getElementById(tabs[l]).style.display = (name == tabs[l]) ? 'block':'none';
    document.getElementById("td"+tabs[l]).className = (name == tabs[l]) ? "pstabOn" : "pstabOff";
    document.getElementById("td2"+tabs[l]).className = (name == tabs[l]) ? "pstabOn" : "pstabOff";
  }
  return false;
}


var ie=document.all
var ns6=document.getElementById&&!document.all

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat" && !window.opera)? document.documentElement : document.body
}

function enlarge(which, e, tableID, position, imgwidth, imgheight){
if (ie||ns6){

crossobj = document.all ? document.all[tableID] : document.getElementById(tableID);
//crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
if (position=="center"){
pgyoffset=ns6? parseInt(pageYOffset) : parseInt(ietruebody().scrollTop)
horzpos=ns6? pageXOffset+window.innerWidth/2-imgwidth/2 : ietruebody().scrollLeft+ietruebody().clientWidth/2-imgwidth/2
vertpos=ns6? pgyoffset+window.innerHeight/2-imgheight/2 : pgyoffset+ietruebody().clientHeight/2-imgheight/2
if (window.opera && window.innerHeight) //compensate for Opera toolbar
vertpos=pgyoffset+window.innerHeight/2-imgheight/2
vertpos=Math.max(pgyoffset, vertpos)
}
else{
var horzpos=ns6? pageXOffset+e.clientX : ietruebody().scrollLeft+event.clientX
var vertpos=ns6? pageYOffset+e.clientY : ietruebody().scrollTop+event.clientY
}
//text ="Take away those final minutes in  Dallas, and the Redskins' offense has performed no better than it has in virtually every game since Gibbs returned last season. Maybe the confidence from overcoming the Cowboys will reverse this trend. Maybe Brunell is not mediocre after all. But for the offense to become more consistently good, Brunell's rebirth has to be for real. And that's doubtful"
crossobj.style.left=horzpos+"px"
crossobj.style.top=vertpos+"px"
//crossobj.innerHTML='<div align="right" id="dragbar"><span id="closetext" onClick="closepreview()">Close</span> </div><br>' + text;
crossobj.innerHTML='<div align="right" id="dragbar"><span id="closetext" onClick="closepreview()">Close</span> </div><img src="'+which+'">'
crossobj.style.visibility="visible"
return false
}
else //if NOT IE 4+ or NS 6+, simply display image in full browser window
return true
}

function closepreview(){
crossobj.style.visibility="hidden"
}

function drag_drop(e){
if (ie&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx+"px"
crossobj.style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
}
return false
}

function initializedrag(e){
if (ie&&event.srcElement.id=="dragbar"||ns6&&e.target.id=="dragbar"){
offsetx=ie? event.clientX : e.clientX
offsety=ie? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}

document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")


// Following functions used for search of products on pages:


function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function overlay(curobj, subobj){
if (document.getElementById){
var subobj=document.getElementById(subobj)
subobj.style.left=getposOffset(curobj, "left")+"px"
subobj.style.top=getposOffset(curobj, "top")+"px"
subobj.style.display="block"
return false
}
else
return true
}

function overlayclose(subobj){
document.getElementById(subobj).style.display="none"
}

/// IMAGES

function ImageExpander(oThumb, sImgSrc)
{
	// store thumbnail image and overwrite its onclick handler.
	this.oThumb = oThumb;
	this.oThumb.expander = this;
	this.oThumb.onclick = function() { this.expander.expand(); }
	
	// record original size
	this.smallWidth = oThumb.offsetWidth;
	this.smallHeight = oThumb.offsetHeight;	

	this.bExpand = true;
	this.bTicks = false;
	
	// self organized list
	if ( !window.aImageExpanders )
	{
		window.aImageExpanders = new Array();
	}
	window.aImageExpanders.push(this);

	// create the full sized image.
	this.oImg = new Image();
	this.oImg.expander = this;
	this.oImg.onload = function(){this.expander.onload();}
	this.oImg.src = sImgSrc;
}

ImageExpander.prototype.onload = function()
{
	this.oDiv = document.createElement("div");
	document.body.appendChild(this.oDiv);
	this.oDiv.appendChild(this.oImg);
	this.oDiv.style.position = "absolute";
	this.oDiv.expander = this;
	this.oDiv.onclick = function() {this.expander.toggle();};
	this.oImg.title = "Click to reduce.";
	this.bigWidth = this.oImg.width;
	this.bigHeight = this.oImg.height;
	
	if ( this.bExpand )
	{
		this.expand();
	}
	else
	{
		this.oDiv.style.visibility = "hidden";
		this.oImg.style.visibility = "hidden";
	}
}
ImageExpander.prototype.toggle = function()
{
	this.bExpand = !this.bExpand;
	if ( this.bExpand )
	{
		for ( var i in window.aImageExpanders )
			if ( window.aImageExpanders[i] !== this )
				window.aImageExpanders[i].reduce();
	}
}
ImageExpander.prototype.expand = function()
{
	// set direction of expansion.
	this.bExpand = true;

	// set all other images to reduce
	for ( var i in window.aImageExpanders )
		if ( window.aImageExpanders[i] !== this )
			window.aImageExpanders[i].reduce();

	// if not loaded, don't continue just yet
	if ( !this.oDiv ) return;
	
	// hide the thumbnail
	this.oThumb.style.visibility = "hidden";
	
	// calculate initial dimensions
	this.x = this.oThumb.offsetLeft;
	this.y = this.oThumb.offsetTop;
	this.w = this.oThumb.clientWidth;
	this.h = this.oThumb.clientHeight;
	
	this.oDiv.style.left = this.x + "px";
	this.oDiv.style.top = this.y + "px";
	this.oImg.style.width = this.w + "px";
	this.oImg.style.height = this.h + "px";
	this.oDiv.style.visibility = "visible";
	this.oImg.style.visibility = "visible";
	
	// start the animation engine.
	if ( !this.bTicks )
	{
		this.bTicks = true;
		var pThis = this;
		window.setTimeout(function(){pThis.tick();},25);	
	}
}
ImageExpander.prototype.reduce = function()
{
	// set direction of expansion.
	this.bExpand = false;
}
ImageExpander.prototype.tick = function()
{
	// calculate screen dimensions
	var cw = document.body.clientWidth;
	var ch = document.body.clientHeight;
	var cx = document.body.scrollLeft + cw / 2;
	var cy = document.body.scrollTop + ch / 2;

	// calculate target
	var tw,th,tx,ty;
	if ( this.bExpand )
	{
		tw = this.bigWidth;
		th = this.bigHeight;
		if ( tw > cw )
		{
			th *= cw / tw;
			tw = cw;
		}	
		if ( th > ch )
		{
			tw *= ch / th;
			th = ch;
		}
		tx = cx - tw / 2;
		ty = cy - th / 2; 
	}
	else
	{
		tw = this.smallWidth;
		th = this.smallHeight;
		tx = this.oThumb.offsetLeft;
		ty = this.oThumb.offsetTop;
	}	
	// move 5% closer to target
	var nHit = 0;
	var fMove = function(n,tn) 
	{
		var dn = tn - n;
		if ( Math.abs(dn) < 3 )
		{
			nHit++;
			return tn;
		}
		else
		{
			return n + dn / 10;
		}
	}
	this.x = fMove(this.x, tx);
	this.y = fMove(this.y, ty);
	this.w = fMove(this.w, tw);
	this.h = fMove(this.h, th);
	
	this.oDiv.style.left = this.x + "px";
	this.oDiv.style.top = this.y + "px";
	this.oImg.style.width = this.w + "px";
	this.oImg.style.height = this.h + "px";

	// if reducing and size/position is a match, stop the tick	
	if ( !this.bExpand && (nHit == 4) )
	{
		this.oImg.style.visibility = "hidden";
		this.oDiv.style.visibility = "hidden";
		this.oThumb.style.visibility = "visible";

		this.bTicks = false;
	}
	
	if ( this.bTicks )
	{
		var pThis = this;
		window.setTimeout(function(){pThis.tick();},25);
	}
}


//IMAGE RESIZE CODE
var xPosition = 0;
var yPosition = 0;
var isNS = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 4);

function position(elementName)
{
	Elem = document.images[elementName];
	if(!isNS)
	{
		//calculate the y position
		xPosition = eval(Elem).offsetLeft;
		tempElem = eval(Elem).offsetParent;
		while (tempElem != null) 
		{
			xPosition += tempElem.offsetLeft;
			tempElem = tempElem.offsetParent;
		}

		//calculate the y position
		yPosition = eval(Elem).offsetTop;
		tempElem = eval(Elem).offsetParent;
		while (tempElem != null) 
		{
			yPosition += tempElem.offsetTop;
			tempElem = tempElem.offsetParent;
		}

		xPosition = xPosition - ( navigator.platform == "MacPPC" ? 300 : 25 );
		yPosition = yPosition + ( navigator.platform == "MacPPC" ? -30 : 20 );
	}
	else
	{	
		xPosition = eval(Elem).x;
		yPosition = eval(imgElem).y;
	}
}

/* Show an object */
function showObject(elementName,object) 
{	
	var objLeft,objTop;

	position( elementName );
	
	width1 = eval("document.all."+elementName+".width");
	width2 = 300;
	objLeft = xPosition - (width2-width1);
	objTop = yPosition;
	//object.style.left = objLeft + 11;
	//object.style.top = objTop - 25;
	object.style.left = 25;
	object.style.top =  25;	
	object.style.borderColor = 'black';
	object.style.visibility = "visible";
}

/* Hide an object */	
function hideObject(object)
{
	object.style.visibility = "hidden";
}
	
	
// FORM ERROR CHECKING FUNCTIONS:

function WithoutContent(ss) {
if(ss.length > 0) { return false; }
return true;
}

function NoneWithContent(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].value.length > 0) { return false; }
	}
return true;
}

function NoneWithCheck(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].checked) { return false; }
	}
return true;
}

function WithoutCheck(ss) {
if(ss.checked) { return false; }
return true;
}

function WithoutSelectionValue(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].selected) {
		if(ss[i].value.length) { return false; }
		}
	}
return true;
}	

 function ToggleSearchMenu() {
   searchMenu = document.getElementById('SearchMenu');
   searchButton = document.getElementById('SearchButton');

   searchMenu.style.left = getposOffset(searchButton, "left") - 300;
   searchMenu.style.top = getposOffset(searchButton, "top") + searchButton.offsetHeight;

   if (searchMenu.style.visibility == "hidden") {
     searchMenu.style.visibility = "visible";
     searchMenu.style.display = 'block';
   } else {
     searchMenu.style.visibility = "hidden";
     searchMenu.style.display = 'none';
   }
 }

function getposOffset(what, offsettype){
 var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
 var parentEl=what.offsetParent;
 while (parentEl!=null){
   totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
   parentEl=parentEl.offsetParent;
 }
 return totaloffset;
}

// clears field for search keyword 
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}
