function menuOn(ref)
{
	var menuref = document.getElementById(ref);
	menuref.className='menuon';
}
function menuOff(ref)
{
	var menuref = document.getElementById(ref);
	menuref.className='menuoff';
}

function sideMenuOn(ref,mid)
{
	var menuref = document.getElementById(ref);
	menuref.className='sidemenu sidemenu_select';
}
function sideMenuOff(ref,mid)
{
	var menuref = document.getElementById(ref);
	menuref.className=mid;
}

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_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 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];}}
}



// ----------------------------------------------
// StyleSwitcher functions written by Paul Sowden
// http://www.idontsmoke.co.uk/ss/
// - - - - - - - - - - - - - - - - - - - - - - -
// For the details, visit ALA:
// http://www.alistapart.com/stories/alternate/

function setActiveStyleSheet(title) 
{
	var i, a, main;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) 
	{
		//alert(a.getAttribute("rel").indexOf("style"));
		//alert(a.getAttribute("title"));
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) 
		{
			a.disabled = true;
			if(a.getAttribute("title") == title) 
				a.disabled = false;
		}
	}
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
  }
  return null;
}
function SetCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

function addtocart(productID,targetURL)
{
	document.location.href = 'fnc_add_item_to_cart.php?productID='+productID+'&qty=1&targetURL='+targetURL;
}

function openForums()
{
	newPWindow('fnc_forums.php','Forums',980,600,1,1,1,1,1,1);
}

function newPWindow(url,name,width,height,toolbar,location,status,scrollbars,resizable,menubar,left,top,customprops)
{
	if(width)
	{ } else
	{
		width=screen.width-15;	
		height=screen.height-80;
		left=1;
		top=1;
	}
	if (left==-1 && top==-1)
	{
		ax = (screen.width-width)/2;
		ay = (screen.height-height)/2;
		left = ax;
		top = ay;
	}
	var props="";
	if(width)props+=",width="+width;
	if(height)props+=",height="+height;
	if(toolbar)props+=",toolbar="+toolbar;
	if(location)props+=",location="+location;
	if(status)props+=",status="+status;
	if(scrollbars)props+=",scrollbars="+scrollbars;
	if(resizable)props+=",resizable="+resizable;
	if(menubar)props+=",menubar="+menubar;
	if(left)props+=",screenX="+left+",left="+left;
	if(top)props+=",screenY="+top+",top="+top;
	if(customprops)props+=","+customprops;
	if(props!="")props=props.substring(1);
	var w=window.open(url,name,props);
	w.focus();
	return w;
}

function showAlert(msg)
{
	document.getElementById('textAlertArea').innerHTML = msg;
	//document.getElementById('textAlertArea').style.display='block';
	
	jQuery("#textAlertArea").fadeIn("fast");
	
	//document.getElementById('fadedArea').style.display='block';
}
function hideAlert()
{
	document.getElementById('textAlertArea').innerHTML = "";
	document.getElementById('textAlertArea').style.display='none';
	//document.getElementById('fadedArea').style.display='none';
}



