.3/* Validate contact form Fields */
function form_contacto() {
	var validation_result;
	validation_result = validar_form_contacto();
	if(validation_result==''){
		document.forms[0].submit();
	}else{
		alert(validation_result);
	}
}

function validar_form_contacto(){
	var frm = document.forms[0];
	var sMessage = '';
	if(frm.contact_name.value==''){
		// nombre
		sMessage = 'Es necesario indicar su nombre';
	}else if(frm.contact_lastname.value==''){
		// apellido
		sMessage='Indique su apellido';
	}else if(frm.contact_email.value==''){
		// email
		sMessage='Favor, indiquenos su email';
	}
	return sMessage;
}
/* End of contact validation */

/*  To launch any Pop up Windows    */
function openCenteredWindow(mypage,myname,w,h,features) {
if(screen.width){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2 - 150;
}else{winl = 0;wint =0;}
if (winl < 0) winl = 0;
if (wint < 0) wint = 0;
var settings = 'height=' + h + ',';
settings += 'width=' + w + ',';
settings += 'top=' + wint + ',';
settings += 'left=' + winl + ',';
settings += features;
win = window.open(mypage,myname,settings);
win.window.focus();
}

/* To launch Products PopUp in self window */
/**************************************************************/
function openCenteredWindowP(mypage,myname,w,h,features) {
if(screen.width){
var winl = (screen.width-w)/2;
var wint = ((screen.height-h)/2) - 150; /* resta del screen */ 
}else{winl = 0;wint =0;}
if (winl < 0) winl = 0;
if (wint < 0) wint = 0;
var settings = 'height=' + h + ',';
settings += 'width=' + w + ',';
settings += 'top=' + wint + ',';
settings += 'left=' + winl + ',';
settings += features;

nuevo_win = window.open(mypage,myname,settings);
nuevo_win.ResizeToInner(w,h);

nuevo_win.focus();
}


/* esta funcion obtienen el tamaño de la ventana */
function GetInnerSize () {
	var x,y;
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	return [x,y];
}
				
/* esta funcion le da la nueva propiedad de tamaño a la ventana */
function ResizeToInner (w, h, x, y) {
	// make sure we have a final x/y value
	// pick one or the other windows value, not both
	if (x==undefined) x = window.screenLeft || window.screenX;
	if (y==undefined) y = window.screenTop || window.screenY;
	// for now, move the window to the top left
	// then resize to the maximum viewable dimension possible
	window.moveTo(0,0);
	window.resizeTo(screen.availWidth,screen.availHeight);
	// now that we have set the browser to it's biggest possible size
	// get the inner dimensions.  the offset is the difference.
	var inner = GetInnerSize();
	var ox = screen.availWidth-inner[0];
	var oy = screen.availHeight-inner[1];
	// now that we have an offset value, size the browser
	// and position it
	window.resizeTo(Number(w)+Number(ox), Number(h)+Number(oy));
	window.moveTo(x,y);
}
/**************************************************************/



function openNonCenteredWindow(mypage,myname,w,h,features) {
var settings = 'height=' + h + ',';
settings += 'width=' + w + ',';
settings += 'top=' + 25 + ',';
settings += 'left=' + 25 + ',';
settings += features;
win = window.open(mypage,myname,settings);
win.window.focus();
}

function OpenPopup(url, winname,w,h){
	openCenteredWindow(url,winname,w,h,'toolbar=no,location=no,locationbar=no,directories=no,status=no,statusbar=no,addressbar=no,menubar=no,scrollbars=no,copyhistory=yes,resizable=no,titlebar=no');
}

function OpenPopupP(url, winname,w,h){
	openCenteredWindowP(url,winname,w,h,'toolbar=no,location=no,locationbar=no,directories=no,status=no,statusbar=no,addressbar=no,menubar=no,scrollbars=no,copyhistory=yes,resizable=no,titlebar=no');
}

function VerOpen(url, winname,w,h){
	openCenteredWindowP(url,winname,w,h,'toolbar=no,location=no,locationbar=no,directories=no,status=no,statusbar=no,addressbar=no,menubar=no,scrollbars=no,copyhistory=yes,resizable=yes,titlebar=no');
}

/*  To launch any Pop up Window  END  */
function OpenScrollPopup(url, winname,w,h){
	openCenteredWindow(url,winname,w,h,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');
}
function OpenPositioned(url, winname,w,h){
	openNonCenteredWindow(url,winname,w,h,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=yes');
}

/*  To launch any Pop up Windows  END  */

function OpenSlideshow(id_inm){
	OpenPositioned("inmueble_slideshow.php?id="+id_inm,"slideshow",520,370);
}


/* Simple OnMouseOver Menu */
function setVisible(status,menu){
	document.getElementById(menu).style.display = status;	
}

/*Statistics - Country detail*/
function ToggleCountryDataDetail(show,caller,text){
	tmpDiv = document.getElementById('country_data_detail');
	tmpDiv.innerHTML = text;
	tmpDiv.style.display=show;
	xMoveTo(tmpDiv,findPos(caller)[0] ,findPos(caller)[1] + 16);	
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}


/*##########################################################*/
/* Validate Voceros Form Fields ----------------------------*/

function voceros_form() {
	var validation_result;
	validation_result = validar_voceros_form();
	if(validation_result==''){
		document.forms[0].submit();
	}else{
		alert(validation_result);
	}
}

function validar_voceros_form(){
	var frm = document.forms[0];
	var sMessage = '';
	
	if(frm.medio_prensa.value==''){
		// nombre
		sMessage = 'Por favor ingrese su medio de prensa.';
	}else if(frm.medio_prensa.value=='(medio de prensa)'){
		// si no ha cambiado
		sMessage = 'Por favor modifique el espacio de medio de prensa.';
	}else if(frm.tema.value==''){
		// apellido
		sMessage='Por favor indique el tema.';
	}else if(frm.pregunta_1.value==''){
		// email
		sMessage='Por favor ingrese mínimo una pregunta.';
	}
	return sMessage;
}
/* Validate Voceros Form Fields ----------------------------*/

function del_value_medio_prensa(){medio_prensa=document.getElementById("medio_prensa");medio_prensa.value="";medio_prensa.onclick="";}