function ValidateContactForm (form) { // Used in Give us your feedback page (pageid=5&ctype=bm)
  //var title = form.title.value;   
  var fullname = form.fullname.value;   
  var email = form.email.value;   
  var mobile_phone = form.mobile_phone.value;   
  //var home_phone = form.home_phone.value;   
  //var work_phone = form.work_phone.value;   
  //var address = form.address.value;   
  //var town_city = form.town_city.value;   
  //var postcode = form.postcode.value;   
  //var country = form.country.value;
  //var first_area = form.first_area.value;
  //var property_type = form.property_type.value;
	
  /*if (!title)	{
    alert("You must select your title.");
    return false;
	} else */if (!fullname)	{
		alert("You must enter your name.");
		return false;
	} else if (!email) {
		alert("You must enter your email.");
		return false;
	} else if ((email.indexOf('@') == -1) || (email.indexOf('.') == -1)) {
		alert("Wrong email format.");
		return false;
	} else if ((!mobile_phone) /*&& (!home_phone) && (!work_phone)*/) {
		//alert("You must at least enter one phone number.");
		alert("You must enter your mobile phone number.");
		return false;
	/*} else if (!address)	{
		alert("You must enter your address.");
		return false;
	} else if (!town_city)	{
		alert("You must enter your town / city.");
		return false;
	} else if (!postcode)	{
		alert("You must enter your postal code.");
		return false;
	} else if (!country)	{
		alert("You must select your country.");
		return false;
	} else if (!first_area)	{
		alert("You must select your 1st choice area.");
		return false;
	} else if (!property_type)	{
		alert("You must select type of property.");
		return false;
	*/} else {
		return true;
	}
}
function ValidateLinkToUsForm (form) { // Used in Give us your feedback page (pageid=5&ctype=bm)
  var site_name = form.site_name.value;   
  var url = form.url.value;   
  var email = form.email.value; 
	var link_url =  form.link_url.value; 
  if (!site_name)	{
    alert("You must enter your site name.");
    return false;
	} else if (!url)	{
		alert("You must enter your URL.");
		return false;
	} else if (!email)	{
		alert("You must enter your email.");
		return false;
	} else if ((email.indexOf('@') == -1) || (email.indexOf('.') == -1)) {
		alert("Wrong email format.");
		return false;
	} else if (!link_url)	{
		alert("You must enter URL of page you have added our site.");
		return false;
	} else {
		return true;
	}
}
function ValidateContactFormOLD (form) { // Used in Give us your feedback page (pageid=5&ctype=bm)
  var fullname = form.fullname.value;   
  var phone = form.phone.value;   
  var enquiry = form.enquiry.value;   
  if (!fullname)	{
    alert("You must enter your full name.");
    return false;
	} else if (!phone)	{
		alert("You must enter your telephone no.");
		return false;
	} else if (!enquiry)	{
		alert("You must enter your enquiry.");
		return false;
	} else {
		return true;
	}
}
function ValidateCallBackForm (form) { // Used in Give us your feedback page (pageid=5&ctype=bm)
  var fullname = form.fullname.value;   
  var phone = form.phone.value;   
  if (!fullname)	{
    alert("You must enter your full name.");
    return false;
	} else if (!phone)	{
		alert("You must enter your telephone no.");
		return false;
	} else {
		return true;
	}
}
function ValidatePropertyEnquiryForm (form) { // Used in Give us your feedback page (pageid=5&ctype=bm)
  var fullname = form.fullname.value;   
  var email = form.email.value;   
  var phone = form.phone.value;   
  if (!fullname)	{
    alert("You must enter your full name.");
    return false;
	} else if (!email)	{
		alert("You must enter your email.");
		return false;
	} else if ((email.indexOf('@') == -1) || (email.indexOf('.') == -1)) {
		alert("Wrong email format.");
		return false;
	} else {
		return true;
	}
}
function showMap() {
	w_width = 640;
	w_height = 400;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=no,scrollbars=no';

	fparam = 'showmap.html';
  window.showMapWindow = open(fparam, 'showMapWindow', theWindowParam);
	setTimeout('if(showMapWindow&&!showMapWindow.closed)showMapWindow.focus()',100);
}
function showContact() {
	w_width = 640;
	w_height = 400;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=no,scrollbars=no';

	fparam = 'showcontact.html';
  window.showContactWindow = open(fparam, 'showContactWindow', theWindowParam);
	setTimeout('if(showContactWindow&&!showContactWindow.closed)showContactWindow.focus()',100);
}

