function My_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=My_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function My_swapImage() { //v3.0
  var i,j=0,x,a=My_swapImage.arguments; document.My_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=My_findObj(a[i]))!=null){document.My_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function My_swapImgRestore() { //v3.0
  var i,x,a=document.My_sr,args=My_swapImgRestore.arguments; if(args.length > 0 && args[0] == args[1]) return; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function My_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.My_p) d.My_p=new Array();
    var i,j=d.My_p.length,a=My_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.My_p[j]=new Image; d.My_p[j++].src=a[i];}}
}
function popupWindow(asset,style)
{
	var leftVal=(screen.width / 2) - 425;
	var topVal = (screen.height / 2) - 300;
	var width = 794;
	var height = 596;

	if (style == 'external') {
		document.popWin = window.open(asset, 'COSPopup','height=700,width=950,location=yes,scrollbars=yes,menubars=yes,toolbars=yes,resizable=yes,status=yes,left=0,top=0');
	} else if (style == 'externalwide') {
		document.popWin = window.open(asset, 'COSPopup','height=700,width=1100,location=yes,scrollbars=yes,menubars=yes,toolbars=yes,resizable=yes,status=yes,left=0,top=0');
	} else if (style == 'main') {
		if(navigator.userAgent.indexOf('MSIE 5') != -1 && navigator.userAgent.indexOf('Mac_PowerPC') != -1) {
			//Mac IE 5
			width = 765;
		} else if(navigator.userAgent.indexOf('Safari/51') != -1 || navigator.userAgent.indexOf('Safari/74') != -1 || navigator.userAgent.indexOf('Safari/85') != -1 || navigator.userAgent.indexOf('Safari/100') != -1 || navigator.userAgent.indexOf('Safari/125') != -1) {
			//Older Safari
			width = 788;
		}
		document.popWin = window.open(asset, 'COSIntro','height='+height+',width='+width+',location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=no,status=no,left='+leftVal+',top='+topVal+'');
	} else if (style == 'internal') {
		document.popWin = window.open(asset, 'COSPopup','height=580,width=791,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=no,status=no,left='+leftVal+',top='+topVal+'');
	} else if (style == 'pdf') { 
		if (navigator.userAgent.indexOf('Safari/51') != -1 || navigator.userAgent.indexOf('Safari/74') != -1 || navigator.userAgent.indexOf('Safari/85') != -1 || navigator.userAgent.indexOf('Safari/100') != -1 || navigator.userAgent.indexOf('Safari/125') != -1) {
			//Safari 1
			document.location = asset;
		} else if(navigator.userAgent.indexOf('Safari') != -1) {
			//Safari 2 (i hope)
			document.popWin = window.open(asset, 'COSPopup','height=600,width=800,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes,status=no,left=0,top=0');
		} else if(navigator.userAgent.indexOf('Mac_PowerPC') != -1 && navigator.userAgent.indexOf('MSIE 5.2') != -1) {
			//Mac IE 5
			document.location = asset;
		} else if(navigator.userAgent.indexOf('Mac') != -1 && navigator.userAgent.indexOf('Firefox') != -1) {
			//Opera
			width = 808;
		} else if(navigator.userAgent.indexOf('Opera') != -1) {
			//Opera
			document.location = asset;
		} else {
			//Other
			document.popWin = window.open(asset, 'COSPopup','height=600,width=800,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes,status=no,left=0,top=0');
		}
	}
	document.popWin.focus();
}
function popFortune() {
	alert("Your fortune will come true.");
}
