///////////////////////////////////////////////////////
/////////// go to prior page (history) This is a back key simulation ////////////////
function goToPriorPage()
{

	history.go(-1)
		// -1 can be a variable describing how many page to go back in history
}


///////////////////////////////////////////////////////
/////////// browserType ////////////////

function browserType()
{
	var browser=navigator.appName;
	return browser;
}

 ///////////////////////////////////////////////////////
// checkForm() is used to determine if a radio button has been checked before submit()
////////////////////////////////////////////////////////

function checkForm()
{

   if (document.getElementById("Radio1").checked == false) 
		{
     	 alert("INSERT YOUR ALERT' " );
		}
		else
		{ 
		document.getElementById("formx").submit();
		}
}


///////////////////////////////////////////////////////
// curry() 
////////////////////////////////////////////////////////
function curry() {
	
	// set func to the first parameter to this function.
	var funcName = arguments[0];

	// set argsArray to the remaining parameters to this function.
	var argsArray = [];
	for (var i = 1; i < arguments.length; ++i) {
		argsArray.push(arguments[i]);
	}

	return function() {
		funcName.apply(window, argsArray);
	}
}

///////////////////////////////////////////////////////
// changeBackground() sets CSS value"
////////////////////////////////////////////////////////

function changeBackground(id,acolor) 
{
	document.getElementById(id).style.backgroundColor = acolor;
}

///////////////////////////////////////////////////////
// changeBorderColor() 
////////////////////////////////////////////////////////

function changeBorderColor(id,acolor) 
{
	document.getElementById(id).style.borderColor = acolor;
}

///////////////////////////////////////////////////////
// changeBorder() 
////////////////////////////////////////////////////////
function changeBorder(id,aborderstyle)
{
document.getElementById(id).style.border=aborderstyle;
}

///////////////////////////////////////////////////////
// clearComments() 
////////////////////////////////////////////////////////

function clearComments(formName,id)//id is the for item name e.g.<input=text name="somename">
{
	eval('document.'+formName+'.'+id+'.value="" ');
}



///////////////////////////////////////////////////////
// changeDisplay() 
////////////////////////////////////////////////////////

function changeDisplay(id,aview)
{
	document.getElementById(id).style.display=aview;
}

///////////////////////////////////////////////////////
// changeColor() 
////////////////////////////////////////////////////////

function changeColor(id,acolor)
{
	document.getElementById(id).style.color=acolor;
}

///////////////////////////////////////////////////////
// changePosition() 
////////////////////////////////////////////////////////

function changePosition(id,topPos,leftPos)
{
	document.getElementById(id).style.top=topPos;
	document.getElementById(id).style.left=leftPos;
}


///////////////////////////////////////////////////////
// changeVisibility
////////////////////////////////////////////////////////
function changeVisibility(id,astatus) 
{
	document.getElementById(id).style.visibility = astatus; 
}


////// delayFUNCTION ///////////
var timer1;
function delayFunction(afunction,adelay,atimer) 
{
	
	timer1=setTimeout(afunction, adelay);
	//var afunction is the name of the function to be called as an argument to delayFunction()
}


//////eraseCookie()///////////
function eraseCookie(name) 
{
	createCookie(name,"",-1);
}


///////////////////////////////////////////////////////
// fontcolor()
////////////////////////////////////////////////////////

function fontColor(id,acolor) 
{
	document.getElementById(id).style.color = acolor;
}

//////////////PreLoadImages()//////////////////

function preLoadImages(imageFolder,numberOfImages)
{
	
var gImageCount=numberOfImages;
if(document.images)
	{
		img1=new Image();
		img1.src='http://www.siliconvalleytrails.com/slideshow/imageRussianRidge/13.jpg';
		img2=new Image();
		img2.src='http://www.siliconvalleytrails.com/slideshow/imageRussianRidge/10.jpg';
	}
}

////// ReadCookie()///////////
function ReadCookie(cookieName) 
{
	 var theCookie=""+document.cookie;
	 var ind=theCookie.indexOf(cookieName);
	 if (ind==-1 || cookieName=="") return ""; 
	 var ind1=theCookie.indexOf(';',ind);
	 if (ind1==-1) ind1=theCookie.length; 
	 return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}

////// SetCookie()///////////
function SetCookie(cookieName,cookieValue,nDays) 
{
	 var today = new Date();
	 var expire = new Date();
	 if (nDays==null || nDays==0) nDays=1;
	 expire.setTime(today.getTime() + 3600000*24*nDays);
	 document.cookie = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString();
}


////// setFocus()///////////

function setFocus()
{
	
	if(browserType()=='netscape'||'moxilla')
	{
	document.filterName.fName.focus();
	}
}

////// stopTimeOut ///////////
function stopTimeOut(t)
{
clearTimeout(t);
}


///////////////////////////////////////////////////////
// submitForm().
////////////////////////////////////////////////////////

function submitForm()
{
var x=document.mapForm.submit();
}




////////////									///////////////////////////
////////////									///////////////////////////
////////////  THIS SECTION (BELOW) CREATES A ROLLING BANNER  ///////////////////////////
////////////									///////////////////////////
////////////									///////////////////////////
var gImageCount;
var myimages=new Array();

////////////////////STARTROLLING BANNER///////////////////////
var showtime = null;
var gpostingsshowInterval = 3.0;

var gImages = new Array();
var imageFolder;
function startRollingBanner(imageFolder,numberOfImages)
{
	
	gImageCount=numberOfImages;
var imgs=document.getElementById('postings').src;

	for(var i = 0; i <= gImageCount; ++i)
	{	
		gImages[i] = imageFolder+"/"+(i) +  ".jpg";	
	}

		if( showtime == null )
			showtime = setInterval("nextpostings()",gpostingsshowInterval * 1000);
}

var showtime = null;
gImageCapableBrowser = canManipulateImages();
function canManipulateImages() 
{	
	if (document.images)
		return true;
	else	
		return false;
}


//////////////////LOADPOSTINGS////////////////////////////////////////
function loadpostings(imageURL) 
{		
	
		document.getElementById('postings').src=imageURL;
		
		document.getElementById('sequenceNumber').innerHTML=(gCurrentImage+1) +" of " + gImageCount;
		return false;
		show('sequenceNumber');
}

/////////////////////NEXTPOSTINGS/////////////////////////////////////
var gCurrentImage=0;
function nextpostings() 
{
	loadpostings(gImages[gCurrentImage]);	
	gCurrentImage = (gCurrentImage + 1) % gImageCount;		
}



//////////////////////////////////////////////////////
// windowSize()
winW='';
function windowSize()
{

 if (navigator.appName=="Netscape") 
	 {
		winW = window.innerWidth;
		 winH = window.innerHeight;
	}
 if (navigator.appName==("Microsoft Internet Explorer")) 
	{
		winW = document.body.offsetWidth;
		winH = document.body.offsetHeight;
	}
}





