
function showObject(div_name) {
    var dS = document.getElementById(div_name);    
    dS.style.display = 'inline';
}

function hideObject(div_name) {    
    var dS = document.getElementById(div_name);    
    dS.style.display = 'none';
}

function invite()
{
    window.open("index.php?mod=frontpage&com=showInvite&blank=true", "Invite", "status=1,toolbar=0,location=0,menubar=0,resizable=1,scrollbars=1,height=400,width=500" );
}

function onlineStatus(i)
{
    httpPost('http://dev.uqudos.nl/online.php','i='+i);
    setTimeout('onlineStatus('+i+')',60000); // divided by 1000 for seconds
}

function checkForgotLive(doit)
{
    email = document.forms['frmForgotLogin'].elements['email'].value;
    verification = document.forms['frmForgotLogin'].elements['verification'].value;
    if(email && verification)
    {
        xmlreqPOST('../../index.php?mod=usermanager&com=checkForgotLive&ajax=true','doit='+doit+'&email='+email+'&verification='+verification);
    }
}

function forgotLogin(type)
{
    if(type=='username')
    {
        window.open("../../index.php?mod=usermanager&com=showForgotLogin&blank=true&doit="+type, "Forgot Password / Username", "status=1,toolbar=0,location=0,menubar=0,resizable=0,scrollbars=0,height=500,width=500" );
    }
    if(type=='password')
    {
        window.open("../../index.php?mod=usermanager&com=showForgotLogin&blank=true&doit="+type, "Forgot Password / Username", "status=1,toolbar=0,location=0,menubar=0,resizable=0,scrollbars=0,height=500,width=500" );
    }
}

var W3CDOM = (document.createElement && document.getElementsByTagName);

function init() {
	if (!W3CDOM) return;
	var fakeFileUpload = document.createElement('div');
	fakeFileUpload.className = 'fakefile';
	fakeFileUpload.appendChild(document.createElement('input'));
	var image = document.createElement('img');
	image.src='/templates/front/default/button_select.gif';
	fakeFileUpload.appendChild(image);
	var x = document.getElementsByTagName('input');
	for (var i=0;i<x.length;i++) {
		if (x[i].type != 'file') continue;
		if (x[i].getAttribute('noscript')) continue;
		if (x[i].parentNode.className != 'fileinputs') continue;
		x[i].className = 'file hidden';
		var clone = fakeFileUpload.cloneNode(true);
		x[i].parentNode.appendChild(clone);
		x[i].relatedElement = clone.getElementsByTagName('input')[0];
		if (x[i].value)
			x[i].onchange();
		x[i].onchange = x[i].onmouseout = function () {
			this.relatedElement.value = this.value;
		}
	}
}




/* QUIRKSMODE JAVASCRIPT */
window.onload = function () {
	if (self.init)
		init();
/* Miscellaneous */
if (self.initBilingual)
	initBilingual();
}

/* XMLHTTP */
function sendRequest(url,callback,postData) {
	var req = createXMLHTTPObject();
	if (!req) return;
	var method = (postData) ? "POST" : "GET";
	req.open(method,url,true);
	req.setRequestHeader('User-Agent','XMLHTTP/1.0');
	if (postData)
		req.setRequestHeader('Content-type','application/x-www-form-urlencoded');
	req.onreadystatechange = function () {
		if (req.readyState != 4) return;
		if (req.status != 200 && req.status != 304) {
		//	alert('HTTP error ' + req.status);
			return;
		}
		callback(req);
	}
	if (req.readyState == 4) return;
	req.send(postData);
}


function submitViaEnter(evt)
{
    evt = (evt) ? evt : event;
    var target = (evt.target) ? evt.target : evt.srcElement;
    var form = target.form;
    var charCode = (evt.charCode) ? evt.charCode :
        ((evt.which) ? evt.which : evt.keyCode);
    if (charCode == 13) {
        form.submit();
        return false;
    }
    return true;
}

function textCounter(field,cntfield,maxlimit)
{
    if (field.length > maxlimit)
    {
        field = field.substring(0, maxlimit);
    }
    else
    {
        document.getElementById(cntfield).innerHTML=maxlimit - field.length;
    }
}

