// JavaScript Document
$(document).ready(function(){
	$('#tabs').tabs();	
});

function checkVal()
{
	var val = document.getElementById("search").value;
	if(val == '')
	{
		alert("Enter keyword.");
		return false;
	}
}

var xmlHttp;
function setViewed(id)
{
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null){
		alert("Browser does not support HTTP Request/AJAX, uprade to latest version of your browser");
		return;
	}
	var url = "ajax.setView.php?id="+id+"&num="+(Math.floor(Math.random()*20));
	/*xmlHttp.onreadystatechange=updateStat;*/
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function showImage(gal_id)
{
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null){
		alert("Browser does not support HTTP Request/AJAX, uprade to latest version of your browser");
		return;
	}
	var url = "ajax.showBusGallery.php?id="+gal_id+"&num="+(Math.floor(Math.random()*20));
	xmlHttp.onreadystatechange=changeImage;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function changeImage()
{
	if(xmlHttp.readyState==4) document.getElementById("fullImg").innerHTML = xmlHttp.responseText;
	if(xmlHttp.readyState==1) document.getElementById("fullImg").innerHTML = "<div style='padding-top:180px; text-align:center;'><img src='web_images/loading5.gif' width='41' height='39'><br>Loading..</div>";
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try{ xmlHttp=new XMLHttpRequest(); } //Firefox, Opera 8.0+, Safari
	catch(e){//Internet Explorer versions
		try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }
		catch(e){ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }
	}
	return xmlHttp;
}

function showContact(id)
{
/*	window.open("<?php echo $includesDir?>contactform.php?id="+id, "form", "width=700, height=550");*/
	window.open("includes/contactform.php?id="+id, "form", "width=700, height=550");
}
