function search_site()
{
	var str=document.srchform.keyword.value;
	if (str == '' || str.length < 3) {
		alert('Please enter a valid keyword to search! \nKeywords must contain atleast 3 characters.');
	} else {
		window.location = "search.php?key=" + str;
	}
}

function map_popup()
{
	window.open("map.htm","main","menubar=0,toolbar=0,location=0,directories=0,status=0,copyhistory=0,width=732,height=670");
}

function pic_popup(name)
{
	window.open("building.php?id="+name,"main","menubar=0,toolbar=0,location=0,directories=0,status=0,copyhistory=0,width=702,height=550");
}


function print_page()
{
	if ((p_page == 'home')) {
	alert('This page is not printable.\nIf you still wish to print this page, you can print it by selecting file -> print in your browser menu.'); 
	}
	else 
	{
	window.open("printpage.php?file="+p_page+".php","main","menubar=0,toolbar=0,location=0,directories=0,status=0,copyhistory=0,scroll=0,scrollbars=1,width=630,height=600");
	}
}

function quickjump()
{

var where_to=document.jump.jump_to.value;
var letter = 'a';

if (where_to == 1) { letter = 'a'; }
if (where_to == 2) { letter = 'b'; }
if (where_to == 3) { letter = 'c'; }
if (where_to == 4) { letter = 'd'; }
if (where_to == 5) { letter = 'e'; }
if (where_to == 6) { letter = 'f'; }

window.location = '#j' + letter;

}

function validcheck()
{

var v_title=document.contact.ntitle.value;
var v_fname=document.contact.fname.value;
var v_lname=document.contact.lname.value;
var v_org=document.contact.orgname.value
var v_addr1=document.contact.addr1.value;
var v_addr2=document.contact.addr2.value;
var v_city = document.contact.city.value;
var v_postcode = document.contact.postcode.value;
var v_country = document.contact.country.value;
var v_email = document.contact.email.value;
var v_tel = document.contact.tel.value;
var v_fax = document.contact.fax.value;
var v_mobile = document.contact.mobile.value;
var v_web = document.contact.web.value;
var v_other = document.contact.other_info.value;
var add_text = "";
var ok_to_send = true;

if (v_fname=="")
{
        alert("First name is missing! Please fill the necessary information.");
        document.contact.fname.focus();
        ok_to_send = false;
}

if ((v_lname=="") && (ok_to_send))
{
        alert("Last name is missing! Please fill the necessary information.");
        document.contact.lname.focus();
        ok_to_send = false;
}

if ((v_org=="") && (ok_to_send))
{
        alert("Organization name is missing! Please fill the necessary information.");
        document.contact.orgname.focus();
        ok_to_send = false;
}

if ((v_addr1=="") && (ok_to_send))
{
        alert("Address is missing! Please fill the necessary information.");
        document.contact.addr1.focus();
        ok_to_send = false;
}

if ((v_city=="") && (ok_to_send))
{
        alert("City is missing! Please fill the necessary information.");
        document.contact.city.focus();
        ok_to_send = false;
}

if ((v_country=="") && (ok_to_send))
{
        alert("Country is missing! Please fill the necessary information.");
        document.contact.country.focus();
        ok_to_send = false;
}


if((v_email=="") && (ok_to_send))
{
        alert("E-mail is missing! Please fill the necessary information.");
        document.contact.email.focus();
        ok_to_send = false;
}

if ((v_email.indexOf("@", 0) < 0) && (ok_to_send))
{
	  alert("Please enter a valid E-Mail!");
      document.contact.email.focus();
      ok_to_send = false;
}

if((v_tel=="" && ok_to_send))
{
        alert("Phone number is missing! Please fill the necessary information.");
        document.contact.tel.focus()
        ok_to_send = false;
}

if (ok_to_send) {

send_txt = "<br />The visitor submitted the following details through your web-site (www.pma-power.com): <br /><br /> <b>Visitor Name:</b>  ";

if (v_title == 1) { send_txt = send_txt + "Mr. "; }
if (v_title == 2) { send_txt = send_txt + "Ms. "; }
if (v_title == 3) { send_txt = send_txt + "Prof. "; }
if (v_title == 4) { send_txt = send_txt + "Dr. "; }

send_txt = send_txt + v_fname + " " + v_lname + ".<br />";

send_txt = send_txt + "<b>Organization:</b> " + v_org + "<br />";

send_txt = send_txt + "<b>Address (PART 1):</b> " + v_addr1 + "<br />";
send_txt = send_txt + "<b>Address (PART 2):</b> " + v_addr2 + "<br />";

send_txt = send_txt + "<b>City:</b> " + v_city + "<br />";
send_txt = send_txt + "<b>Post Code:</b> " + v_postcode + "<br />";
send_txt = send_txt + "<b>Country:</b> " + v_country + "<br />";

send_txt = send_txt + "<b>E-Mail address:</b> " + v_email + "<br />";
send_txt = send_txt + "<b>Phone number:</b> " + v_tel + "<br />";
send_txt = send_txt + "<b>Fax number:</b> " + v_fax + "<br />";

send_txt = send_txt + "<b>Mobile-Phone number:</b> " + v_mobile + "<br />";
send_txt = send_txt + "<b>Web-site Address:</b> " + v_web + "<br /><br />";

if (document.contact.check1.checked) add_text = add_text + "* Transformers <br />";
if (document.contact.check2.checked) add_text = add_text + "* AC Input power supplies<br />";
if (document.contact.check3.checked) add_text = add_text + "* DC Input power supplies<br />";
if (document.contact.check4.checked) add_text = add_text + "* Telecom power systems<br />";
if (document.contact.check5.checked) add_text = add_text + "* Military product <br />";
if (document.contact.check6.checked) add_text = add_text + "* Input filters <br />";

if (add_text) send_txt = send_txt + "<b>The visitor showed interest in the following fields:</b> <br />" + add_text;
if (v_other) send_txt = send_txt + "<br /> <b>The visitor wanted to add the following details:</b> <br />" + v_other;

send_txt = send_txt + "<br /><br /><hr />End of visitor details.";

window.location = "sendmail.php?body=" + send_txt;

}

}

