function testFunction(){
	alert('HELLOOOO');
}

function mouseOver(a){
	document.getElementById("btn_"+a).src = "/images/"+a+"_btn.png";
}
function mouseOut(b){
	document.getElementById("btn_"+b).src = "/images/"+b+".png";
}


function cat_iframe(url,w,h){
	var temp = '<div align="center"><iframe src ="'+url+'" width="'+w+'" height="'+h+'">';
	temp+='<p>Your browser does not support iframes.</p>';
	temp+='</iframe></div>';
	document.getElementById("catalog_iframe").innerHTML=temp;
}


var photo_id = new Array();
var photo_description = new Array();
var photo_w = new Array();
var photo_h = new Array();
var photo_w2 = new Array();
var photo_h2 = new Array();
var cur_gal;


function next_gallery(){
	cur_gal++;
	if(cur_gal >= photo_id.length)cur_gal = 0;
	var temp = ('<a onClick="fill_popup(\''+photo_id[cur_gal]+'\','+photo_w2[cur_gal]+','+photo_h2[cur_gal]+');showPopup(\'popupcontent0\',571,415,(tempX-295),(tempY - 145));" onMouseOver="this.style.cursor=\'pointer\'">');
	temp+='<img src="/gallery/'+photo_id[cur_gal]+'" width="'+photo_w[cur_gal]+'" height="'+photo_h[cur_gal]+'" /></a><br /><h4 class="white">'+photo_description[cur_gal]+'</h4>';
	document.getElementById("gallery_photo").innerHTML = temp;
}
function previous_gallery(){
	cur_gal--;
	if(cur_gal < 0)cur_gal = (photo_id.length - 1);
	var temp = ('<a onClick="fill_popup(\''+photo_id[cur_gal]+'\','+photo_w2[cur_gal]+','+photo_h2[cur_gal]+');showPopup(\'popupcontent0\',571,415,(tempX-295),(tempY - 145));" onMouseOver="this.style.cursor=\'pointer\'">');
	temp+='<img src="/gallery/'+photo_id[cur_gal]+'" width="'+photo_w[cur_gal]+'" height="'+photo_h[cur_gal]+'" /></a><br /><h4 class="white">'+photo_description[cur_gal]+'</h4>';
	document.getElementById("gallery_photo").innerHTML = temp;
}

function fill_popup(image,w,h){
	var temp = '<div align="left"><a onMouseOver="this.style.cursor=\'pointer\'" onclick="hidePopup();"><span class="small_black">Close Window</span></a><br /><br /></div>';
	
	var width = w;
	var height = h;
	var max_w = 550;
	var max_h = 375;
	
	if(width > max_w){
		var ratio = width / max_w;
		width = width / ratio;
		height = height / ratio;
	}
	if(height > max_h){
		var ratio = height / max_h;
		width = width / ratio;
		height = height / ratio;
	}
	temp+='<div align="center"><img src="/gallery/'+image+'" width="'+width+'" /></div>';
	document.getElementById("popupcontent0").innerHTML = temp;
}
var xmlhttp;
function sendForm(contact_name,company_name,email,phone,comments){
	xmlhttp=GetXmlHttpObject();
	
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	 }
	else if(contact_name.length <= 0)alert("Please provide a valid name");
	else if(email.length <= 0)alert("Please provide a valid E-Mail address");
	else if(phone.length <= 9)alert("Please provide a valid phone number with area code");
	else {
		
		var url="/form_contact.php";
		url=url+"?contact_name="+contact_name;
		url=url+"&company_name="+company_name;
		url=url+"&email="+email;
		url=url+"&phone="+phone;
		url=url+"&comments="+comments;
		url=url+"&sid="+Math.random();
		xmlhttp.onreadystatechange=stateChanged;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
		
		
	}
}



function stateChanged(){
	if (xmlhttp.readyState==4){
		if(xmlhttp.responseText.substr(0,5) == 'NOTOK')alert(xmlhttp.responseText.substr(5));
		else document.getElementById("contact_div").innerHTML='<div class="green" align="center">'+xmlhttp.responseText+'</div>';	
	}
}






function GetXmlHttpObject(){
	if (window.XMLHttpRequest){
	  //IE7+, Firefox, Chrome, Opera, Safari
	  return new XMLHttpRequest();
	}
	if (window.ActiveXObject){
	  //IE6, IE5
	  return new ActiveXObject("Microsoft.XMLHTTP");
	 }
	return null;
}

