/* SCRIPTS WRITTEN BY SITANSHU NANDA
Email sitanshunanda@gmail.com
*/
function confDel(confStr) {

    var conf = confirm(confStr);
    if(conf) {
        return true;
    }
    else {
        return false;
    }
}

<!--
//------------------FORM VALIDATION-----------------
var error_string;
var first_errorObj;
function chk_error(objName,errMsg){
        if(trim_str(objName.value)==''){
            error_string=error_string+errMsg+'\n';
            if(first_errorObj==null)
                {
                  first_errorObj=objName;
                }
            objName.focus();
        }
}


function checkEmail(str){

  //var str=document.validation.emailcheck.value
  var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
  if (filter.test(str)){
     return true;
  }
  else
  {
      alert("Please input a valid email address!");
      return false;
  }
}


function chk_number(objName,errMsg){
        if(!isNan(objName.value)){
            error_string=error_string+errMsg+'\n';
            if(first_errorObj==null)
                {
                  first_errorObj=objName;
                }
            objName.focus();
        }
}


ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
v6 = (document.getElementById)? true:false

function showDiv(layerid,img)
  {
//  document.getElementById(layerid).style.display ='inline';
    document.getElementById(layerid).style.display = ( document.getElementById(layerid).style.display == 'inline') ? 'none' : 'inline';
    //alert(img.src);
    img.src=((img.src.indexOf('icon_plus.gif')==-1)? 'images/icon_plus.gif' : 'images/icon_minus.gif');
  //if (ns4) document.layers[layerid].display = "inline"
  //else if (v6) document.getElementById(layerid).style.display = "inline";
  //else if (ie4) document.all[layerid].style.display = "inline"
  }

function hideDiv(layerid)
  {
  if (ns4) document.layers[layerid].display = "none";
  else if (v6) document.getElementById(layerid).style.display = "none";
  else if (ie4) document.all[layerid].style.display = "none";
  }
  


//Funtion to trim the variable. Lines 18
function trim_str(variable){
var icount=0;
var var_len=variable.length;
for (icount=0;icount<=var_len;icount++){
if(variable.charAt(0)==' '){
variable=variable.substring(1,variable.length);
}
}
var_len=variable.length;
for (icount=0;icount<=var_len;icount++){
if (variable.charAt(variable.length-1)==' '){
variable=variable.substring(0,variable.length-1);
}
}
return variable;
}

//End of funtion to trim the variable
/*
in html pages use the function below.
function validate_form(frm) {
    error_string='';
    first_errorObj=null;
    chk_error(frm.client_loginid,"Login Id cannot be blank.");
    if (error_string!="")
    {
        alert(error_string);
        first_errorObj.focus();
        return (false);
    }
}
*/
//------------------xxxxxxx-----------------
//-->

// OPEN NEW WINDOW //
function NewWindow(mypage,myname,w,h,scrol){
        LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
        TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
        settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scrol+',resizable';
        win = window.open(mypage,myname,settings)
        win.focus();

}

function createCookie(name,value,days)
{
  
  
    var date = new Date();
    date.setTime(date.getTime());
    var expires ="";// "; expires="+date.toGMTString();
  
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name)
{
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++)
  {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

//CREATE AJEX OBJECT
function getAjexObject(){
  try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
  try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
  try { return new XMLHttpRequest(); } catch(e) {}
  alert("XMLHttpRequest not supported");
  return null;
}

