// JavaScript

Shadowbox.init({
	language: 'it',
    players:  ['img', 'html', 'iframe', 'qt', 'wmp', 'swf', 'flv'],	
	overlayColor:"#010",
    overlayOpacity: 0.9,
	fadeDuration: 0.90,
	counterType:"skip"
});
/*function funzione(type, title, url)
			 {
				 Shadowbox.open({type: type, title: title, content: url});
			 };*/

function focusradiop(dato){
	if(this.checked=true){
		document.getElementById('radioc').checked=false;
		document.getElementById('radioc').value='';
	}
	//document.getElementById('radioc').value='';
	//document.getElementById('radioc').checked=false;
	if(dato == "de"){
	document.getElementById('radiop').value='?http://www.sgs-software.it/CampingPinoMare/deu/prenotazione.aspx';return false
	}else if(dato == "en"){
	     document.getElementById('radiop').value='?http://www.sgs-software.it/CampingPinoMare/eng/prenotazione.aspx';return false
	}else{document.getElementById('radiop').value='?http://www.sgs-software.it/CampingPinoMare/ita/prenotazione.aspx';return false}
}
function focusradioc(dato){
	
	if(this.checked=true){
		document.getElementById('radiop').checked=false;
		document.getElementById('radiop').value='';
	}
	
    //this.checked=true;
	//document.getElementById('radioc').checked=true;
	//document.getElementById('radiop').value='';
	//document.getElementById('radiop').checked=false;
	
	if(dato == "de"){
	document.getElementById('radioc').value='http://www.sgs-software.it/pinomare/calcola/inserzioneD.asp'
    }else if(dato == "en"){
	     document.getElementById('radioc').value='http://www.sgs-software.it/pinomare/calcola/inserzioneE.asp';
	}else{document.getElementById('radioc').value='http://www.sgs-software.it/pinomare/calcola/inserzione.asp';}
}

///******************************* creo cookie
function memorizza(variabile,valore)
{
var expDays = 1000;
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
expdate=exp.toGMTString();
document.cookie = ""+variabile+" ="+ valore+"; expires ="+ expdate+";";
}

function getCookie(Name) {

   var search = Name + "="

   if (document.cookie.length > 0) { // if there are any cookies

      offset = document.cookie.indexOf(search) 

      if (offset != -1) { // if cookie exists 

         offset += search.length 

         // set index of beginning of value

         end = document.cookie.indexOf(";", offset) 

         // set index of end of cookie value

         if (end == -1) 

            end = document.cookie.length

         return unescape(document.cookie.substring(offset, end))

      } 

   }

}
/////////////*******************

