﻿
function verinfo(alojamiento,precios,inicio,fin) {
   centerPopup();
   loadPopup();

   changecss('.flash', 'visibility', 'hidden');
   //alert('/web/ai/verano.aspx?alojamiento=' + alojamiento + '&precios=' + precios + '&inicio=' + inicio + '&fin=' + fin + '&random=' + new Date().getTime())
   $('#contactArea').load('/web/ai/verano.aspx?alojamiento=' + alojamiento + '&precios=' + precios + '&inicio=' + inicio + '&fin=' + fin + '&random=' + new Date().getTime());
   //alert('/web/ai/verano.aspx?alojamiento=' + alojamiento + '&precios=' + precios + '&inicio=' + inicio + '&fin=' + fin + '&random=' + new Date().getTime());
}

function Cerrar() {
    disablePopup();
}

function loadPopup() {
    $("#backgroundPopup").css({ "opacity": "0.1" });
    $("#backgroundPopup").fadeIn("fast");
    $("#popupContact").slideDown("slow");
}
function disablePopup() {
    $("#backgroundPopup").fadeOut("slow");
    $("#popupContact").slideUp("slow");
    changecss('.flash', 'visibility', 'visible');
}
function centerPopup() {
    var windowWidth = document.body.clientWidth;
    
    if (navigator.appName == 'Microsoft Internet Explorer') {
        $("#contactArea").css({ "height": "442px" });
    }

    $("#popupContact").css({ "position": "absolute", "top": document.body.scrollTop + 30, "left": 20, "width": windowWidth - 50 });
    $("#backgroundPopup").css({ "height": "100%" });


}


function changecss(theClass,element,value) {
		var cssRules;
            for (var S = 0; S < document.styleSheets.length; S++){
            try{
			  	document.styleSheets[S].insertRule(theClass+' { '+element+': '+value+'; }',document.styleSheets[S][cssRules].length);

			  } catch(err){
			  		try{document.styleSheets[S].addRule(theClass,element+': '+value+';');

					}catch(err){

					 	try{
						    if (document.styleSheets[S]['rules']) {
							  cssRules = 'rules';
							 } else if (document.styleSheets[S]['cssRules']) {
							  cssRules = 'cssRules';
							 } else {
							  //no rules found... browser unknown
							 }

							  for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
							   if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
							    if(document.styleSheets[S][cssRules][R].style[element]){
							    document.styleSheets[S][cssRules][R].style[element] = value;
								break;
							    }
							   }
							  }
						  } catch (err){}



					}

			  }


		}
	}

