  
// ----------------------------------------------------------
// JAVASCRIPT SUBROUTINES
// -----------------------------------------------------------



function pop_activity(id){
 var url = "s1_s4_adv.php?id="+id;
 win=window.open( url,"adventure","resizable=yes, width=550, height=500, scrollbars");
 win.focus();
}

function pop_pic(sec, id, picnr){
 var url = "pic_viewer.php?sec="+sec+"&picnr="+picnr+"&id="+id;
 win=window.open( url,"pop_pic","resizable=yes, width=550, height=500, scrollbars");
 win.focus();
}

function pop_pic_viewer(id, cat){
 var url = "pic_viewer.php?pic_id="+id+"&img_cat="+cat;
 win=window.open( url,"pic_viewer","resizable=yes, width=700, height=480, scrollbars");
 win.focus();
}

function pop_speciale_bambini(){
 win=window.open("http://www.sporteturismo.com/bambini/ita/index.php","speciale_bambini","resizable=yes, width=900, height=600, scrollbars, toolbar, menubar, status");
 win.focus();
}

// funzioni di login

function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function overlay(curobj, subobjstr, opt_position){
if (document.getElementById){
var subobj=document.getElementById(subobjstr)
subobj.style.display=(subobj.style.display!="block")? "block" : "none"
var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
subobj.style.left=xpos-80+"px"
subobj.style.top=ypos-30+"px"
return false
}
else
return true
}

function overlayclose(subobj){
document.getElementById(subobj).style.display="none"
}