//finzione ricevi dati da madre
function vaii(){
	var url3 = getCookie('camping');
	urlstringa = url3.slice(38);
	alert(url3);
	
}
function vai(dato){
var url = unescape( String(this.location) );
var url2 = location.search.substr(1); 
var url3 = getCookie('camping');
if(dato == "de"){
var urlsgs = "http://www.sgs-software.it/CampingPinoMare/deu/prenotazione.aspx"
urlstringa = url3.slice(38);
}else if(dato == "en"){	
	var urlsgs = "http://www.sgs-software.it/CampingPinoMare/eng/prenotazione.aspx"
	urlstringa = url3.slice(37);
}else{var urlsgs = "http://www.sgs-software.it/CampingPinoMare/ita/prenotazione.aspx"
urlstringa = url3.slice(39);}


//alert(url2);
//var ciao = parent.document.getElementById('modulo');
//document.frames['prenotazioni'].location.replace(url3);
//if(document.frames['prenotazioni'].location.href != ""){
window.frames['prenotazioni'].location.href = urlstringa;
}
// modulo con campi controllo 
function Modulo(dato) {

var dal_giorno = document.modulo.dal_giorno.value;
var al_giorno = document.modulo.al_giorno.value;
var risorsa = document.modulo.risorsa.options[document.modulo.risorsa.selectedIndex].value;
var radiop = document.modulo.radiop.checked;
var radioc = document.modulo.radioc.checked;

if ((risorsa == "") || (risorsa == "- Select -")) {
   if(dato == "de"){
   alert("Ferientyp ist verbindlich.");
   }else if(dato == "en"){
   alert("Holiday type is needed.");
   }else {alert("Tipologia vacanza \u00E9 obbligatoria.");}
   document.modulo.risorsa.focus();
   return false;
} 
else if ((dal_giorno == "") || (dal_giorno == "undefined")) {
   if(dato == "de"){
   alert("Ankunftstag ist verbindlich.");
   }else if(dato == "en"){
   alert("Arrival date is needed.");
   }else {alert("Data di arrivo \u00E9 obbligatoria.");}
   document.modulo.dal_giorno.focus();
   return false;
} 
else if ((al_giorno == "") || (al_giorno == "undefined")) {
   if(dato == "de"){
   alert("Abreisetag ist verbindlich.");
   }else if(dato == "en"){
   alert("Departure date is needed.");
   }else {alert("Data di partenza \u00E9 obbligatoria.");}
   document.modulo.al_giorno.focus();
   return false;
} 
else if (radiop != true & radioc != true)  {
   if(dato == "de"){
   alert("Bitte wählen: Reservierung | Preisausrechnnung.");
   }else if(dato == "en"){
   alert("Select: Booking | Calculate price.");
   }else {alert("Selezionare: Prenotazione | Calcola prezzo.");}
   document.modulo.radiop.value = "";
   //document.modulo.radiop.focus();
   return false;
} 
else if (radiop == true || radioc == false) {
	   //document.modulo.action = "elabora_dati.asp";
	   submitForm1(dato);
           //document.modulo.submit();
}
else{
	submitForm();
	}


function submitForm1(dato){ 
cont = new Array();
			cont[0]= (document.getElementById('radiop')).value;
			cont[1]= (document.getElementById('radioc')).value;
			cont[2]= "?risorsa="+(document.getElementById('risorsa')).value;
			cont[3]= "&dal_giorno="+(document.getElementById('dal_giorno')).value;
			cont[4]= "&al_giorno="+(document.getElementById('al_giorno')).value;
			if(dato == "de"){
			cont[10]= 'buchen-camping-pino-mare-village.html'
			}else if(dato == "en"){
				cont[10]= 'book-holiday-at-camping-village.html'
			}else{cont[10]= 'booking-camping-pino-mare-village.html'}
            for(i=0; i<=cont.length; i++){
				//page=cont[10]+cont[1]+cont[0]+cont[2]+cont[3]+cont[4];
				page=cont[10]+cont[1]+cont[0]+cont[2]+cont[3]+cont[4];
				memorizza("camping", page)
				window.open(cont[10],'_self','scrollbars=yes,resizable=yes,menubar=yes,toolbar=yes,location=yes,titlebar=yes');
				break
			}
}
}   
function checkin(){ 
check = new Array();
			check[0]= 'check-camping-pino-mare-village.html'
			check[1]= 'http://www.sgs-software.it/CampingPinoMare/ita/login.aspx'	
				page=check[1]
				memorizza("camping", page)
				window.open(check[0],'_self','scrollbars=yes,resizable=yes,menubar=yes,toolbar=yes,location=yes,titlebar=yes');
}
function checkinDe(){ 
check = new Array();
			check[0]= 'check-in-aus-camping-pino-mare.html'
			check[1]= 'http://www.sgs-software.it/CampingPinoMare/deu/login.aspx'	
				page=check[1]
				memorizza("camping", page)
				window.open(check[0],'_self','scrollbars=yes,resizable=yes,menubar=yes,toolbar=yes,location=yes,titlebar=yes');
}
function checkinEn(){ 
check = new Array();
			check[0]= 'check-in-camping-pino-mare.html'
			check[1]= 'http://www.sgs-software.it/CampingPinoMare/eng/login.aspx'	
				page=check[1]
				memorizza("camping", page)
				window.open(check[0],'_self','scrollbars=yes,resizable=yes,menubar=yes,toolbar=yes,location=yes,titlebar=yes');
}

        function submitForm(){ 
		
		    cont = new Array();
			cont[0]= (document.getElementById('radiop')).value;
			cont[1]= document.modulo.radioc.value;
			var casaV = document.getElementById('risorsa').value;
			if(casaV == 'MX'){
				cont[2]= "?Tiporisorsa=M4";
			}else if(casaV == 'TX'){
				cont[2]= "?Tiporisorsa=MT";
			}else if(casaV == 'CL'){
				cont[2]= "?Tiporisorsa=ML";
			}else if(casaV == 'M5'){
				cont[2]= "?Tiporisorsa=M2";
			}else{cont[2]= "?Tiporisorsa="+(document.getElementById('risorsa')).value;}
			
			cont[3]= "&dal_giorno="+(document.getElementById('dal_giorno')).value;
			cont[4]= "&al_giorno="+(document.getElementById('al_giorno')).value;
            var s = window.Shadowbox; 
            /*var q = document.getElementById('Lng'); 
			var z = document.getElementById('idalbergo');
            var t = q.value; 
			var f = z.value;*/
        for(i=0; i<=cont.length; i++){
			//alert(cont[2]);
            s.open({
                player:     "iframe", 
                title:      "Camping Pino Mare", 
                content:url= cont[1]+cont[0]+cont[2]+cont[3]+cont[4], 
                width:      900, 
                height:     700 
				  });  break
			};
        }; 
        
