sito = "ok";
var flashing = 0;

(function(){

	/*Use Object Detection to detect IE6*/
	var  m = document.uniqueID /*IE*/
	&& document.compatMode  /*>=IE6*/
	&& !window.XMLHttpRequest /*<=IE6*/
	&& document.execCommand ;
	
	try{
		if(!!m){
			m("BackgroundImageCache", false, true) /* = IE6 only */ 
		}
		
	}catch(oh){};
})();

function bsize()
	{
	var xwidth = (document.layers) ? parent.window.innerWidth : parent.document.body.clientWidth;
	document.getElementById("divt").align = "left";

    if (xwidth >= "1570")
		{
		document.getElementById("sx").width = "300";
		document.getElementById("sx").align = "right";
        document.getElementById("sx").style.backgroundColor = "#000000";
		document.getElementById("dx").width = "300";
		document.getElementById("dx").align = "left";
		document.getElementById("dx").style.backgroundColor = "#000000";
		}

	else if (xwidth >= "1255")
		{
		document.getElementById("sx").width = "130";
        document.getElementById("sx").align = "left";
        document.getElementById("sx").style.backgroundColor = "#000000";
		document.getElementById("dx").width = "130";
        document.getElementById("dx").align = "right";
		document.getElementById("dx").style.backgroundColor = "#000000";
		}

	else if (xwidth >= "1130")
		{
		document.getElementById("sx").width = "130";
        document.getElementById("sx").align = "left";
		document.getElementById("sx").style.backgroundColor = "#000000";
		document.getElementById("dx").width = "1";
		document.getElementById("dx").style.backgroundColor = "#000000";
		}

	else if (xwidth < "1130")
		{
		document.getElementById("sx").width = "1";

		document.getElementById("dx").width = "1";
		}
	}

function over(x)
	{
document.getElementById(x).style.backgroundColor = '#FFFF00';
	}

function out(y)
	{
	document.getElementById(y).style.backgroundColor = '#FFFFFF';
	}
	
function gover(x)
	{
x.style.backgroundColor = '#FFFF00';
	}

function gout(y)
	{
y.style.backgroundColor = '#FFFFFF';
	}
function startFlash(x){
if (flashing == 0){
document.getElementById(x).style.borderColor="#000000";
flashing=1;
}
else if (flashing == 1){
document.getElementById(x).style.borderColor="#FF6600";
flashing=2;}
else if (flashing == 2){
document.getElementById(x).style.borderColor="#FFFF00";
flashing=0;
}


}
function m_over2(x){
var cel = document.getElementById(x);
for (var i = 0; i < cel.childNodes.length; i++) {
var divNode = cel.childNodes[i]
if (divNode.nodeType == 1) {
var children = divNode.childNodes;
    }
}
children[0].style.color = '#565600';
cel.style.backgroundColor = '#272700';

}
function m_out2(y,z){
var cel = document.getElementById(y);
for (var i = 0; i < cel.childNodes.length; i++) {
var divNode = cel.childNodes[i]
if (divNode.nodeType == 1) {
var children = divNode.childNodes;
    }
}
cel.style.backgroundColor = z;
children[0].style.color = z;

	}
function m_over(x){
document.getElementById(x).style.backgroundColor = '#FFFF00';
flashingborder = setInterval("startFlash('"+x+"')",150);
}
function m_out(y,z){
document.getElementById(y).style.backgroundColor = z;
clearInterval(flashingborder);
if (z == "#FF0"){
document.getElementById(y).style.borderColor= "#FFFF00";
} else {
document.getElementById(y).style.borderColor= "#FFFFFF";
}
	}
	


function info(k)
	{
	infofunction:

	switch (k)
		{
		case "n":
			infon = open("info/infon.htm",
						 "infon",
						 "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizeble=no, width=400, height=400");
			infon.focus();
			break infofunction
			
		case "t":
			infot = open("info/infot.htm",
						 "infot",
						 "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizeble=no, width=400, height=400");
			infot.focus();
			break infofunction
			
		case "s":
			document.getElementById("news").src = "infos.htm";
			break infofunction
		case "reg":
			registra = open("http://forum.tweakness.net/index.php?act=Reg");
		}

	}


