// This script is copyright 2008 by MapClicks.com. Use of this script or linking to it is forbiden. 
    
function handleNoFlash(errorCode) {
  if (errorCode == FLASH_UNAVAILABLE) {
	alert("Error: Flash doesn't appear to be supported by your browser");
	return;
  }
}

function popup(url) 
{
 params  = 'width='+screen.width;
 params += ', height='+screen.height;
 params += ', top=0, left=0';
 params += ', fullscreen=no';

 newwin=window.open(url,'windowname4', params);
 if (window.focus) {newwin.focus()}
 return false;
}

function popitup(url) {
	newwindow=window.open(url,'flashmap','height=600,width=768,scrollbars=no,top=50,left=50,resizable=yes,');
	if (window.focus) {newwindow.focus()}
	return false;
}


function openWindow(anchor, options) {

	var args = '';

	if (typeof(options) == 'undefined') { var options = new Object(); }
	if (typeof(options.name) == 'undefined') { options.name = 'win' + Math.round(Math.random()*100000); }

	if (typeof(options.height) != 'undefined' && typeof(options.fullscreen) == 'undefined') {
		args += "height=" + options.height + ",";
	}

	if (typeof(options.width) != 'undefined' && typeof(options.fullscreen) == 'undefined') {
		args += "width=" + options.width + ",";
	}

	if (typeof(options.fullscreen) != 'undefined') {
		args += "width=" + screen.availWidth + ",";
		args += "height=" + screen.availHeight + ",";
	}

	if (typeof(options.center) == 'undefined') {
		options.x = 0;
		options.y = 0;
		args += "screenx=" + options.x + ",";
		args += "screeny=" + options.y + ",";
		args += "left=" + options.x + ",";
		args += "top=" + options.y + ",";
	}

	if (typeof(options.center) != 'undefined' && typeof(options.fullscreen) == 'undefined') {
		options.y=Math.floor((screen.availHeight-(options.height || screen.height))/2)-(screen.height-screen.availHeight);
		options.x=Math.floor((screen.availWidth-(options.width || screen.width))/2)-(screen.width-screen.availWidth);
		args += "screenx=" + options.x + ",";
		args += "screeny=" + options.y + ",";
		args += "left=" + options.x + ",";
		args += "top=" + options.y + ",";
	}

	if (typeof(options.scrollbars) != 'undefined') { args += "scrollbars=1,"; }
	if (typeof(options.menubar) != 'undefined') { args += "menubar=1,"; }
	if (typeof(options.locationbar) != 'undefined') { args += "location=0,"; }
	if (typeof(options.resizable) != 'undefined') { args += "resizable=1,"; }

	var win = window.open(anchor, options.name, args);
	return false;

}



function videopop(url) {
	newwindow=window.open(url,'popup','height=370,width=368,scrollbars=no,top=250,left=250,resizable=yes,statusbar=no');
	if (window.focus) {newwindow.focus()}
	return false;
}

function slidepop(url) {
	newwindow=window.open(url,'popup','height=370,width=355,scrollbars=no,top=250,left=250,resizable=yes,statusbar=no');
	if (window.focus) {newwindow.focus()}
	return false;
}


function showdiv2() {
	if (document.getElementById) { // DOM3 = IE5, NS6
	document.getElementById('sendtophone').style.display = 'block';
}
else {
	if (document.layers) { // Netscape 4
	document.sendtophone.display = 'block';
}
else { // IE 4
	document.all.sendtophone.style.display = 'block';
	}
}
}


function hidediv2() {
	if (document.getElementById) { // DOM3 = IE5, NS6
	document.getElementById('sendtophone').style.display = 'none';
}
else {
	if (document.layers) { // Netscape 4
	document.sendtophone.display = 'none';
}
else { // IE 4
	document.all.sendtophone.style.display = 'none';
	}
}
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location=\""+selObj.options[selObj.selectedIndex].value+"\"");
  if (restore) selObj.selectedIndex=0;
}

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_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}


function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
	thisfield.value = "";
	}
}

function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
	thisfield.value = defaulttext;
	}
}

// iPHONE DETECTION AND REDIRECT SCRIPT //
// if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)))
// {
// location.href='http://www.mapclicks.com/mobile/';
// }

