// POPUPS -------------------------------------------------------------------------------------------------------------
function SkiMap() {
window.open("http://www.val-gardena.net/skimap/skimap_it.htm","PopSkiMap","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizeable=0,width=800,height=550")
}
// --------------------------------------------------------------------------------------------------------------------


// FORM SEND ----------------------------------------------------------------------------------------------------------
function ValidLength(item, len) 
{	
	return(item.length >=len);
}

function ValidEmail(item)
{	
	if(!ValidLength(item,5)) return false;
	if(item.indexOf('@',0) == -1) return false;
	if(item.indexOf('.',0) == -1) return false;
	if(item.indexOf(',',0) > 0) return false;
	return true;	
}

function SendGutschein()
{	
	errfound = false;
	
	if (!ValidLength(document.FrmGut.TxtWert.value,3))
		error(document.FrmGut.TxtWert,"Inserire il valore del buono.");
	if (!ValidLength(document.FrmGut.TxtVorname.value,3))
		error(document.FrmGut.TxtVorname,"Inserire il proprio nome.");
	if (!ValidLength(document.FrmGut.TxtNachname.value,3))
		error(document.FrmGut.TxtNachname,"Inserire il proprio cognome.");
	if (!ValidLength(document.FrmGut.TxtTel.value,6))
		error(document.FrmGut.TxtTel,"Inserire il proprio numero telefonico.");
	if (!ValidEmail(document.FrmGut.TxtMail.value))
		error(document.FrmGut.TxtMail, "Inserire il proprio indirizzo e-mail.");
	if (document.FrmGut.TxtPrivacy.checked == 0)
		error(document.FrmGut.TxtPrivacy,"Per proseguire č necessario acconsentire il trattamento dei dati personali.");
	if (errfound == false)
		{
			document.FrmGut.TxtCheck03.value = 'validato';
			document.FrmGut.BtnSend.disabled = true;
			document.FrmGut.BtnSend.value = 'Invio in corso...';
			document.FrmGut.submit();
		}
}

function SendBeauty()
{	
	errfound = false;
	
	if (!ValidLength(document.FrmBeauty.TxtVorname.value,3))
		error(document.FrmBeauty.TxtVorname,"Inserire il proprio nome.");
	if (!ValidLength(document.FrmBeauty.TxtNachname.value,3))
		error(document.FrmBeauty.TxtNachname,"Inserire il proprio cognome.");
	if (!ValidLength(document.FrmBeauty.TxtTel.value,6))
		error(document.FrmBeauty.TxtTel,"Inserire il proprio numero telefonico.");
	if (!ValidEmail(document.FrmBeauty.TxtMail.value))
		error(document.FrmBeauty.TxtMail, "Inserire il proprio indirizzo e-mail.");
	if (!ValidLength(document.FrmBeauty.TxtWeiteres.value,6))
		error(document.FrmBeauty.TxtWeiteres,"Inserire il testo della richiesta.");
	if (document.FrmBeauty.TxtPrivacy.checked == 0)
		error(document.FrmBeauty.TxtPrivacy,"Per proseguire č necessario acconsentire il trattamento dei dati personali.");
	if (errfound == false)
		{
			document.FrmBeauty.TxtCheck03.value = 'validato';
			document.FrmBeauty.BtnSend.disabled = true;
			document.FrmBeauty.BtnSend.value = 'Invio in corso...';
			document.FrmBeauty.submit();
		}
}


function SendKarriere()
{	
	errfound = false;
	
	if (!ValidLength(document.FrmKarriere.TxtVorname.value,3))
		error(document.FrmKarriere.TxtVorname,"Inserire il proprio nome.");
	if (!ValidLength(document.FrmKarriere.TxtNachname.value,3))
		error(document.FrmKarriere.TxtNachname,"Inserire il proprio cognome.");
	if (!ValidLength(document.FrmKarriere.TxtGeburtsdatum.value,6))
		error(document.FrmKarriere.TxtGeburtsdatum,"Inserire la propria data di nascita.");
	if (!ValidLength(document.FrmKarriere.TxtFamilienstand.value,3))
		error(document.FrmKarriere.TxtFamilienstand,"Inserire il proprio stato civile.");
	if (!ValidLength(document.FrmKarriere.TxtNationalitat.value,3))
		error(document.FrmKarriere.TxtNationalitat,"Inserire la propria nazionalitą.");
	if (!ValidLength(document.FrmKarriere.TxtStadt.value,3))
		error(document.FrmKarriere.TxtStadt,"Inserire il nome della cittą di residenza.");
	if (!ValidLength(document.FrmKarriere.TxtPlz.value,3))
		error(document.FrmKarriere.TxtPlz,"Inserire il proprio CAP di residenza.");
	if (!ValidLength(document.FrmKarriere.TxtLand.value,3))
		error(document.FrmKarriere.TxtLand,"Inserire il nome del paese di residenza.");
	if (!ValidEmail(document.FrmKarriere.TxtMail.value))
		error(document.FrmKarriere.TxtMail, "Inserire il proprio indirizzo E-Mail.");
	if (!ValidLength(document.FrmKarriere.TxtLebenslauf.value,5))
		error(document.FrmKarriere.TxtLebenslauf,"Inserire il proprio curriculum.");
	if (!ValidLength(document.FrmKarriere.TxtBild.value,5))
		error(document.FrmKarriere.TxtBild,"Inserire una foto.");

	if (document.FrmKarriere.TxtPrivacy.checked == 0)
		error(document.FrmKarriere.TxtPrivacy,"Per proseguire č necessario acconsentire il trattamento dei dati personali.");
	if (errfound == false)
		{
			//document.getElementById('hidepage').style.visibility = 'visible';
			//document.getElementById('hidepage').style.display = '';
			document.FrmKarriere.TxtCheck03.value = 'validato';
			document.FrmKarriere.BtnSend.disabled = true;
			document.FrmKarriere.BtnSend.value = '-----------------------------\nLa sua richiesta sta per essere inviata...\nAttendere prego...\n-----------------------------';
			document.FrmKarriere.submit();
		}
}