function flash(what)
	{
	var IE = navigator.appName.indexOf("Microsoft") != -1;
	var Opera = navigator.userAgent.indexOf("Opera") != -1;

	var filmato = IE || Opera ? window.menu : window.document.menu;
	if (filmato){
	var percentuale = filmato.PercentLoaded();

	if (percentuale == 100)
		{
		var frame = filmato.GetVariable("_root.nav");

		var clip = "_root.java";

		if (frame != what)
			{
			filmato.TCallLabel(clip, what);
			}
		filmato.SetVariable("_root.nav", what);
		} 
	} else {return;}
	}

function showimg(img)
	{
	imgpop = open("../popimg.php?img=" + img,
				  "imgpop",
				  "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizeble=no, width=640, height=480");
	}

function email(){
indirizzo = document.ind.to.value; 
var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
if (!email_reg_exp.test(indirizzo) || (indirizzo == "") || (indirizzo == "undefined")) {
   alert("Inserire un indirizzo email corretto.");
   news.document.ind.to.select();
   return false;
}
else{

news.document.email.action = "mailto:" + indirizzo + "?subject=Segnalazione notizia da www.tweakness.net";
news.document.email.testo.name = "===";
news.document.email.submit();
}}

function showfile(fid)
	{
	file = open("./showfiles.php?fid=" + fid,
				  "file" + fid,
				  "");
	}
	
function showtweak(peso, tid)
	{
	peso = (peso * 200);
	
	tweakpop = open("../poptweak.php?tid=" + tid,
				  "tweakpop" + tid,
				  "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizeble=no, width=468, height="+ peso);
	}
function openw(k){
twiki = open(""+k);
			twiki.focus();
	}
function cerca_wiki(x) {
chiavi_store = document.getElementById('F_C').value;
if (x == 0 && chiavi_store != "") {chiavi = chiavi_store;}
else if (x == 1 && chiavi != "") {
chiavi_send = "http://wiki.tweakness.net/wiki/Speciale:Ricerca?search=" + chiavi + "&go=Vai";
twiki = open(""+chiavi_send);
			twiki.focus();
}
}
	
function mailobs(u,s) {
    pre = "mail";
    url = pre + "to:" + u;
    document.location.href = url + "@tweakness.net" + "?subject=" + s;
	}
	
	
function subx(f,e) { 
if(f){
	var str = getFormValues(f); 
	if (str){
	switch (e){
	case "tweak_x":
		xmlReq =  tweak_x(str);
		break;
	case "poll":
		xmlReq =  poll(str);
		break;
	case "news_x":
		xmlReq =  news_x(str);
		break;
	case "download_x":
		xmlReq =  download_x(str);
		break;
	case "commenta":
		xmlReq =  commenta(str);
		break;
	case "login_topic":
		str_val = str.substring(0,3);
if (str_val == "use" || str_val == "log") {
	xmlReq = login_topic(str); 
	}
		break;
			
	}
	}  
}
}
	
	function subd(f) { 
	var str = getFormValues(f); 
	xmlReq = download_x(str);  
}
function check_change(g) { 
	if (g.checked == false) {g.value = "";}
	else {g.value = 1;}
	
}

function Trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}

function validate()
	{
	textareax = Trim(document.commento.post.value);
	if (textareax.length > 10 && textareax != "")
		{
		document.commento.stopic.disabled = false;
		document.getElementById('comment_string').innerHTML = "Stai scrivendo qualcosa di sensato?";
		}

	else
		{
		document.commento.stopic.disabled = true;
		document.getElementById('comment_string').innerHTML = "Digita per attivare l'inserimento";
		}
	}
	
	function subi(f) { 
	var str = getFormValues(f); 
	xmlReq = commenta(str);  
}
	function logi(f) { 
	if(f){
	var str = getFormValues(f); 
	str_val = str.substring(0,3);
if (str_val == "use" || str_val == "log") {
	xmlReq = login_topic(str); 
	}
	} 
}
	function check_change(g) { 
	if (g.checked == false) {g.value = "";}
	else {g.value = 1;}
	
}
	function fix_submit(x,y) { 
	var IE = navigator.appName.indexOf("Microsoft") != -1;
	if (IE){
	var e = (typeof event != "undefined") ? event : window.event;
	if (e.keyCode==13 || e.keyCode==3) {
	subx(x,y);
	}
}
	}

