var _POPUP_FEATURES = 'resizable=yes,location=0,statusbar=0,menubar=0,width=800,height=500';

function raw_popup(url, target, features) {
    // pops up a window containing url optionally named target, optionally having features
    if (isUndefined(features)) features = _POPUP_FEATURES;
    if (isUndefined(target  )) target   = '_blank';
    var theWindow = window.open(url, target, features);
    theWindow.focus();
    return theWindow;
}

function link_popup(src, features) {
    // to be used in an html event handler as in: <a href="..." onclick="link_popup(this,...)" ...
    // pops up a window grabbing the url from the event source's href
    return raw_popup(src.getAttribute('href'), src.getAttribute('target') || '_blank', features);
}

function isUndefined(v) {
    var undef;
    return v===undef;
}

//


/* rollover per votazione gallery */

if (document.images) {
  
  image1on = new Image();
  image1on.src = "/includes/img/star1_on.gif"; 

  image2on = new Image();
  image2on.src = "/includes/img/star2_on.gif"; 

  image3on = new Image();
  image3on.src = "/includes/img/star3_on.gif"; 

  image4on = new Image();
  image4on.src = "/includes/img/star4_on.gif"; 

  image5on = new Image();
  image5on.src = "/includes/img/star5_on.gif"; 

  image6on = new Image();
  image6on.src = "/includes/img/star6_on.gif"; 

  image7on = new Image();
  image7on.src = "/includes/img/star7_on.gif"; 


  
  image1off = new Image();
  image1off.src = "/includes/img/star1.gif";
  
  image2off = new Image();
  image2off.src = "/includes/img/star2.gif";
  
  image3off = new Image();
  image3off.src = "/includes/img/star3.gif";
  
  image4off = new Image();
  image4off.src = "/includes/img/star4.gif";
  
  image5off = new Image();
  image5off.src = "/includes/img/star5.gif";
  
  image6off = new Image();
  image6off.src = "/includes/img/star6.gif";
  
  image7off = new Image();
  image7off.src = "/includes/img/star7.gif";

    
}

function changeImages() {
  if (document.images) {
    for (var i=0; i<changeImages.arguments.length; i+=2) {
      document[changeImages.arguments[i]].src = eval(changeImages.arguments[i+1] + ".src");
    }
  }
}

/* fine rollover per votazione gallery */

/* returns the given cookie value */
function getSlCookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset); //; signifies end of value
	if (endstr == -1)
	endstr = document.cookie.length; //if -1 then take it to the end
	return unescape(document.cookie.substring(offset, endstr)); //convert to readable text
}

/* Get a cookie */
function GetSlCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
	var j = i + alen;
	if (document.cookie.substring(i, j) == arg)
		return getSlCookieVal(j);
	i = document.cookie.indexOf(" ", i) + 1;
	if (i == 0) break; }
	return null;
}

/* Set a cookie */
function SetSlCookie (name, value) {
	document.cookie = name + "=" + value + "; path=/";
}

function getsltime(){
	return (document.FormTime.cbtm.options[document.FormTime.cbtm.selectedIndex].value*1000);
}
function setsltime(i){

	if (document.FormTime) {
		var szT = i/1000;
		var iSel=0;
		if (szT==5){
			iSel = 2;
		}
		if (szT==3){
			iSel = 1;
		}
		document.FormTime.cbtm.selectedIndex = iSel;
	}
	return;
}


	function HideorShowElement(obj,bShow){
		displayel = "none";
		if (bShow){
			displayel = "block";
		}
		element = document.getElementById(obj);
		if (element)
			element.style.display = displayel;
	}


function runslide(){
	try{
		goslide();
	}
	catch(e){
	   window.setTimeout("runslide()", 2);
	}
}	
	
	
var cTime = GetSlCookie('timersec');
var iTime
if (cTime==null)
	iTime = 0;
else
	iTime = Number(cTime)
if (iTime != 0 ){
   window.setTimeout("runslide()", iTime);
		HideorShowElement("timeroff",true);
		HideorShowElement("timer",false);
}
else
{
		HideorShowElement("timeroff",false);
		HideorShowElement("timer",true);
}	
	
	
/* Funzione per generare il flash */
var flashobject={setA:function(a){this.a={classid:'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',type:'application/x-shockwave-flash'};var attr=a||{};for(var i in attr){this.a[i]=attr[i];}},setP:function(p){this.p={quality:'high',menu:'false',wmode:'transparent'};var parm=p||{};for(var i in parm){this.p[i]=parm[i];}},setE:function(e){this.e={quality:'high',menu:'false',type:'application/x-shockwave-flash',pluginspage:'http://www.macromedia.com/go/getflashplayer',allowScriptAccess:'sameDomain'};var parm=e||{};for(var i in parm){this.e[i]=parm[i];}},writeObject:function(v,a,p,e){this.setA(a);this.setP(p);this.setE(e);var obj='<object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+v+'"\n';for(var i in this.a){obj+=' '+i+'="'+this.a[i]+'" ';}
obj+='> ';for(var j in this.p){obj+=' <param name="'+j+'" value="'+this.p[j]+'"> ';}
obj+='<embed ';for(var k in this.e){obj+=' '+k+'="'+this.e[k]+'"\n';}
obj+='></embed>\n';obj+='</object>';document.write(obj);},writeSimpleObject:function(src,w,h,v){this.writeObject(v,{width:w,height:h},{movie:src},{src:src,width:w,height:h});}};
