	function isBlank(s)
	{
		for(var i=0; i < s.length; i++)
		{
			var c = s.charAt(i);
			if((c!=' ')&&(c!="\n")&&(c!="\t"))
			return false;
		}
		return true;
    }
	function spWin(win_nm,nm,w,h)
	{
        	var hs=screen.height; hs=hs-80;
        	var ws=screen.width; ws=ws-10;
	        if(h>hs) h = hs ;
	        if(w>ws) w = ws ;
        	var myfeatures = 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no,resizable=yes,scrollbars=yes,width='+w+',height='+h+',left=0,top=0';
	        var newImg = open(win_nm,nm,myfeatures);
        	newImg.focus();
	}
	function spWinWithoutResize(win_nm,nm,w,h)
	{
        	var hs=screen.height; hs=hs-80;
        	var ws=screen.width; ws=ws-10;
	        if(h>hs) h = hs ;
	        if(w>ws) w = ws ;
        	var myfeatures = 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no,resizable=no,scrollbars=yes,width='+w+',height='+h+',left=0,top=0';
	        var newImg = open(win_nm,nm,myfeatures);
        	newImg.focus();
	}
	function openWin(win_nm,nm)
	{
        	var h=screen.height;
	        h=h-80;

        	var myfeatures = 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no,resizable=yes,scrollbars=yes,width=650,height=550,left=0,top=0';

	        var newImg = open(win_nm,nm,myfeatures);
        	newImg.focus();
	}
	function smallWin(win_nm,nm)
	{
        	var h=screen.height;
	        h=h-80;

	       	var myfeatures = 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no,resizable=yes,scrollbars=yes,width=500,height=220,left=0,top=0';

	        var newImg = open(win_nm,nm,myfeatures);
        	newImg.focus();
	}
	function confirmDel(ref)
	{
		if(confirm(msgDelConfirm))
			window.location.replace(ref);
		return;
	}

	function submitf(ref,id,id_ri)
	{
		document.sform.id_rc.value=id;
		document.sform.id_ri.value=id_ri;
		document.sform.action = ref;
		document.sform.submit();
	}

 	function validString(s) {
 		if((s.match(/^['&#\/,.a-zA-Z0-9 !@\?åÅäÄöÖ\n\r\f-]*$/) || s==""))
			return true;
		else
			return false ;
	}
	function delAttach(id)
	{
		if(confirm(msgDelConfirm))
		{
			document.dform.id_attach.value=id;
			document.dform.submit();
		}
	}

    	function getLength(s) {
		return s.length ;
    	}

	function checkData(str, max){
		if( getLength(s) > 0 && getLength(s) <= max){
			return true ;
		} else if( getLength(s) > max) {
			alert(msgMaxCharExceeded);
			return false ;
		}
		return true ;
	}

	function isFloat(s) {
		if(!s.match(/^\d{0,10}[,]{0,1}\d{0,2}$/))
			return false;
		else
			return true ;
    	}

    	function isNumber(s) {
		if(s.match(/^\d{0,10}$/) && s <= 2147483647)
			return true;
		else
			return false ;
    	}

	function spDelete(loc){
		if(confirm(msgDelConfirm)){
			document.location.href=loc;
			return true;
		}
	}

	function spOld(loc){
		if(confirm(msgOldConfirm)){
			document.location.href=loc;
			return true;
		}
	}

	function spActive(loc){
		if(confirm(msgActiveConfirm)){
			document.location.href=loc;
			return true;
		}
	}
	function isValidChar(s) {
		if(!validString(s)) {
			alert(msgValidCharAllowed);
			return false ;
		}
		else
			return true ;
    	}
function checkDelete(src,langNameAlert)
{
	conString = msgDelConfirm +" "+ langNameAlert;
	if(confirm(conString))
		window.location.replace(src);
}
function groupOfUrlFun(formName,category,winWidth,winHeight)
{
	cform = document.forms[formName] ;
	val = cform.groupOfUrl.checked ;
  if(val)
  {
  	spWin("addGroupUrl.php?category="+category,"myinyt",winWidth,winHeight);
	}
}
function groupofDocumentFun(formName,category,winWidth,winHeight)
{
	cform = document.forms[formName] ;
	val = cform.groupOfDocument.checked ;
  if(val)
  {
  	spWin("addGroupDocument.php?category="+category,"myinyt",winWidth,winHeight);
	}
}
function submitPageForLinkDocAndUrl(formNameForLink,item,winW,winH)
{
	cform = document.forms[formNameForLink];
	cform.linkToAdd.value=item;
	cform.winWidth.value=winW;
	cform.winHeight.value=winH;
	cform.submit();
}
function canclePageRedirect(formName)
{
	cform = document.forms[formName] ;
	val = cform.phpName.value;
	window.location = val;

}
function isEmailValid(email) {

    var ok = true;
    if (!(/^.+@.+\..{2,3}$/.test(email))) {
           ok = false;
    }

    if (email.match(/[\(\)\<\>\,\;\:\\\/\?\*\!\¤\%\&\'\$\#\"\[\]]/)) {
       ok = false;
    }
    return ok;
}//emailvalid
function isTimeValid(time) {

    var ok = true;
    if(!(/^[0-2][0-9]:[0-5][0-9]$/.test(time))){
        ok = false;
    }
    return ok;
}//timevalid

function urlValid(curl)
{
    var ok = true;
    if(!(/^.*\.(.*)\..{2,3}$/.test(curl)))
        ok = false;
    return ok;
}//urlvalid..over
function checkDeleteWithScroll(src,langNameAlert,ev) {
	conString = msgDelConfirm +" "+ langNameAlert;
	if(confirm(conString)) {
		//goToWithScroll(src,ev);
		window.location.replace(src);
		//window.location(src);
	}
		
}

function DoNav(theUrl,a,b,wid,hei,del,event) {
	//theUrlArr[0] = theUrl;
	atest=b;
	alignment = 'height='+hei+',width='+wid+'resizable=yes,scrollbars=yes';
	//alignment = 'height='+hei+',width='+wid+'resizable=yes,scrollbars=no';
	if(!apr && !del){
		if(b=='td'){
			from='a';
			document.location.href = theUrl;
		}
		else
			window.open(theUrl,'',alignment);
	}
	apr='a';
	
	if(del == 'delete'){
		checkDeleteWithScroll(theUrl,'?',event)
		apr='a';
	}
	
}

function func1(){
	if(!from){
		//window.location.reload();
		if(atest == 'lnk')
			apr = '';
	}
}

function isPosNumber(s) {
	if(s < 0)
		return true;
	else
		return false;
	
}
function goToDel() {
    langNameAlert = "?";
    conString = msgDelConfirm +" "+ langNameAlert;
	if(confirm(conString)) {
		//document.changeSch.submit();
		return true;
	}
	return false;
}
function validCmpName(s) 
	{	
 		if((s.match(/^[a-zA-Z0-9]*$/) || s==""))
			return true;
		else
			return false 
		}
