// JavaScript Document
function get_rand(){
	var rand_no = Math.random();
	rand_no = rand_no * 1000;
	rand_no = Math.floor(rand_no);	// To Generate Random Number so that IE does not use the cached version of the View
	
	return rand_no;
}


function getContent(div, url){
	rand_no = get_rand();
	url = url+"&rand="+rand_no;
	Spry.Utils.updateContent(div, url)
}

function checkQuery(){
	var query = document.siteSearch.Query.value;
	trimQuery = query.replace(/^\s+|\s+$/g, '');
	if(trimQuery.length < 1){
		document.siteSearch.Query.value = "emptysearch";
	}
	
	submit();
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// Tab Functions
//numTabs = document.getElementById('numTabs').innerHTML ;

function toggleTabs(id) {
	numTabsq = "helloe world";
	alert(numTabsq);
}

function toggleTabs(id) {
	tabCount = document.getElementById('numTabs').childNodes[0].nodeValue;

	 for(i=1;i<=tabCount;i++){
		//alert(tabs[i].id);
		//tabs[i].id.className = "tabLeftOff";
		// Set all tabs to off
		document.getElementById('tab'+i+'Left').className = "tabLeftOff";
		document.getElementById('tab'+i+'Right').className = "tabRightOff";
		// Hide Content
		document.getElementById('tab'+i+'Contents').style.display = "none";
	}
	
	// Turn on Clicked Tab
	document.getElementById(id+'Left').className = "tabLeftOn";
	document.getElementById(id+'Right').className = "tabRightOn";
	// Show Content
	document.getElementById(id+'Contents').style.display = "block"; 
	
}





function onSelectEventDate(date){
	var pc = 1;
	//alert('show events on u this date - '+date);
	//getContent('eventsList','/show_events.html');
}

var fromX = 0;

function switchPosition(xPos) {
	if(!Spry.Effect)
		alert('No Effect');
	if (fromX >= 0) {
	fromX = 0;
	}
	xPos = xPos*-570; //this variable has to be changed depending on image size
	var fromPos = new Spry.Effect.Utils.Position();
	fromPos.x = fromX;
	fromPos.y = 0;
	
	var toPos = new Spry.Effect.Utils.Position();
	toPos.x = xPos;
	toPos.y = 0;
	
	fromX = xPos;
	
	Spry.Effect.makePositioned(document.getElementById("thumbs"));
	var move_effect = new Spry.Effect.Move("thumbs", fromPos, toPos, {duration: 300, toggle: true});
	move_effect.start();
	
	
}


