// JavaScript Document
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}



function apriClub() {
	// (uso url assoluto per non rimanere in sito ADV)
	window.top.document.location="http://www.giramondo.it/club/F_home2.cfm";
	MM_openBrWindow('http://www.giramondo.it/club/index.cfm?vaiA=index2.cfm','ClubGiraMondo','fullscreen');
}

function apriPopup(w,h,url,name,resizable,scrollbars) {
	var WW=w;
	var WH=h;
	var WX=screen.availWidth/2-WW/2;
	var WY=screen.availHeight/2-WH/2;

	window.open(url,name,"width="+WW+",height="+WH+",top="+WY+",left="+WX+",location=no,menubar=no,resizable="+resizable+",scrollbars="+scrollbars+",status=yes,titlebar=no,toolbar=no").focus();
}

function apriPopup2(mylink, windowname, width, height, resizable, scrollbars, modal) {
	var w = width || 400;
	var h = height || 300;
	var x = screen.availWidth/2 - w/2;
	var y = screen.availHeight/2 - h/2;
	var resize = resizable || "yes";
	var scroll = scrollbars || "yes";
	var modal = modal || "yes";
	if (! window.focus) {
		return true;	
	}
	var href;
	if (typeof(mylink) == 'string') {
		href = mylink;
	}
	else {
	   href = mylink.href;		
	}
	try {
		window.open(href, windowname,"width="+w+",height="+h+",top="+y+",left="+x+",location=no,menubar=no,resizable="+resize+",scrollbars="+scroll+",status=yes,titlebar=no,toolbar=no,modal="+modal+"").focus();		
	} catch(e) {
		//window.alert(e.description);
	}	
	return false;
}

String.prototype.capitalize = function() {
   return this.replace( /(^|\s)([a-z])/g , function(m,p1,p2){ return p1+p2.toUpperCase(); } );
}

function post2url(params) {
    var form = document.createElement('form');
    form.action = params.url || '';
    form.method = params.method || 'POST';
	form.target = params.target || '_self';
	postParams = params.postParams || {};
	
    for (var i in postParams) {
        if (postParams.hasOwnProperty(i)) {
            var input = document.createElement('input');
            input.type = 'hidden';
            input.name = i;
            input.value = postParams[i];
            form.appendChild(input);
        }
    }

    form.submit();
}

