<!---

function closewindow(){

window.opener.location.reload();
window.close();
	
}

function popUp($url,w,h) {
   mywindow = window.open ($url,"mywindow","location=0,status=0,scrollbars=1,toolbar=0,menubar=0,titlebar=0,width=" + w + ",height=" + h + "");
  mywindow.moveTo(300,200);
  mywindow.focus();
 }
 function nav(id,state){
	srcstr = element(id).src;
	 classstr = element(id).className;
	if(state == "on" && srcstr != null){
		element(id).src = srcstr.replace('off','on');
		element(id).style.display = 'block';
		
	}
	if(state == "off" && srcstr != null){
		element(id).src = srcstr.replace('on','off');
		 
		if(classstr != "navSelected"){ 
		element(id).style.display = 'none';
		 }
	}
	 
	 
 }
 
 
 function http(field){
 field.value=field.value.replace('http://','');
 } function http(field){
 field.value=field.value.replace('http://','');
 }
 
 /*/
function popUp($url,w,h) {
	var rand = Math.random();
   mywindow = window.open($url,rand,"location=0,status=0,scrollbars=1,toolbar=0,menubar=0,titlebar=0,width=" + w + ",height=" + h + "");
  mywindow.moveTo(300,200);
 }/*/
 function element(id){
	 return document.getElementById(id);
 }
 
 
 function pdf(type,id){
	
element('niframe').src='dl2.php?type='+type+'&id='+id;


}
 
function CheckContact(theform){

var error = "";
/*//*/
error += dropdown(theform.title,"Please choose your Title");
error += isBlank(theform.name.value,"Please enter your Name");
error += isBlank(theform.surname.value,"Please enter your Surname");
error += checkEmail(theform.email.value,"Please enter a valid Email Address");
error += isEmptyNum(theform.tel.value,"Please enter a valid Phone Number");
error += isBlank(theform.comments.value,"Please enter your comments or questions");
error += isBlank(theform.security.value,"Please enter the Validation Code");

if(error != ""){ alert(error); return false; }  // else { return true; }
}

function checkListing(theform){

var error = "";
/*//*/
error += dropdown(theform.title,"Please choose your Title.");
error += isBlank(theform.name.value,"Please enter your Name.");
error += isBlank(theform.surname.value,"Please enter your Surname.");
error += checkEmail(theform.email.value,"Please enter a valid Email Address.");
error += isEmptyNum(theform.tel.value,"Please enter a valid Phone Number.");
error += isBlank(theform.address.value,"Please enter your Postal Address.");
error += isBlank(theform.establishment_address.value,"Please enter your Establishement's Address.");
error += isBlank(theform.establishment.value,"Please enter your Establishment's Name.");
error += isBlank(theform.profile.value,"Please enter a Profile of your establishment.");
error += isBlank(theform.type.value,"Please enter the Type of establishment.");
error += radio(theform.content,"Please indicate where you can provide Content.");

if(error != ""){ alert(error); return false; }  // else { return true; }
}

function checkListing2(theform){

var error = "";
/*//*/
error += dropdown(theform.title,"Please choose your Title.");
error += isBlank(theform.name.value,"Please enter your Name.");
error += isBlank(theform.surname.value,"Please enter your Surname.");
error += checkEmail(theform.email.value,"Please enter a valid Email Address.");
error += isEmptyNum(theform.tel.value,"Please enter a valid Phone Number.");
error += isBlank(theform.billing.value,"Please enter your Billing Address.");

error += isBlank(theform.establishment.value,"Please enter your Establishment's Name.");
error += isBlank(theform.address.value,"Please enter your Establishement's Address.");
error += isBlank(theform.profile.value,"Please enter a Profile of your establishment.");
error += isBlank(theform.rates.value,"Please enter a Establishments Rates.");
error += radio(theform.content,"Please indicate where you can provide Content.");
error += !theform.terms.checked ? "You must accept the Terms & Conditions" : "";

if(error != ""){ alert(error); return false; }  // else { return true; }
}



