/*

 apre un popunder

*/

var cookie = "kiron";

function popup(){
	if (getcookie(cookie)==""){
		openpopup();
		setcookie();
	}

}


function openpopup() {
	window.open("/kiron.html","","toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,status=no,width=550,height=550,left=20,top=10").blur(); window.focus();
}


function getcookie(cookieName) {

	var id = cookieName + "=";
	var cookievalue = "";

	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(id);
		if (offset != -1) {
			cookievalue = "x";
		}
	}
	return cookievalue;
}


function setcookie () {
	document.cookie = cookie+ "="+ escape ("done");
}

function popUp(url,name,width,height){
	window.open(url,name,'scrollbars=yes,resizable=yes,status=no,location=no,toolbar=no,width=' + width + ',height=' + height + '');
}

// SCRIPT PER IL PRELOAD DELLE IMMAGINI
function MM_preloadImages() { //v2.0
	if (document.images) {
		var imgFiles = MM_preloadImages.arguments;
		if (document.preloadArray==null) {
			document.preloadArray = new Array();
		}
		var i = document.preloadArray.length;
		with (document) for (var j=0; j<imgFiles.length; j++)
		if (imgFiles[j].charAt(0)!="#"){
			preloadArray[i] = new Image;
			preloadArray[i++].src = imgFiles[j];
	 	}
	}
}

browser_name = navigator.appName;
browser_version = parseFloat(navigator.appVersion);

if (browser_name == "Netscape" && browser_version >= 3.0) { 
	roll = 'true'; 
} else if (browser_name == "Microsoft Internet Explorer" && browser_version >= 3.0) { 
	roll = 'true'; 
} else { 
	roll = 'false'; 
}

function msover(img,ref) {
	if (roll == 'true') { 
 		document.images[img].src = ref; 
	 } 
}

function msout(img,ref)  {
	if (roll == 'true') {
		document.images[img].src = ref; 
	} 
}

//SCRIPT PER LANCIARE LA SPALLA  
function goFramer(l1,top,scroll,url) {
	var d=document.fm;
	d.l1.value=l1; d.top.value=top; d.scroll.value=scroll; d.url.value=url; d.submit();
}


//SCRIPT PER POPUP DA MENU GIALLO
function InfoPopUp(theURL) {
	window.open(theURL,'','width=600,height=450,scrollbars=yes,menubar=no,resizable=yes')
}

function MioPopUp(quale,cx,cy){
	helpWin = open(quale, "","scrollbars=yes,width="+cx+",height="+cy+",status=no,toolbar=no,menubar=no");
}

// SCRIPT PER BANNERS Version 4.0 No Rich Media

// Funzione MakeAD da inserire in Testa di Pagina Version 4.0
	//Version 4.0 No Rich Media
function ApriSponsor (sito, tags, magic) {
	var h = screen.availHeight;
	var w = screen.availWidth;
	var Finestra = window.open(sito+"/adclick.exe" + tags + "/ACC_RANDOM="+magic, "banner", "outerHeight="+h+",outerWidth="+w+",status=yes,toolbar=yes,directories=yes,resizable=yes,menubar=yes,scrollbars=yes,location=yes,left=0,top=0,width="+(w-10)+",height="+(h-145));
	Finestra.focus();
}


function makeAD(sito, tags, dimw, dimh)	{

	var now = new Date();
	var magic=now.getTime();
	document.write("<A HREF=\"javascript:ApriSponsor('"+sito+"','"+tags+"','"+magic+"')\"><IMG SRC=\""+sito+"/adserver.exe" + tags +"/ACC_RANDOM="+magic+"\" border=0></A>");
}


// CONTROLLO VALIDITA' e-mail
function isEmail(string) {

	if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1){
		return false;
	} else {
		return true;
	}
}

// controlla che l'input sia un numero
function checkNumber(checkStr) {

	var checkOK = "0123456789";
	var allValid = true;
	var decPoints = 0;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
				break;
		if (j == checkOK.length) {
			allValid = false;
			break;
		}
		allNum += ch;
	}
	if (!allValid) {
		return (false);
	}
	return true;

}

function svuotaSelect(oggetto){
	var options = oggetto.options;
	var i;
	for (i=options.length-1;i>0;i--)
		options[i]=null;
}

function getRequestObject(){

	var req=null;
	if(typeof XMLHttpRequest!="undefined")
		req=new XMLHttpRequest();
	if(!req&&typeof ActiveXObject!="undefined"){
		try{
			req=new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e){
			try{
				req=new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e2){
				try{
					req=new ActiveXObject("Msxml2.XMLHTTP.4.0");
				} catch(e3){
					req=null;
				}
			}
		}
	}
	if(!req&&window.createRequest)
		req=window.createRequest();
	return req;
}


function getFromServer(){
		
	var i,xmlhttp,postData, value, url;
	
	url = arguments[0];
	if(document.body)
		document.body.style.cursor='wait';
	window.status='Sending Request...';
	postData="s=x";
	if(arguments.length > 1){
		for(i=1;i <arguments.length;i++){
			value=arguments[i];
			postData+="&xargs="+encodeURIComponent(value);
		}
	}
	xmlhttp=getRequestObject();
	if(!xmlhttp)
		return false;
	xmlhttp.open("POST",url,false);
	xmlhttp.setRequestHeader("Method","POST "+url+" HTTP/1.1");
	xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	window.status='Waiting for data...';
	xmlhttp.send(postData);
	if(xmlhttp.status==0||xmlhttp.status==200){
		document.body.style.cursor='default';
		window.status='Done';
		ris = xmlhttp.responseText;
	} else {
		document.body.style.cursor='default';
		window.status='Invalid XML response error';
		ris = "";
	}	
	delete xmlhttp;
	return ris;
}