function openShadowbox(content,title){
    Shadowbox.open({
        content:    content,
        player:     'img',
        title:      title,
		options:{overlayColor:"#010",overlayOpacity: 0.9,fadeDuration: 0.90}
		
		
		
    });
};
function openShadowboxv(content,title){
    Shadowbox.open({
        content:    content,
        player:     'swf',
        title:      title,
		width:      687, 
        height:     576,
		options:{overlayColor:"#010",overlayOpacity: 0.9,fadeDuration: 0.90}
		
		
		
    });
};
function splash(page){
	winext=window.open(page,'','location=no,status=no,menubar=no,scrollbars=yes,resizable=yes');	
if (window.screen) {
    winext.window.moveTo(0,0);
    winext.window.resizeTo(screen.availWidth,screen.availHeight);
    winext.focus();
    }

};

var s_sid = 318706;var st_dominio = 4; var cimg = 0;var cwi =0;var che =0;//histats

////////////////////Settaggio calendario italiano
Calendar.LANG("it", "Italiano", {

        fdow: 1,                // first day of week for this locale; 0 = Sunday, 1 = Monday, etc.

        goToday: "Vai a oggi",

        today: "Oggi",         // appears in bottom bar

        wk: "set",

        weekend: "0,6",         // 0 = Sunday, 1 = Monday, etc.

        AM: "am",

        PM: "pm",

        mn : [ "Gennaio",
               "Febbraio",
               "Marzo",
               "Aprile",
               "Maggio",
               "Giugno",
               "Luglio",
               "Agosto",
               "Settembre",
               "Ottobre",
               "Novembre",
               "Dicembre" ],

        smn : [ "Gen",
                "Feb",
                "Mar",
                "Apr",
                "Mag",
                "Giu",
                "Lug",
                "Ago",
                "Set",
                "Ott",
                "Nov",
                "Dic" ],

        dn : [ "Domenica",
               "Lunedì",
               "Martedì",
               "Mercoledì",
               "Giovedi",
               "Venerdì",
               "Sabato",
               "Domenica" ],

        sdn : [ "Do",
                "Lu",
                "Ma",
                "Me",
                "Gi",
                "Ve",
                "Sa",
                "Do" ]

});

