var j=0;
function getObj(name){
	if (document.getElementById) {
		return  document.getElementById(name);
	}
	else if (document.all) {
		return  document.all[name];
	}
	else if (document.layers) {
		return document.layers[name];
	}
}

function flashonline(divname){
  var skn = (document.layers) ? eval("document."+divname):document.getElementById(divname).style;
  if (skn.visibility == "visible") 
	skn.visibility = "hidden";
  else  {
  	skn.visibility = "visible";
  }
}
function getElem(div) {
	return document.getElementById ? document.getElementById(div) : document.all[div]
}


function popUpEvents(URL) {
window.open(URL, "events", "width=640,height=580,toolbar=no,scrollbars=yes,location=no,status=yes,menubar=no,resizable=yes");
return false;
}

function popUpZoom(URL,x,y) {
	window.open(URL, "zoom", "width="+x+",height="+y+",toolbar=no,scrollbars=no,location=no,status=yes,menubar=no,resizable=yes");
	return false;
}
function popUp(URL,id) {
window.open(URL, id, "width=468,height=530,toolbar=no,scrollbars=no,location=no,status=yes,menubar=no,resizable=yes");
return false;
}

function newchat(tipo,nick,id) {
	popUp("im.php?sendto="+nick,id);	
	return false;
}

function openim(tipo,nick,id) {
	popUp("im.php?sendto="+nick,"msg"+id);	
	return false;
}

function closeorphan(nick) {
	nick2=nick;
	stringa='abcdefghij'
	for (i=0;i<=9;i++) {
		nick2=nick2.replace(i,stringa.charAt(i));
	}
	if(top.varcontainer!=null) {
		eval ("if((top.varcontainer.topFrame.topleftFrame."+nick2+"==null) || (top.varcontainer.topFrame.topleftFrame."+nick2+".closed)) top.close();");	
	} else {
		window.close();
	}
	return false;
}

function getObj2(name){
	if (window.document.getElementById) {
		return  window.document.getElementById(name);
	}
	else if (window.document.all) {
		return  window.document.all[name];
	}
	else if (window.document.layers) {
		return window.document.layers[name];
	}
}

function getTopObj(name){
	if (document.getElementById) {
		return  document.getElementById(name);
	}
	else if (document.all) {
		return  document.all[name];
	}
	else if (document.layers) {
		return document.layers[name];
	}
}

function newimg(ref) {
	getTopObj('immagine').src = ref;
}
function newvideo(ref) {
	getTopObj('immagine').src = ref;
}

function newimg2(ref) 
{
	getObj2('immagine').src = ref;
//	document.immagine.src=ref;
}
function newlink(ref) 
{
getObj2('link').href = ref;
}

function combine(ref1,ref2) {
	newimg2(ref1);
	newlink(ref2);
	return false;
}
function NewWindow2(mypage) {
day = new Date();
id = day.getTime();
popUp(mypage, id);
}

function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'toolbar=no,status=yes,location=no,scrollbars=yes,resizable=yes, height='+h+',width='+w;

win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
return win;
}
function OpenModal(url) {
	day = new Date();
	id = day.getTime();
	window.open(url, id, "scrollbars=yes,toolbar=no,location=no,status=yes,menubar=no,resizable=yes");
	return false;
}

///////////////////////////////////
function clickIE4() {
	if (event.button==2){
		alert(message);
		return false;
	}
}

function clickNS4(e){
	if (document.layers||document.getElementById&&!document.all) {
		if (e.which==2||e.which==3) {
			alert(message);
			return false;
		}
	}
}

if (document.layers) {
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown=clickNS4;
} else if (document.all&&!document.getElementById) {
	document.onmousedown=clickIE4;
}

function changeURI(uri,key,value) {
	var indice=uri.indexOf(key);
	if (indice>=0) {
		var prima=uri.substring(0,indice);
		var dopo=uri.substring(indice,uri.length);
		var indice2=dopo.indexOf("&");
		if (indice2>=0) {
			return prima+key+"="+value+dopo.substring(indice2,dopo.length);
		} else {
			return prima+key+"="+value;
		}
		
	} else {
		if (value!="") {
			if(uri.indexOf("?")>=0)
				return uri+"&"+key+"="+value;
			else {
				//alert(uri+"?"+key+"="+value);
				return uri+"?"+key+"="+value;
			}
		} else {
			return uri;
		}
		
	}
}

//var message="Function Disabled!";

//document.oncontextmenu=new Function("alert(message);return false")