function CheckBooking(theform){

var error = "";
/*//*/
error += isBlank(theform.name.value,"Please enter your Name.");
error += isBlank(theform.surname.value,"Please enter your Last name.");
error += checkEmail(theform.email.value,"Please enter a valid Email Address.");
error += isEmptyNum(theform.tel.value,"Please enter a valid Phone Number.");
error += radio(theform.booking_type,"Please indicate whether this is an Enquiry or a Provisional Booking.");

if(error != ""){ alert(error); return false; }  // else { return true; }
}


 


function CheckApp(theform){

var error = "";
/*//*/
error += isBlank(theform.company.value,"Please enter your Company Name.");
error += dropdown(theform.title,"Please choose your Title.");
error += isBlank(theform.name.value,"Please enter your Name.");
error += isBlank(theform.surname.value,"Please enter your Surname.");
error += isBlank(theform.position.value,"Please enter your Position in the company.");
error += isEmptyNum(theform.tel.value,"Please enter a valid Phone Number");
error += checkEmail(theform.email.value,"Please enter a valid Email Address");
error += dropdown(theform.cat,"Please select you Nearest Region.");
error += isBlank(theform.country.value,"Please enter your Country.");
error += isBlank(theform.username.value,"Please enter a Username.");
error += isBlank(theform.password.value,"Please enter a Password.");
error += fieldmatch(theform.password.value,theform.password2.value,"Your passwords do no Match.");

if(error != ""){ alert(error); return false; }  // else { return true; }
}


function over(src,state){
	if(state == "on"){
	document.getElementById(src).src='images/salamanav-over_'+src+'.jpg';	
	}
	if(state == "off"){
	document.getElementById(src).src='images/salamanav_'+src+'.jpg';	
	} 
}
/*/ 
/*/
function ismaxlength(obj){

var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""

if (obj.getAttribute && obj.value.length>mlength)

obj.value=obj.value.substring(0,mlength)

}

 function http(field){
 field.value=field.value.replace('http://','');
 } function http(field){
 field.value=field.value.replace('http://','');
 }
 
 ////////////////
 
 

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
 
function isBlank(str,msg){
	var error = "";
	str = trim(str)
	if(str.length == 0){ error = msg +'\n'; }
	return error;
	}


function fieldmatch(str1,str2,msg){
	var error = "";
	if(str1 != str2){
	error = msg +'\n';
	}
	return error;

}



function checkEmail (strng,msg) {
var error="";
	if (isBlank(strng)) { error = msg + "\n"; }
	
		var emailFilter=/^.+@.+\..{2,6}$/;
		if (!(emailFilter.test(strng))) { error = msg + "\n"; }
		else {
		   var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
			 if (strng.match(illegalChars)) { error = msg + "\n"; }
		}
	return error;    
}

