// JavaScript Document
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->




function lcpscroll(url, name, width, height,scroll) {
   winSet = "toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,resizable=no";
   winSet += ",width="+width +",height="+height+",left="+(screen.availWidth-width)/2+",top="+(screen.availHeight-height)/2;
   mypopwnd = window.open(url, name, winSet);
   mypopwnd.focus();
  }
//------------------------------------------------------------------------------------------------
function lcp(url, name, width, height) {
   lcpscroll(url, name, width, height,"yes");
  }
//------------------------------------------------------------------------------------------------
function isEmail(field,message)
	{
	var email=field.value;
	
	if (email.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		return true;
	else
		{
		alert(message);
		field.focus();
		return false;
		}
	}
//-------------------------------------------------------------------------------
function trimAll(sString)
	{
	while (sString.substring(0,1) == ' ')
		{
		sString = sString.substring(1, sString.length);
		}
	while (sString.substring(sString.length-1, sString.length) == ' ')
		{
		sString = sString.substring(0,sString.length-1);
		}
	return sString;
	}
//-------------------------------------------------------------------------------
function isFieldEmpty(field,message)
	{
	var str = trimAll(field.value);
	if(str.length==0)
		{
		alert(message);
		field.focus();
		return true;
		}
	else return false;
	}
//-------------------------------------------------------------------------------
function CheckFF(rform)
	{
	if (isFieldEmpty(rform.f_Name,form_Name)) return false;
	if (isFieldEmpty(rform.f_Email,form_Email)) return false;
	if (rform.f_Email.value.length!=0 && !isEmail(rform.f_Email,form_Email_wrong)) return false;
	if (isFieldEmpty(rform.f_CMessage,form_Message)) return false;

	return true;
	}
//-------------------------------------------------------------------------------
function CheckContactF(rform)
	{
	if (isFieldEmpty(rform.f_Name,form_Name)) return false;
	if (isFieldEmpty(rform.f_Email,form_Email)) return false;
	if (rform.f_Email.value.length!=0 && !isEmail(rform.f_Email,form_Email_wrong)) return false;

	if (isFieldEmpty(rform.f_CSubject,form_Subject)) return false;
	if (isFieldEmpty(rform.f_CMessage,form_Message)) return false;

	if (isFieldEmpty(rform.vImageCodP,form_Code)) return false;

	return true;
	}
//-------------------------------------------------------------------------------
function ControlRegisterCustomer(rform)
	{
	if (isFieldEmpty(rform.f_Forename,'Forename is required')) return false;
	if (isFieldEmpty(rform.f_Surname,'Surname is required')) return false;
	if (isFieldEmpty(rform.f_Email,form_Email)) return false;
	if (rform.f_Email.value.length!=0 && !isEmail(rform.f_Email,form_Email_wrong)) return false;

	if (isFieldEmpty(rform.f_Passwd,form_Password)) return false;
	
	if (!rform.TermsA.checked) { alert(form_terms_wrong); return false; }

	if (isFieldEmpty(rform.vImageCodP,form_Code)) return false;

	return true;
	}


//------------------------------------------------------------------------------------------------
function CheckRequestBubleForm(rform)
	{
	if (isFieldEmpty(rform.f_Company,"Name of Organisation is required")) return false;
	if (isFieldEmpty(rform.f_Address1,"Address is required")) return false;

	if (isFieldEmpty(rform.f_Phone,"Telephone is required")) return false;


	if (isFieldEmpty(rform.f_Name,"Contact name is required")) return false;
	if (isFieldEmpty(rform.f_Email,form_Email)) return false;
	if (rform.f_Email.value.length!=0 && !isEmail(rform.f_Email,form_Email_wrong)) return false;
	if (isFieldEmpty(rform.f_DescriptionB,"Description for bubble window is required")) return false;

	if (isFieldEmpty(rform.vImageCodP,form_Code)) return false;

	return true;
	}
//-------------------------------------------------------------------------------
function AskDeleteConfirmation()
	{
	return confirm('By clicking Ok you will delete this record. Are You Sure?');
	}


//-------------------------------------------------------------------------------
	function HideBanners()
		{
		if(window.innerWidth) windowWidth=window.innerWidth;
		else if(document.documentElement && document.documentElement.clientWidth) windowWidth=document.documentElement.clientWidth;
		else if(document.body) windowWidth=document.body.offsetWidth;
		//alert (windowWidth);
		if(windowWidth<=1200) {
			document.getElementById("SkyscraperBannerLeft").style.display = 'none';
			document.getElementById("SkyscraperBannerRight").style.display = 'none';
			}
		if(windowWidth>1200) {
			document.getElementById("SkyscraperBannerLeft").style.display='';
			document.getElementById("SkyscraperBannerRight").style.display='';
			}
		}
//-------------------------------------------------------------------------------


function fixPNG(element)
{
	if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent))
	{
		var src;
		if (element.tagName=='IMG')
		{
			if (/\.png$/.test(element.src))
			{
				src = element.src;
				element.src = "/data/images/spacer.gif";
			}
		}
		else
		{
			src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i)
			if (src)
			{
				src = src[1];
				element.runtimeStyle.backgroundImage="none";
			}
		}
			if (src) 
				element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
	}
}



	function ShowAdditFields(idd){
		var box = document.getElementById(idd);
		var objl = document.getElementById('a_'+idd);
		
		if(box.style.display=="none") {
			box.style.display = "block";
			objl.innerHTML = '<img src="/themes/default/images/ico_hide.gif" alt="" width="20" height="19" border="0" align="top" />';
			}
		else {
			box.style.display = "none";
			objl.innerHTML = '<img src="/themes/default/images/ico_more.gif" alt="" width="20" height="19" border="0" align="top" />';
			}

		return true;
		}


	function disable_drop(dd) {
		$("div").click(function () {
		 if(dd == 'monthly') {
		 	$("#"+dd).attr({ disabled: "disabled" });
		 	$("#weekly").removeAttr("disabled");
			}
		else {
		 	$("#"+dd).attr({ disabled: "disabled" });
		 	$("#monthly").removeAttr("disabled");
			}
		 // var color = $(this)..css("color","red");;
		});

		}

	function getCats(val) {
		//alert (val);
		$('#poicats').load('/getPOIgrouped.php?ID=' + val);
		}
		

  function get_object(id) {
   var object = null;
   if( document.layers ) {   
    object = document.layers[id];
   } else if( document.all ) {
    object = document.all[id];
   } else if( document.getElementById ) {
    object = document.getElementById(id);
   }
   return object;
  }

function do_uncheckall()
	{
	$("#poi_str").val('');
	$("form[name='tourism_social'] :checkbox").attr("checked", false);
	$("span").attr({ 
          style: "cursor:pointer"
         });
	}
function do_uncheckallh()
	{
	//$("#poi_str").val('');
	$("form[name='the_history'] :checkbox").attr("checked", false);
	$("span").attr({ 
          style: "cursor:pointer"
         });
	}

	function getCatsH(val) {
		//alert (val);
		$('#hcats').load('/getHistory__Grouped.php?ID=' + val);
		}
