﻿// Site Java Scripts
	function fInputStyle_focusout(input, value){
		if(input.value=="" || input.value==value){	
			input.value=value;
		}
	}
	
	function fInputStyle_focusin(input, value){
		if(input.value==value){	
			input.value="";
		}
	}
	
	function fInputFunction_SubmitOnEnter(oForm){
		if (window.event.keyCode == 13){
			document.getElementById(oForm).submit(); 
		}
	}
	
	

function jsf_EmbedFlashObjectx(sElement, sFlashPath, sFlashID, lWidth, lHeight, sAlignment, sBackgroundColor, sFlashVariables) {
//This function creates an external reference to a flash object - fixes the 'click to active' in IE
var sBaseURL="";
	 var oElement = document.getElementById(sElement);
	oElement.innerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="' + lWidth + '" height="' + lHeight + '" id="' + sFlashID + '" name="' + sFlashID + '"> '
		+ '<param name="movie" value="' + sFlashPath + '">'
		+ '<param name="allowscriptaccess" value="always">'
		+ '<param name="salign" value="' + sAlignment + '">'
		+ '<param name="play" value="true">'
		+ '<param name="loop" value="false">'
		+ '<param name="menu" value="false">'
		+ '<param name="quality" value="autohigh">'
		+ '<param name="scale" value="noscale">'
		+ '<param name="bgcolor" value="' + sBackgroundColor + '"> '
		+ '<param name="wmode" value="transparent">'
		+ '<param name="base" value="' + sBaseURL + '">'
		+ '<param name="flashvars" value="' + sFlashVariables + '">'
		+ '<param name="type" value="application/x-shockwave-flash"> '
			+ '<embed width="' + lWidth + '" height="' + lHeight + '" src="' + sFlashPath + '" pluginspace="https://www.macromedia.com/go/getflashplayer" ' 
				+ 'id="' + sFlashID + '" name="' + sFlashID + '" allowscriptaccess="always" salign="' + sAlignment + '" play="true" loop="false" menu="false" '
				+ 'quality="autohigh" scale="exactfit" bgcolor="' + sBackgroundColor + '" wmode="transparent" base="' + sBaseURL + '" flashvars="' + sFlashVariables + '" '
				+ 'type="application/x-shockwave-flash" '
			+ '</embed> '
		+ '</object>' ;
	document.close();
}


function jsf_executeFunction_AutoUpdater(sElementId, sURL, sContainer) {
//this function posts the specified form to the specified url and posts the fragment back to the container
var postData=sURL, postBuffer, oForm;

	oForm=document.getElementById(cs_Form(sElementId).id)

	if(oForm) { postBuffer=$(oForm).serialize(); } else { postBuffer=''; }
	postBuffer=cs_appendString(postBuffer, 'postback='+sElementId, '&')

	new Ajax.Updater(sContainer, postData, {
		method: 'post',
		parameters: postBuffer,
		evalScripts: true, 
		asynchronous: true
	} );

}

function jsf_executeFunction_UpdateFragment(oForm, sURL, sContainer) {
//this function posts the specified form to the specified url and posts the fragment back to the container
var postData=sURL, postBuffer;

if (oForm) {
	postBuffer=$(oForm).serialize(); } else { postBuffer=''; }	
	new Ajax.Updater(sContainer, postData, {
		method: 'post',
		parameters: postBuffer,
		evalScripts: true
	} );
}


function jsf_element_showhide() {
	var i,p,v,obj,args=jsf_element_showhide.arguments;
	for (i=0; i<(args.length-2); i+=3)
	with (document) if (getElementById && ((obj=getElementById(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 jsf_element_scroll_up(sElement, lAmount) {
	document.getElementById(sElement).scrollTop = document.getElementById(sElement).scrollTop-lAmount;
}
  
function jsf_element_scroll_down(sElement, lAmount) {
	document.getElementById(sElement).scrollTop = document.getElementById(sElement).scrollTop+lAmount;
}
	
function jsf_element_update(sElement, lValue) {
	document.getElementById(sElement).value = lValue;
}




function jsf_NewWindow(sPage, sName, lWidth, lHeight, bScroll, bResizable, bLocationBar, bDirectories, bStatusBar, bMenuBar, bToolBar){
	var win=null;
	var sSettings
	
	if(lWidth!=null||lHeight!=null){
		var lLeftPosition=(screen.width)?(screen.width-lWidth)/2:100;
		var lTopPosition=(screen.height)?(screen.height-lHeight)/2:100;
		sSettings='width='+lWidth+',height='+lHeight+',top='+lTopPosition+',left='+lLeftPosition+',';
	};
	
	if(bScroll==true){bScroll='yes'}else{bScroll='no'};
	if(bResizable==true){bResizable='yes'}else{bResizable='no'};
	if(bLocationBar==true){bLocationBar='yes'}else{bLocationBar='no'};
	if(bDirectories==true){bDirectories='yes'}else{bDirectories='no'};
	if(bStatusBar==true){bStatusBar='yes'}else{bStatusBar='no'};
	if(bMenuBar==true){bMenuBar='yes'}else{bMenuBar='no'};
	if(bToolBar==true){bToolBar='yes'}else{bToolBar='no'};
	

	sSettings=sSettings+'scrollbars='+bScroll+',location='+bLocationBar+',directories='+bDirectories+',status='+bStatusBar+',menubar='+bMenuBar+',toolbar='+bToolBar+',resizable='+bResizable+'';
	win=window.open(sPage,sName,sSettings);
};



function fHello() {
	alert('hello');
}



//this function colapses an object
function cs_HideElement_Basic(sObject) { var oObject=document.getElementById(sObject); oObject.style.display='none'; }

//this function expands an object
function cs_ShowElement_Basic(sObject) { var oObject=document.getElementById(sObject); oObject.style.display='block';}