function error(elem, text)
{	if (errfound) return;
	window.alert(text)
	elem.select();
	elem.focus;
	errfound = true;
}

// --------------------------------------------------------------------------------------------------------------------


// PREZZI SELECT ------------------------------------------------------------------------------------------------------

function getElementsByClassName(className, tag, elm){
	var testClass = new RegExp("(^|\\s)" + className + "(\\s|$)");
	var tag = tag || "*";
	var elm = elm || document;
	var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag);
	var returnElements = [];
	var current;
	var length = elements.length;
	for(var i=0; i<length; i++){
		current = elements[i];
		if(testClass.test(current.className)){
			returnElements.push(current);
		}
	}
	return returnElements;
}

function addClassName(elm, className){
    var currentClass = elm.className;
    if(!new RegExp(("(^|\\s)" + className + "(\\s|$)"), "i").test(currentClass)){
        elm.className = currentClass + ((currentClass.length > 0)? " " : "") + className;
    }
    return elm.className;
}

function removeClassName(elm, className){
    var classToRemove = new RegExp(("(^|\\s)" + className + "(\\s|$)"), "i");
    elm.className = elm.className.replace(classToRemove, "").replace(/^\s+|\s+$/g, "");
    return elm.className;
}

function activateThisColumn(column) {
	var table = document.getElementById('pricetable');
	
	var tds = table.getElementsByTagName('td');
	for (var m=0; m<tds.length; m++) {
		removeClassName(tds[m], 'on');
	}
	
	var newtds = getElementsByClassName(column, 'td', table);
	for (var i=0; i<newtds.length; i++) {
		addClassName(newtds[i], 'on');
	}

	// seconda tabella
	var table2 = document.getElementById('pricetable2');
	
	var tds2 = table2.getElementsByTagName('td');
	for (var m2=0; m2<tds2.length; m2++) {
		removeClassName(tds2[m2], 'on');
	}
	
	var newtds2 = getElementsByClassName(column, 'td', table2);
	for (var i2=0; i2<newtds2.length; i2++) {
		addClassName(newtds2[i2], 'on');
	}
}
// --------------------------------------------------------------------------------------------------------------------



// MAIL ENCRYPTION ----------------------------------------------------------------------------------------------------
var emailriddlerarray=[105,110,102,111,64,97,114,116,45,100,111,109,117,115,46,99,111,109]
var encryptedemail_id39='' //variable to contain encrypted email 
for (var i=0; i<emailriddlerarray.length; i++)
 encryptedemail_id39+=String.fromCharCode(emailriddlerarray[i])
// --------------------------------------------------------------------------------------------------------------------


// SLIDE SHOW ---------------------------------------------------------------------------------------------------------
      
