	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=yes,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 openWin(win_nm,nm)
	{
        	var h=screen.height;
	        h=h-150;
        	var myfeatures = 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no,resizable=yes,scrollbars=yes,width=650,height=475,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 checkVisibleDataList(idData,s,contentNameForMsgForStatus,formN)
{
	formN.optData.value = 'visibleDataList';
	formN.idDataL.value = idData;
	formN.visiblity.value = s;
	if(s == 'N')
		if(confirm(msgUnVisibleConfirm+" "+contentNameForMsgForStatus))
			formN.submit();
		else
			return false;
	else
		if(confirm(msgVisibleConfirm+" "+contentNameForMsgForStatus))
			formN.submit();
		else
			return false;

}
function isFileValid(fileControl) {
    var allow = "bmp jpg png gif jpeg";
    var fileType = fileControl.value;
    fileType = fileType.substr(fileType.lastIndexOf(".")+1).toLowerCase();
    if(allow.indexOf(fileType) == -1) {
        alert(msgInvalidFileType);
        return false;
    }
    return true;
}//isFileValid
