// Prototypes

//evalua una variable, indicando si esta inicializada
function isset(testvar){
	if (typeof nombreVariable == "undefined"){
		return false;
	}else{
		return true;
	}
}

function V(mydiv){
	document.getElementById(mydiv).style.visibility="visible"; 
}

function CT(mydiv,text){
	document.getElementById(mydiv).innerHTML=text; 
}

function O(mydiv){
	document.getElementById(mydiv).style.visibility="hidden"; 
}

/*function SM(msgtitle, msgbody){
	//muestra el mensaje
	document.getElementById('msgHead').innerHTML=msgtitle;
	document.getElementById('msgbody').innerHTML=msgbody;
	V('b1');
	V('b2');
}*/

function Ch_Opacity(value, valueDiv){
	if (esp_load != null){
		var temp= document.getElementById(value).style.left.replace("px","");
		var res = roundNumber((1 * (parseInt(temp) -8)) / 219,2);
		document.getElementById(valueDiv).innerHTML=  res;
		esp_load.getOpacity = function() {return res;}
		google_changeLayer(4);
	}else{
		alert("Seleccione alguna especie antes de utilizar estas utilidades")	
	}
}

function Ch_Opacity_value(v, vv, value){
	if (esp_load != null){
		document.getElementById(v).style.left= 219* value + "px";
		document.getElementById(vv).innerHTML= value;
		esp_load.getOpacity = function() {return value;}
		google_changeLayer(4);
	}else{
		alert("Seleccione alguna especie antes de utilizar estas utilidades")	
	}
}

function roundNumber(rnum, rlength) { 
  var newnumber = Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);
  return newnumber;
}

function openLegend(){
	V('legend');
	O('LegendMini');
}

function hideLegend(){
	O('legend');
	V('LegendMini');
}

function showMessage(msgtitle, msgbody, errno){
	
	
	
	if (errno==0){
		//alert("0");
		document.getElementById('msgboxImage').style.background='url(http://admin.micodata.es/MicodataSIG/img/cross.png)';
		
	}else{
		//alert("1");
		document.getElementById('msgboxImage').style.background='url(http://admin.micodata.es/MicodataSIG/img/advice.png)';
	}
	
	var isIE6 = navigator.userAgent.toLowerCase().indexOf('msie 6') != -1;
	if (isIE6==true){
			document.getElementById('msgboxImage').style.behavior= 'url(fx-iepngfix.htc)';	
	}
	
	CT('msgboxbody', msgbody);
	CT('msgboxTitle', msgtitle);
	
	V('b1');
	V('msgbox');
}

function popitupMET() {
	newwindow=window.open(MyPath + 'includes/includesHTML/method.html','','height=560,width=545');
	if (window.focus) {newwindow.focus()}
}

function popitupFEED() {
	newwindow=window.open(MyPath + 'includes/includesHTML/feedback.html','','width=394,height=458');
	if (window.focus) {newwindow.focus()}
}




