function crossBrowserCSS(param) {
  var prefix = location.protocol + '//' + location.host + '/layout/siteCSS/'

  if (navigator.appVersion.indexOf("Mac")!=-1) {
    if (param=='main') {
      document.write("<link href='" + prefix + "print/mac_print-v2.css' rel='stylesheet' type='text/css' media='print' />");
      document.write("<link href='" + prefix + "mac_styles-v2.css' rel='stylesheet' type='text/css' media='screen' />");
    } else {
      document.write("<link href='" + prefix + "print/mac_pages_print-v2.css' rel='stylesheet' type='text/css' media='print' />");
      document.write("<link href='" + prefix + "mac_styles_pages-v2.css' rel='stylesheet' type='text/css' media='screen' />");
    }
  } else {
    if (param=='main') {
      document.write("<link href='" + prefix + "print/styles_print-v2.css' rel='stylesheet' type='text/css' media='print' />");
      document.write("<link href='" + prefix + "styles-v2.css' rel='stylesheet' type='text/css' media='screen' />");
    } else {
      document.write("<link href='" + prefix + "print/styles_pages_print-v2.css' rel='stylesheet' type='text/css' media='print' />");
      document.write("<link href='" + prefix + "styles_pages-v2.css' rel='stylesheet' type='text/css' media='screen' />");
    }
  }
}

/**
 * MM.js functions
 */

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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

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

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


/**
 * Enlarge/Dim fonts
 * Used in support.faq
 */

var defaultTypeSize = 5;
var typeSize = defaultTypeSize;
var minTypeSize = 3;
var maxTypeSize = 7;
var typeID;

var specialTags = new Array();
specialTags[0] = "font";
specialTags[1] = "span";


function enlargeType() {
  if (typeSize < maxTypeSize) {
    typeSize += 1;
    typeID = document.getElementById('size');
  typeID.className = 'typeSize' + typeSize;
  
  for(x=0;x<specialTags.length;x++) {
    sTags = typeID.getElementsByTagName(specialTags[x]);
    for(i=0;i<sTags.length;i++) {
      sTags[i].className = 'typeSize' + typeSize;
    }
  }
  }
}

function dimType() {
  if (typeSize > minTypeSize) {
    typeSize -= 1;
    typeID = document.getElementById('size');
    typeID.className = 'typeSize' + typeSize;
    for(x=0;x<specialTags.length;x++) {
      sTags = typeID.getElementsByTagName(specialTags[x]);
      for(i=0;i<sTags.length;i++) {
        sTags[i].className = 'typeSize' + typeSize;
      }
    }
  }
}


/**
 *
 */

function antispam(name,domain) {
  document.location = 'mailto:' + name + '@' + domain;
}


/**
 * Check Browser
 */

var its;
var browserName = '';
var browserNameLong = '';
var browserNew = '';
var preloadFlag = false;
var Macintosh = navigator.userAgent.indexOf('Mac')>0;

function its() {
  var n = navigator;
  var ua = ' ' + n.userAgent.toLowerCase();
  var pl = n.platform.toLowerCase();
  var an = n.appName.toLowerCase();

  this.version = n.appVersion;
  this.nn = ua.indexOf('mozilla') > 0;

  if(ua.indexOf('compatible') > 0) {
    this.nn = false;
  }
  
  this.opera = ua.indexOf('opera') > 0;
  this.ie = ua.indexOf('msie') > 0;
  this.major = parseInt( this.version );
  this.minor = parseFloat( this.version );

  this.mac = ua.indexOf('mac') > 0;
  this.win = ua.indexOf('win') > 0;

  if(this.ie) {
    if(ua.indexOf("msie 5") > 1) {
      var msieIndex = navigator.appVersion.indexOf("MSIE") + 5;
      this.major = parseFloat(navigator.appVersion.substr(msieIndex,3));
    }
  }

  return this;
}