function isEmptyNum(strng,msg) {
var error = "";
	if (isBlank(strng)) { error = msg + "\n"; } else {
		   var illegalChars= /[\@\<\>\,\;\:\\\"\[\]]/
			 if (strng.match(illegalChars)) { error = msg + "\n"; }
		}
	return error;	  
}
function valNum(strng,msg) {
var error = "";
	if(strng.length != 0){
		   var illegalChars= /[\@\<\>\,\;\:\\\"\[\]]/
			 if (strng.match(illegalChars)) { error = msg + "\n"; }
	}
	return error;	  
}


function radio(radiobut,strng){
var error = "";
var radio_choice = false;
for (i = 0; i < radiobut.length; i++){
if (radiobut[i].checked)
radio_choice = true; 
}
if (!radio_choice){ error = ""+strng+"\n"; }
return error; }

function dropdown(menu,strng){
var error = "";
 if ( menu.selectedIndex == 0 )
    {
        error = strng+" \n";
        valid = false;
    }
	return error; }
	


function toggleLayer(whichLayer){
if (document.getElementById) {
	// this is the way the standards work
	var style2 = document.getElementById(whichLayer).style;
	style2.display = style2.display? "":"block";
}
else if (document.all){
	// this is the way old msie versions work
	var style2 = document.all[whichLayer].style;
	style2.display = style2.display? "":"block";
} else if (document.layers) {
	// this is the way nn4 works
	var style2 = document.layers[whichLayer].style;
	style2.display = style2.display? "":"block"; }
}

function dropother(menu,layer){
 if ( menu.selectedIndex == 1 ){
 	toggleLayer(layer); } else { 	
	if(document.getElementById(layer).style.display == "block"){
 	toggleLayer(layer); } }

}
function strMatch(f1,f2,msg){
var error = "";
 if (f1 != f2){
	 error = msg+"\n";
	 }

}

function cleantext(field,text){
	//text = text.toLowerCase;
	text = text.replace(/([^a-z^0-9^-]+)/g,"");
	element(field).value = text;
}

function complpic(field,pic){
	strsrc = element(pic).src;
	if(element(field).value && element(field).value != "0" && trim(element(field).value) != ""){
		element(pic).src = strsrc.replace('c1','c3');
	} else {
		element(pic).src = strsrc.replace('c3','c1');
	}
}

checked = false;
      function checkAll (form,type) {
		  element('loading').style.display='block';
		  _this = form; _thisa = type;
		  setTimeout("checkAll2(_this,_thisa)",1000);
		  setTimeout("element('loading').style.display='none'",1500);
		  
	  }
      function checkAll2 (form,type) {
		if (checked == false){checked = true}else{checked = false}
		for (var i = 0; i < document.getElementById(form).elements.length; i++) {
		str = document.getElementById(form).elements[i].id;
		if(str.match(type)){
		document.getElementById(form).elements[i].checked = checked;
				   }
		if(type == "exp"){
			cntChecked(form,type,"checkedexp");
		} else {cntChecked(form,type,"checkedact"); } 
				   
	}

      }
	  
function cntChecked(form,type){
	cnt = 0;
	for (var i = 0; i < document.getElementById(form).elements.length; i++) {
	  str = document.getElementById(form).elements[i].id;
	  if(str.match(type) && document.getElementById(form).elements[i].checked){ cnt++;   } }
	  return cnt;  
	
}

function complchox(form,type,value,pic){
	strsrc = element(pic).src;
	checked = cntChecked(form,type);
	if(checked >= value){
		element(pic).src = strsrc.replace('c1','c3');
	} else { 
		element(pic).src = strsrc.replace('c3','c1');
	}
	
}


function openclose(id){
	
	if(element(id).className=='closed'){ 
	
	element(id).className='open'; 
	element(id+'link').innerHTML='-'; 
	
	} else { 
	
	element(id).className='closed'; 
	element(id+'link').innerHTML='+'; 

}
	
}


function convertDecimalToMin(latt,lon) { 
        /* 
                Input:  GPoint Or GLatLng 
                Output: String with Latitude & Longitude in Degree Minute Second 
Compass format 
        */ 
        var lat = latt; 
        var lng = lon;  
        var dirLat; 
        var dirLng; 
        if (lat > 0) { 
                dirLat = "North"; 
        } 
        else { 
                dirLat = "South"; 
                lat = lat * -1; 
        } 
        if (lng > 0) { 
                dirLng = "East"; 
        } 
        else { 
                dirLng = "West"; 
                lng = lng * -1; 
        } 


        var degLat = parseInt(lat);                     // use 
        var degLng = parseInt(lng);                     // use 
        var decLat = lat - degLat; 
        var decLng = lng - degLng; 
        var dmnLat = 60 * decLat; 
        var dmnLng = 60 * decLng; 
        var minLat = parseInt(dmnLat);          // use 
        var minLng = parseInt(dmnLng);          // use 
        var dscLat = dmnLat - minLat; 
        var dscLng = dmnLng - minLng; 
        var secLat = parseInt(60 * dscLat);     // use 
        var secLng = parseInt(60 * dscLng);     // use 
        var sDeg = "<strong>Latitude</strong> " + degLat + "&#176; " + minLat + "' " + secLat 
+ "\" " + dirLat + "<br /><strong>Longitude</strong> " + degLng + "&#176; " + minLng + "' " 
+ secLng + "\" " + dirLng; 
        return sDeg; 



} 

/*//*/

-->
