//Javascript name: General.js
//Date created: 28-Jan-2006 16:12
//Scripter: Ozan Pakyuz
//Website: http://www.opsoftware.co.uk
//Copyright (c) 2006 OP Software (UK) Ltd
//FileName: General.js
//Version: 0.8
//Contact: development@opsoftware.co.uk

/**
*Email PopUp
**/
var emailWin = null;
function emailPopup(url)
{
	var resizable = "yes"; 
    var styleLeft = window.screen.width - 500; 
	var windowStyle = "top=20,left=" + styleLeft + ",width=460,height=350,menubar=no,location=no,resizable=" + 
					resizable + ",toolbar=no,scrollbars=no,status=no,"; 
	if ( emailWin != null && !emailWin.closed )
		emailWin.close();
	emailWin = window.open(url,'emailWin',windowStyle); 
}

/**
*Tasks PopUp
**/
var taskWin = null;
function taskPopup(url)
{
	var resizable = "no"; 
    var styleLeft = window.screen.width - 700; 
	var windowStyle = "top=20,left=" + styleLeft + ",width=460,height=350,menubar=no,location=no,resizable=" + 
					resizable + ",toolbar=no,scrollbars=no,status=no,"; 
	if ( taskWin != null && !taskWin.closed )
		taskWin.close();
	taskWin = window.open(url,'taskWin',windowStyle); 
}

/**
*Dashboard Control
**/
	function toggleDashBoard() {
		if (document.getElementById) {
			if(document.getElementById("dashboard").style.display=="block") {
				document.getElementById("dashboard").style.display="none";

				document.getElementById("dashboardText").innerHTML="Show";
			}
			else {
				document.getElementById("dashboard").style.display="block";

				document.getElementById("dashboardText").innerHTML="Hide";
								
			}
		}
	}

/**
*Form Control
**/
	function toggleFrm(strFrm) {
		if (document.getElementById) {
			if(document.getElementById(strFrm).style.display=="block") {
				document.getElementById(strFrm).style.display="none";
			}
			else {
				document.getElementById(strFrm).style.display="block";
								
			}
		}
	}

/**
* Limit text area
**/
function taLimit() {
	var taObj=event.srcElement;
	if (taObj.value.length==taObj.maxLength*1) return false;
}

/**
* Text Area Counter
**/
function taCount(visCnt) { 
	var taObj=event.srcElement;
	if (taObj.value.length>taObj.maxLength*1) taObj.value=taObj.value.substring(0,taObj.maxLength*1);
	if (visCnt) visCnt.innerText=taObj.maxLength-taObj.value.length;
}

/**
* Confirm Password
**/
function ConfirmPassword() {
		var bolPassError = false;
		if (document.getElementById( 'frmAdd' ).elements['password'].value != document.getElementById( 'frmAdd' ).elements['confpassword'].value) bolPassError = true;
		if ((document.getElementById( 'frmAdd' ).elements['password'].value == "") && (document.getElementById( 'frmAdd' ).elements['confpassword'].value == "")) bolPassError = true;

		if (bolPassError){
			document.getElementById('confpasswordimg').style.display = "none";
		}else{
			document.getElementById('confpasswordimg').style.display = "inline";
		}
	}
/**
* Confirm Email address
**/
function ConfirmEmail() {
		var bolEmailError = false;
		if (document.getElementById( 'frmAdd' ).elements['email'].value != document.getElementById( 'frmAdd' ).elements['confemail'].value) bolEmailError = true;
		if ((document.getElementById( 'frmAdd' ).elements['email'].value == "") && (document.getElementById( 'frmAdd' ).elements['confemail'].value == "")) bolEmailError = true;

		if (bolEmailError){
			document.getElementById('confemailimg').style.display = "none";
		}else{
			document.getElementById('confemailimg').style.display = "inline";
		}
	}
