// JavaScript Document
if(navigator.userAgent.indexOf("Safari") > -1) var isSafari = true;

function safariAdjust(){
	if(isSafari){ 
		getObj("content").style.background = "#000000";	
		getObj("content").style.display = "none";	
		getObj("content").style.display = "";	
	}
}

//alert("isSafari = "+isSafari);
function insertFlash(swf, width, height, bgcolor, area){
	//if(isSafari && bgcolor==undefined) bgcolor="#000000";
	var flash = '<object ';
	flash += '	classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
	flash += '	codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ';
	flash += '	width="'+width+'" ';
	flash += '	height="'+height+'" ';
	flash += '	align="middle">';
	flash += '	<param name="allowScriptAccess" value="sameDomain" />';
	flash += '	<param name="movie" value="'+swf+'" />';
	flash += '	<param name="quality" value="high" />';
	if(bgcolor) flash += '	<param name="bgcolor" value="'+bgcolor+'" />';
	else {
		flash += '	<param name="wmode" value="transparent" />';
		flash += '	<param name="scale" value="noscale" />';
	}
	//if(isSafari) flash += '<param name="wmode" value="opaque" />';
	flash += '	<embed ';
	flash += '		src="'+swf+'" ';
	flash += '		quality="high" ';
	if(bgcolor) flash += '		bgcolor="'+bgcolor+'" ';
	else {
		flash += '		wmode="transparent" ';
		flash += '		scale="noscale" ';
	}
	//if(isSafari) flash += '		wmode="opaque" ';
	flash += '		width="'+width+'" ';
	flash += '		height="'+height+'" ';
	flash += '		align="middle" ';
	flash += '		allowScriptAccess="sameDomain" ';
	flash += '		type="application/x-shockwave-flash" ';
	flash += '		pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	flash += '</object>';	
	//alert(flash);
	if(area) getObj(area).innerHTML = flash;
	else document.write(flash);
}

function popUp(url, title, width, height, scrollbars){
	var x = (self.screen.width-width)/2;
	var y = (self.screen.height-height)/2;
	if(scrollbars) var myScroll = scrollbars;
	else var myScroll = "no";
	window.open(url,title,'left='+x+',top='+y+',screenx='+x+',resizable=0, status=0,toolbar=0, screeny='+y+',scrollbars='+myScroll+',width='+width+',height='+height);
}

function getObj(obj){
	return document.getElementById(obj);
}

function swapClass(myID, myClass){
	getObj(myID).className = myClass;	
}

function changeImg(myImg,mySRC){
	getObj(myImg).src=mySRC;
}

function changePage(url){
	location.href = url;
}

function validateForm(formName,respondDiv){
	// This function will cause all form fields of formName that have a title attributes to be required
	var myForm = getObj(formName);
	for(i=0;i<myForm.length;i++){
		if(myForm[i].value == "" && myForm[i].title){ 
			alert("Please provide your "+myForm[i].title);
			return false;
		}
	}
	return true;
}

function setDivPosition(myObj,myX,myY){
	getObj(myObj).style.left = myX+"px";
	getObj(myObj).style.top = myY+"px";
}