
/* Use to open a custom brower window (pop-up);
 * Example:
 * MM_openBrWindow('http://www.google.com', 'myWindow',
 *                  'toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,
 *                  width=500,height=500')"
 * */
function openWindow(theURL, winName, features) {
    window.open(theURL, winName, features)
}

function reloadOpener(closeWin) {
    window.opener.location = window.opener.location;
    if (closeWin == true) window.close();
}


/* Macromedia Dreamweaver functions.
 * Example of use:
 * onmouseover="MM_swapImage('imgName','','imgSrc_over.gif',1)" 
 * onmouseout="MM_swapImgRestore()"
 * */
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_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_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;
}

/* This function will write out html for a
 * flash movie if the user has the correct version of flash.
 * If not it will write the html for an image.
 * */
function writeFlash(width, height, flashSrc, bgColor, version, filePath, imageSrc, imageAlt, hasFlash) {
    if (hasFlash) {
        var html = "";
        html += "<object ";
        html += "classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" ";
        html += "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" + version + ",0,0,0\" ";
        html += "width=\"" + width + "\" ";
        html += "height=\"" + height + "\"> ";
        html += "<param name=\"movie\" value=\"" + filePath + "/" + flashSrc + "\" /> ";
        html += "<param name=\"quality\" value=\"high\" /> ";
        html += "<param name=\"bgcolor\" value=\"" + bgColor + "\" /> ";
        html += "<embed src=\"" + filePath + "/" + flashSrc + "\" ";
        html += "quality=\"high\" ";
        html += "bgcolor=\"#FFCE0B\" ";
        html += "width=\"" + width + "\" ";
        html += "height=\"" + height + "\" ";
        html += "type=\"application/x-shockwave-flash\" ";
        html += "pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"> ";
        html += "</embed> ";
        html += "</object> ";
        document.writeln(html);
    }
    else {
        document.writeln("<img src=\"" + filePath + "/" + imageSrc + "\" width=\""+width+"\" height=\""+height+"\" border=\"0\" alt=\""+imageAlt+"\" />");
    }
}

function newImage(arg) {				
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		campaign_over = newImage("images/campaign_over.gif");
		template_over = newImage("images/template_over.gif");
		page_over = newImage("images/page_over.gif");
		export_over = newImage("images/export_over.gif");
		preloadFlag = true;
	}
}

function GoToAnchor(anchorName) {
    if (document.layers) {
        x = document.anchors[anchorName].y;
        y = document.anchors[anchorName].y;
        window.scrollTo(x, y);
    }
    if (document.all) {
        document.all[anchorName].scrollIntoView();
    }
}