function AddToBookmarks (url,title) 
{ 
window.external.AddFavorite(url,title); 
}  

function clearDefault(el) {
	if (el.defaultValue==el.value) el.value = ""
}

function restoreDefault(el) {
	if (el.value == "") el.value = el.defaultValue
}

function closeWindow()
{
	//var browserName = navigator.appName;
	//var browserVer = parseInt(navigator.appVersion);
	var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;  

    if (ie7) 
	{    
        //This method is required to close a window without any prompt for IE7
		window.open('','_parent','');
		window.close();
    }
    else 
	{
		//This method is required to close a window without any prompt for IE6
		this.focus();
		self.opener = this;
		self.close();
	}
}

function toggleElement(element)
{
	if(document.getElementById(element).style.display!='')
	{
		document.getElementById(element).style.display='';
	}
	else
	{
		document.getElementById(element).style.display='none';
	}
}


function toggleT(_w, _d)
{
	if (document.all) 
	{ // is IE
		if (eval("document.all."+_w+".style.display == 'none'"))
		{
			eval("document.all."+_w+".style.display='inline';");
			eval("document.all."+_w+"_img.src='/images/minimise.gif';")
		}
		else 
		{
			eval("document.all."+_w+".style.display='none';");
			eval("document.all."+_w+"_img.src='/images/expand.gif';")
		}
	}
	else if(document.getElementById(_w)){ // is firefox? 
		elem = document.getElementById(_w);
		img = document.getElementById(_w+"_img")
		if (elem.style.display=='none')
		{
			elem.style.display=_d;
			img.src='/images/minimise.gif';
		}
		else 
		{
			elem.style.display='none';
			img.src='/images/expand.gif';
		}
	}
	else { // is NS? 
		if (eval("document.layers['"+_w+"'].display=='none';"))
		{
			eval("document.layers['"+_w+"'].display='inline';")
			eval("document.layers['"+_w+"_img'].src='/images/maximise.gif';")
		}
		else 
		{
			eval("document.layers['"+_w+"'].display='none';")
			eval("document.layers['"+_w+"_img'].src='/images/maximise.gif';")
		}
	}
}

function showLoader()
{
		document.getElementById("loading").style.display="block";
		document.getElementById("loading_con").style.display="block";
}

function confirmAction(message, url)
{
	if (confirm(message)) 
	{
		document.location = url;
	}
}

function lookup(inputString) {
	jQuery('#region').show( "slow" ).css( "font-weight", "bold" ).html("<option>loading...</option>");
	jQuery.get("/index.php", {type:"ajaxGetRegionSelectList", region:"ajax", id:""+inputString+""}, function(regionData){
		if(regionData.length >0) {
			jQuery('#region').html(regionData);
			jQuery('#region').css( "font-weight", "normal" );
		}
	});
	jQuery('#propertyName').show( "slow" ).css( "font-weight", "bold" ).html("<option>loading...</option>");
	jQuery.get("/index.php", {type:"ajaxGetPropertySelectList", region:"ajax", id:""+inputString+""}, function(data){
	if(data.length >0) {
		jQuery('#propertyName').html(data);
		jQuery('#propertyName').css( "font-weight", "normal" ) ;
	}});
}
function lookupProperties(inputString) {
	jQuery('#propertyName').css( "font-weight", "bold" ).html("<option>loading...</option>");
	if(inputString == 0)
	{
		country_id=jQuery('#country').attr('value');
		jQuery.get("/index.php", {type:"ajaxGetPropertySelectList", region:"ajax", id:""+country_id+"", s:"country"}, function(data){
		if(data.length >0) {
			jQuery('#propertyName').html(data);
			jQuery('#propertyName').css( "font-weight", "normal" ) ;
		}});
	}
	else
	{
		jQuery.get("/index.php", {type:"ajaxGetPropertySelectList", region:"ajax", id:""+inputString+"", s:"region"}, function(data){
		if(data.length >0) {
			jQuery('#propertyName').html(data);
			jQuery('#propertyName').css( "font-weight", "normal" ) ;
		}});
	}
}
function lookupPropertyOfMonth(inputString, n, type) {
	jQuery('#selectedProperty').show( "slow" ).css( "font-weight", "bold" ).html("<option>loading...</option>");
	
	jQuery.get("/index.php", {type:"ajaxGetPropertyOfMonth", region:"ajax", id:""+inputString+"", n:""+n+"", s:""+type+""}, function(data){
	jQuery('#selectedProperty').hide("slow");
	if(data.length >0) {
		jQuery('#selectedProperty').html(data).css( "font-weight", "normal" ).show( "slow" );
	}});
	
}
function updateCommentStatus(inputString, name) {
	var bits=name.split("_"); 
	var id=bits[1];
	jQuery('#modOps_'+id).show( "slow" ).css( "font-weight", "bold" ).html("<option>updating comment status...</option>");
	
	jQuery.get("/index.php", {type:"ajaxUpdateCommentStatus", region:"ajax", id:""+id+"", s:""+inputString+""}, function(data){
	jQuery('#modOps_'+id).hide("slow");
	if(data.length >0) {
		jQuery('#modOps_'+id).html(data).css( "font-weight", "normal" ).show( "slow" );
	}});
	
}

function lookup_town(inputString) {
	jQuery('#town').html("<option>loading...</option>").css( "font-weight", "bold" );
	jQuery.get("/index.php", {type:"ajaxGetTownSelectList", region:"ajax", id:""+inputString+""}, function(regionData){
		if(regionData.length >0) {
			jQuery('#town').html(regionData);
			jQuery('#town').css( "font-weight", "normal" );
		}
	});
}