var imgPath = '/images/buttons/';
var suffix = new Array('over','out');

function preLoad() {
	if(document.images) {
		var argLen = arguments.length;
		for(var i = 0; i < argLen; i++) {
			var arg = arguments[i];
			var sufLen = suffix.length;
			for(j = 0; j < sufLen; j++) {
				var suf = suffix[j];
				self[arg + suf] = new Image();
				self[arg + suf].src = imgPath + arg + '_' + suf + '.gif';
				}
			}
		}
	}

function rollOver(imgName,imgState) {
	if (document.images) {
		document.images[imgName].src = self[imgName + imgState].src;
	}
}

function formCheck(formobj,fieldRequired,fieldDescription){
	// Dialog message
	var alertMsg = "Please complete all of the required fields. The following fields are incomplete:\n\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
			if (obj.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}

function openWin(URL) {
	var centerWidth=(screen.width/2)-(1024/2);
	var centerHeight=(screen.height/2)-(768/2);
	aWindow=window.open(URL,"composerwindow","toolbar=no,location=no,width=1024,height=768,top="+centerHeight+",left="+centerWidth+",status=no,scrollbars=yes,resize=yes,menubar=no");
}	

function openVR(URL) {
	var centerWidth=(screen.width/2)-(556/2);
	var centerHeight=(screen.height/2)-(422/2);
	aWindow=window.open(URL,"composerwindow","toolbar=no,location=no,width=556,height=422,top="+centerHeight+",left="+centerWidth+",status=no,scrollbars=no,resize=yes,menubar=no");
}

function InsertSWF(Height,Width,ID,File) {

	/*
	if ( null == Height )
		paramHeight = '';
	else
		paramHeight = 'height="'+Height+'"';
		
	if ( null == Width )
		paramWidth = '';
	else
		paramWidth = 'width="'+Width+'"';
		
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" '+paramWidth+' '+paramHeight+' id="'+ID+'" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="'+File+'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="#ffffff" />');
	document.write('<embed src="'+File+'" quality="high" bgcolor="#ffffff" width="'+Width+'" height="'+Height+'" name="'+ID+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>');
	document.write('</object>');

	*/
	
	//Get just the file name minus the .swf
	theName = File.replace('.swf','');
	if (AC_FL_RunContent == 0) {
		alert("This page requires AC_RunActiveContent.js.");
	} else {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0',
			'width', Width,
			'height', Height,
			'src', theName,
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', ID,
			'bgcolor', '#ffffff',
			'name', ID,
			'menu', 'true',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', theName,
			'salign', ''
			); //end AC code
	}

}