/***********************************************
* Ultimate Fade-In Slideshow (v1.51): © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
 
//var fadeimages2=new Array() //2nd array 
//fadeimages2[0]=["photo1.jpg", "", ""] //plain image syntax
//fadeimages2[1]=["photo2.jpg", "http://www.cssdrive.com", ""] //image with link syntax
//fadeimages2[2]=["photo3.jpg", "http://www.javascriptkit.com", "_new"] //image with link and target syntax

//fadeshow(fadeimages, 730, 262, 0, 4000, 0, 0) 
//new fadeshow(IMAGES_ARRAY_NAME, slideshow_width, slideshow_height, borderwidth, delay, pause (0=no, 1=yes), optionalRandomOrder)

var fadebgcolor="black"

////NO need to edit beyond here/////////////
 
var fadearray=new Array() //array to cache fadeshow instances
var fadeclear=new Array() //array to cache corresponding clearinterval pointers
 
var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all
 
function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){
this.pausecheck=pause
this.mouseovercheck=0
this.delay=delay
this.degree=0 //initial opacity degree (10%)
this.curimageindex=0
this.nextimageindex=1
fadearray[fadearray.length]=this
this.slideshowid=fadearray.length-1
this.canvasbase="canvas"+this.slideshowid
this.curcanvas=this.canvasbase+"_0"
if (typeof displayorder!="undefined")
theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
this.theimages=theimages
this.imageborder=parseInt(borderwidth)
this.postimages=new Array() //preload images
for (p=0;p<theimages.length;p++){
this.postimages[p]=new Image()
this.postimages[p].src=theimages[p][0]
}
 
var fadewidth=fadewidth+this.imageborder*2
var fadeheight=fadeheight+this.imageborder*2
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)
document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div></div>')
else
document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
this.startit()
else{
this.curimageindex++
setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
}
}

function fadepic(obj){
if (obj.degree<100){
obj.degree+=10
if (obj.tempobj.filters&&obj.tempobj.filters[0]){
if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
obj.tempobj.filters[0].opacity=obj.degree
else //else if IE5.5-
obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
}
else if (obj.tempobj.style.MozOpacity)
obj.tempobj.style.MozOpacity=obj.degree/101
else if (obj.tempobj.style.KhtmlOpacity)
obj.tempobj.style.KhtmlOpacity=obj.degree/100
else if (obj.tempobj.style.opacity&&!obj.tempobj.filters)
obj.tempobj.style.opacity=obj.degree/101
}
else{
clearInterval(fadeclear[obj.slideshowid])
obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
obj.populateslide(obj.tempobj, obj.nextimageindex)
obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
}
}
 
fadeshow.prototype.populateslide=function(picobj, picindex){
var slideHTML=""
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+='</a>'
picobj.innerHTML=slideHTML
}
 
 
fadeshow.prototype.rotateimage=function(){
if (this.pausecheck==1) //if pause onMouseover enabled, cache object
var cacheobj=this
if (this.mouseovercheck==1)
setTimeout(function(){cacheobj.rotateimage()}, 100)
else if (iebrowser&&dom||dom){
this.resetit()
var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
crossobj.style.zIndex++
fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
}
else{
var ns4imgobj=document.images['defaultslide'+this.slideshowid]
ns4imgobj.src=this.postimages[this.curimageindex].src
}
this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}
 
fadeshow.prototype.resetit=function(){
this.degree=10
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
if (crossobj.filters&&crossobj.filters[0]){
if (typeof crossobj.filters[0].opacity=="number") //if IE6+
crossobj.filters(0).opacity=this.degree
else //else if IE5.5-
crossobj.style.filter="alpha(opacity="+this.degree+")"
}
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=this.degree/101
else if (crossobj.style.KhtmlOpacity)
crossobj.style.KhtmlOpacity=this.degree/100
else if (crossobj.style.opacity&&!crossobj.filters)
crossobj.style.opacity=this.degree/101
}
 
 
fadeshow.prototype.startit=function(){
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
this.populateslide(crossobj, this.curimageindex)
if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
var cacheobj=this
var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
}
this.rotateimage()
}
// --------------------------------------------------------------------------------------------------------------------


// IMAGES POPUP -------------------------------------------------------------------------------------------------------
function Pop(name, w, h){  

    var s1 = ("<HTML><TITLE>Art Domus - Architecure and SPA Design</TITLE>" + 
    "<BODY onBlur='self.focus()' BGCOLOR='#FFFFFF' background='../images/layout/popbg.jpg' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>" + 
    "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='0'><tr><td align='center' valign='middle'><IMG OnClick='Javascript:window.close()' SRC='" + name + "' border='1' style='border-color:#000000'>" + "</tr></table>");   

    w = w + 20;
    h = h + 20;
    
    var param = ("height=" + h + ",width=" + w + ",scrollbars=no,resizable=no,left=50,top=50");

    popup = window.open("","popDialog",param)

    popup.document.write(s1)
    popup.document.close()
}

function PopItNew(theURL, w, h){
        ver = parseInt(navigator.appVersion.substring(0,1));       newWin=window.open(theURL,"ipix_pop","width="+w+",height="+h+",menubar=no,toolbar=no,status=yes,resizable=no,scrollbars=no,");
	if ((!((navigator.appName == "Netscape")&&(ver==2))) && (!((navigator.appName == "Microsoft Internet Explorer")&&(ver<4)))){
          setTimeout("if (newWin) newWin.focus();",1000);
    }
}
// --------------------------------------------------------------------------------------------------------------------

function TrackIT(url)
{
	var url;
	document.location.href = url;
	return false;
} 

// INC ----------------------------------------------------------------------------------------------------------------
function IncludeJavaScript(jsFile)
{
  document.write('<script type="text/javascript" src="'
    + jsFile + '"></script>'); 
}
IncludeJavaScript('../scr/lb/prototype.js');
IncludeJavaScript('../scr/lb/scriptaculous.js?load=effects');
IncludeJavaScript('../scr/lb/lb.js');
// --------------------------------------------------------------------------------------------------------------------