/**
 * Created by IntelliJ IDEA.
 * User: Sebastian Gamero
 * Date: 2010-nov-17
 * Time: 10:54:25
 * To change this template use File | Settings | File Templates.
 */


function popWinOpen(winW,winH,sUrl,sName,iResize,iScroll,iStatus) {
	if (screen) {
		if ((screen.height - winH) < 150) {
			var winX = (screen.width - winW) / 2;
			var winY = 0;
		} else {
			var winX = (screen.width - winW) / 2;
			var winY = (screen.height - winH) / 2;
		}
		var popWindow = window.open(sUrl,sName,"resizable=" + iResize + ",menubar=0,scrollbars=" + iScroll + ",status=" + iStatus + ",width=" + winW + ",height=" + winH + ",top=" + winY + ",left=" + winX + "");
		if (popWindow) popWindow.focus();
	} else {
		window.open(sUrl,sName,"resizable=" + iResize + ",menubar=0,scrollbars=" + iScroll + ",status=" + iStatus + ",width=" + winW + ",height=" + winH);
	}
}

function openForum(idx) {
	var oSel = document.getElementById("forumSelect" + idx) ;
	var path = oSel.options[oSel.selectedIndex].value ;
	if (path != "") {
		document.location = path ;
	}
}

function submitForm(formId) {
	document.getElementById(formId).submit() ;
}

function addFieldAndsubmitForm(formId, fieldId) {
	var form = document.getElementById(formId);

	var el = document.createElement("input");
   	el.type = "hidden";
   	el.name = fieldId+".x";
   	el.value = "1";

	form.appendChild(el);

	form.submit() ;
}

function setCookie(c_name,value,expiredays)
{
    var exdate=new Date();
    exdate.setDate(exdate.getDate()+expiredays);
    document.cookie=c_name+ "=" +escape(value)+
    ((expiredays==null) ? "" : ";expires="+exdate.toGMTString())+";path=";
}




