var remote = null;

/*

	Show a new window

	n: window name

	u: url

	w: width

	h: height

*/
function show_div(whichLayer,show)
{ 
 var elem, vis; 
 if( document.getElementById )  // this is the way the standards work 
    elem = document.getElementById( whichLayer ); 
 else if( document.all ) // this is the way old msie versions work
     elem = document.all[whichLayer]; 
  else if( document.layers ) // this is the way nn4 works    
    elem = document.layers[whichLayer];  
    vis = elem.style;  // if the style.display value is blank we try to figure it out here  

    if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
          vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none'; 
  
 if (show)
  vis.display = 'block';
 else 
  vis.display = 'none';
//     vis.display = (vis.display==''||vis.display=='none')?'block':'block';
}
// return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

// set the radio button with the given value as being checked
// do nothing if there are no radio buttons
// if the given value does not exist, all the radio buttons
// are reset to unchecked
function setCheckedValue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}

function doprint()
{
  //alert(divid);
  //show_div(divid,false);
  window.print();
}
function ShowWindow(n,u,w,h)
{
	args="width="+w+",height="+h+",titlebar=no,menubar=no,toolbar=no,directories=no,resizable=yes,scrollbars=yes,status=0";
	remote=window.open(u,n,args);
	if (remote != null)
	{
	    if (remote.opener == null)
	    		remote.opener =self;
		window.name='MyWindow';
		remote.location.href=u;
	}
	remote.focus();
}
/*
	open url
*/
function open_url(aurl,m,w,h)
{
	var currTime= new Date();
	var newurl=aurl;
	/* Open in the same window */

	if (m==0)
	{
		// window.open(newurl,"_self");
		self.location.href = newurl;
	}

	else
	{
		/* Open in the a new window */

		ShowWindow('windowname1',newurl,w,h);	
	}

}
function change_language(aurl,m)
{

    var obj = document.getElementById("id_lang");  
		var selIndex = obj.selectedIndex;
    var newurl = aurl + '&language=' + obj.options[selIndex].value;
  
    self.location.href = newurl;
}

function show_map(s_name,s_address,phone,fax,email)
{
 // alert(s_address + " - " + phone+ " - " +fax+ " - " +email);
  var newurl="/show_map.php?s_name=" + s_name + "&s_address=" + s_address + "&s_phone=" + phone + "&s_fax=" + fax+ "&s_email=" + email;
 //alert(newurl);
 	ShowWindow('windowname1',newurl,"1000","1000");   
}