function browserNaming() {
  its = new its();

  if (!document.getElementById) {
    browserNew = false;
  }
  else {
    browserNew = true;
  }
  if (its.opera) {
    browserName = "Opera";
  }
  else if (its.ie) {
    browserName = "IE";
  }
  else {
    browserName = "NS";
  }

  browserNameLong = browserName + its.major;
}




// This script will test up to the following version.
var flash_versions = 10;
// Initialize variables and arrays
var flash = new Object();
flash.installed = false;
flash.version = '0.0';
// Dig through Netscape-compatible plug-ins first.
if(navigator.plugins && navigator.plugins.length) {
  for(var x=0; x<navigator.plugins.length; x++) {
    if(navigator.plugins[x].name.indexOf('Shockwave Flash') != -1) {
      flash.version = navigator.plugins[x].description.split('Shockwave Flash ')[1];
      flash.installed = true;
      break;
    }
  }
// Then, dig through ActiveX-style plug-ins afterwords
} else if(window.ActiveXObject) {
  for(x=2; x<=flash_versions; x++) {
    try {
      oFlash = eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash." + x + "');");
      if(oFlash) {
        flash.installed = true;
        flash.version = x + '.0';
      }
    }
    catch(e) {}
  }
}
// Create sniffing variables in the following style: flash.ver[x]
flash.ver = Array();
for(var i=4; i<=flash_versions; i++)
  flash.ver[i] = (flash.installed && parseInt(flash.version) >= i);

/******************
 * Write SWF Code *
 ******************/
function writeSWFCode(swfSrc, swfWidth, swfHeight, wmode, flashVars) {
  var writeString = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + swfWidth + '" height="' + swfHeight + '">';
  writeString += '<param name="movie" value="' + swfSrc + '" />';
  if(wmode != null) writeString += '<param name="wmode" value="' + wmode + '" />';
  if(flashVars != null) writeString += '<param name="flashvars" value="' + flashVars + '" />';
  writeString += '<param name="quality" value="high" />';
  writeString += '<param name="showmenu" value="false" />';
  writeString += '<embed src="' + swfSrc + '" quality="high" showmenu="false" ';
  if(wmode != null) writeString += 'wmode="' + wmode + '" ';
  if(flashVars != null) writeString += 'flashvars="' + flashVars + '" ';
  writeString += 'pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + swfWidth + '" height="' + swfHeight + '"></embed>';
  writeString += '</object>';
  document.write(writeString);
  delete writeString;
}

function writeFlash(fId,swfLoc,flashVars,width,height) {
  var bgcolor = null;
  document.writeln('<object id="'+fId+'" align="bottom" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+width+'" height="'+height+'">');
  document.writeln('<param name="allowScriptAccess" value="always"/>');
  document.writeln('<param name="movie" value="'+swfLoc+'"/>');
  document.writeln('<param name="data" value="'+swfLoc+'"/>');
  document.writeln('<param name="quality" value="high"/>');
  document.writeln('<param name="salign" value="lt" />');
  document.writeln('<param name="wmode" value="transparent">');
  document.writeln('<param name="bgcolor" value="#3f4447" />');
  document.writeln('<param name="FlashVars" value="'+flashVars+'"/>');
  document.writeln('<embed name="'+fId+'" src="'+swfLoc+'" FlashVars="'+flashVars+'" bgcolor="'+bgcolor+'" align="top" salign="lt" wmode="transparent" allowScriptAccess="always" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" vspace="0" hspace="0"></embed>');
  document.writeln('</object>');
}



/* get, set, and delete cookies */
function getCookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}
	
function setCookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name+"="+escape( value ) +
		( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) + //expires.toGMTString()
		( ( path ) ? ";path=" + path : "" ) +
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}
	
function deleteCookie( name, path, domain ) {
	if ( getCookie( name ) ) document.cookie = name + "=" +
			( ( path ) ? ";path=" + path : "") +
			( ( domain ) ? ";domain=" + domain : "" ) +
			";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

