function cleanEmailForm(){
	document.logon.password.value="";
	document.logon.username.value="";
}

function printit(){
if (NS) {
    window.print() ;
} else {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(6, 2);
WebBrowser1.outerHTML = "";
}
}

function oggi()
{
	var  d  = new Date ();
	var gs  = d.getDay();
	var gg  = d.getDate();
	var mm  = d.getMonth()+1;
	var aa  = d.getFullYear();
	var hh  = d.getHours();
	var min = d.getMinutes();
	
	var giorni = new Array("Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab");
	var mesi = new Array("Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto","Settembre",
						"Ottobre","Novembre","Dicembre");

	if (gg < 10)
		gg = "0"+gg;

	if (mm < 10)
		mm = "0"+mm;

	if (hh < 10)
		hh = "0"+hh;

	if (min < 10)
		min = "0"+min;

	document.write (giorni[gs]+ " " +gg+" "+mesi[mm-1]+" "+aa);
}


var bookmarkurl="http://www.noale.info"
var bookmarktitle="Noale.Info"

function addbookmark(){
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
}

//var image = "1"
	
var number=3;
var random_number=0;

	function Random(){
	     today=new Date();
	     jran=today.getTime();
	     ia=9301;
	     ic=49297;
	     im=233280;
	     jran = (jran*ia+ic) % im;
	     random_number=Math.ceil( (jran/(im*1.0)) *number);
	}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function openWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}
// ====== HINTS ================================

function showHint(hintId) {
	hint = document.getElementById(hintId);
	pos = captureMousePosition(window.event);
	hint.style.left = pos['xMousePos'];
	hint.style.top = pos['yMousePos'];
	hint.style.visibility = "visible";
	return;
}

function hideHint(hintId) {
  	hint = document.getElementById(hintId);
	hint.style.visibility = "hidden";
	return;
}

function captureMousePosition(e) {
	var pos = new Array(); 
    if (document.layers) {
        pos['xMousePos'] = e.pageX;
        pos['yMousePos'] = e.pageY;
    } else if (document.all) {
        pos['xMousePos'] = window.event.x+document.body.scrollLeft;
        pos['yMousePos'] = window.event.y+document.body.scrollTop;
    } else if (document.getElementById) {
        pos['xMousePos'] = e.pageX;
        pos['yMousePos'] = e.pageY;
    }
    return pos;
}




function showElement(elementId) {
	//alert(elementId);
	el = document.getElementById(elementId);
	el.style.display = "block";
	return;
}

function hideElement(elementId) {
  	el = document.getElementById(elementId);
	el.style.display = "none";
	return;
}

function confirmSubmit(form){
	if(confirm("Sicuro di voler continuare?")){
		form.submit();
	}
}

function setBodyFontSize(val){
  var b = document.getElementById('content');
  if(val==1){
    b.style.fontSize = "100%";
  }
  if(val==2){
    b.style.fontSize = "110%";
  }
  if(val==3){
    b.style.fontSize = "120%";
  }
}
function incrementFontSize(){
        setFontSize(true);
}

function decrementFontSize(){
        setFontSize(false);
}

function getCurrentFontSize(){
        var tempSize = getCookie("fontSize");
        //if((tempSize != null) && (tempSize >= 80) && (tempSize <= 120)){
        if((tempSize != null)){
                fontSize = tempSize;
                alert("T: "+tempSize);
        }else{
                setCookie("fontSize", 100, "", "/");
                fontSize = 100;
        }
        return fontSize;        
}

function setFontSize(increment){
        var gap = 10;
        var currSize = getCurrentFontSize();
        var newSize;
        if(increment){
                newSize = parseInt(currSize) + gap;
        }else{
                newSize = parseInt(currSize) - gap;
        }
        setCookie("fontSize", newSize, "", "/");
        document.body.style.fontSize = newSize + "%";
}

function replaceSubstring(str, search, replace){
        //var escStr = escape(search);
        rExp = new RegExp(search,"gi");
        return str.replace(rExp, replace);
}

function setCookie(name, value, expires, path, domain, secure)
{
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}


function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}