function printPage(theLang, sefUrlStatus, parseParams) {
	fileLocation = '';
	if (sefUrlStatus!='Y') {
	  lochref = '' + this.location;
	} else {
	  lochref = '' + parseParams;
		fileLocation = '/';
	}

	if (lochref.indexOf('?') > 0) {
		lochref = '?' + lochref.substring((lochref.indexOf('?')) + 1);
		if (lochref.match('lang=') != null) {
			langPos = lochref.indexOf('lang=');
			lochref = lochref.substring(0,(langPos-1))+lochref.substring((langPos-1)+8);
		}
		lochref += '&lang=' + theLang;
	} else {
		lochref = '';
		lochref += '?lang=' + theLang;
	}

	w_width = 595;
	w_height = 500;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=no,scrollbars=yes';

	fparam = fileLocation+'print.php'+lochref;
  window.showPrintWindow = open(fparam, 'showPrintWindow', theWindowParam);
	setTimeout('if(showPrintWindow&&!showPrintWindow.closed)showPrintWindow.focus()',100);
}
function emailPage(theLang, sefUrlStatus, parseParams) {
	
	fileLocation = '';
	if (sefUrlStatus!='Y') {
	  lochref = '' + this.location;
	} else {
	  lochref = '' + parseParams;
		fileLocation = '/';
	}

	if (lochref.indexOf('?') > 0) {
		lochref = '?' + lochref.substring((lochref.indexOf('?')) + 1);
		if (lochref.match('lang=') != null) {
			langPos = lochref.indexOf('lang=');
			lochref = lochref.substring(0,(langPos-1))+lochref.substring((langPos-1)+8);
		}
		lochref += '&lang=' + theLang;
	} else {
		lochref = '';
		lochref += '?lang=' + theLang;
	}

	w_width = 420;
	w_height = 300;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=no,scrollbars=yes';

	fparam = fileLocation+'tools/emailpage/index.php'+lochref;
  window.showEmailWindow = open(fparam, 'showEmailWindow', theWindowParam);
	setTimeout('if(showEmailWindow&&!showEmailWindow.closed)showEmailWindow.focus()',100);
}
function currencyConverter() {
	w_width = 605;
	w_height = 300;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',scrollbars=yes,resizable=yes';

	fparam = 'http://www.mecklai.com/mecklai/currencyconvertercd.asp';
  window.showCurrencyConverterWindow = open(fparam, 'showCurrencyConverterWindow', theWindowParam);
	setTimeout('if(showCurrencyConverterWindow&&!showCurrencyConverterWindow.closed)showCurrencyConverterWindow.focus()',100);
}
function popupWindow (theWindow, theParam) {

//	newLeft = screen.width
//	newTop = screen.height
	switch (theWindow)
	{
		case 'newmenu':
			window.open('menuform.php?'+theParam, 'NewMenu', 'toolbar=no,status=no,scrollbars=yes,resizable=yes,location=no,menubar=no,directories=no,width=500,height=500,left=50,top=50');
		break
		case 'editmenu':
			window.open('menuform.php?'+theParam, 'EditMenu', 'toolbar=no,status=no,scrollbars=yes,resizable=yes,location=no,menubar=no,directories=no,width=500,height=500,left=50,top=50');
		break
		default:
			return;
	}
}
function changeLangAlert(theLang) {
	alert('The '+theLang+' language is not published yet. Please check back soon.');
}

function changeLang(theLang, sefUrlStatus, theRequestURI) {
	fileLocation = '';
	if (sefUrlStatus!='Y') {
	  lochref = '' + this.location;
	} else {
	  lochref = '' + theRequestURI;
		fileLocation = '';
	}

	if (lochref.indexOf('?') > 0) {
		lochref = '?' + lochref.substring((lochref.indexOf('?')) + 1);
		if (lochref.match('lang=') != null) {
			langPos = lochref.indexOf('lang=');
			lochref = lochref.substring(0,(langPos-1))+lochref.substring((langPos-1)+8);
		}
		if ((lochref.match('page') != null)||(lochref.match('search') != null)||(lochref.match('filter') != null)) {
			lochref += '&lang=' + theLang;
		} else {
			lochref += '?lang=' + theLang;
		}
	} else {
		lochref = '';
		lochref += '?lang=' + theLang;
	}

	lochref = fileLocation+lochref;

	location = lochref;
}
function goToSearch(theform,thePageTitle,sefUrlStatus) {
	fileLocation = '';
	if (sefUrlStatus!='Y') {
		fileLocation = '';
	} else {
		fileLocation = '/';
	}

  var theSearchQuery = theform.searchquery.value;

	if (sefUrlStatus!='Y') {
		lochref = 'index.php?pageaction=search&searchquery=' + theSearchQuery;
	} else {
	  lochref = fileLocation+thePageTitle+'/pageaction-search/?searchquery='+theSearchQuery;
	}

	location = lochref;
}

function goToSitemap(sefUrlStatus) {
	fileLocation = '';
	if (sefUrlStatus!='Y') {
		fileLocation = '';
	} else {
		fileLocation = '/';
	}

	if (sefUrlStatus!='Y') {
		lochref = 'index.php?pageaction=sitemap';
	} else {
	  lochref = fileLocation+'Sitemap'+'/pageaction-sitemap/';
	}

	location = lochref;

}
function GotoInterestesPage(select,sefUrlStatus) {
	fileLocation = '';
	if (sefUrlStatus!='Y') {
		fileLocation = '';
	} else {
		fileLocation = '/';
	}

	var theInterestPageId = select.options[select.selectedIndex].value;
  if ((theInterestPageId != '')||(theInterestPageId != 0)) {
		if (sefUrlStatus!='Y') {
			lochref = theInterestPageId;
		} else {
			lochref = fileLocation+theInterestPageId;
		}
		location = lochref;
	}
	
} 



//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

