

String.prototype.Trim=function()
{
	return this.replace(/(^\s*)|(\s*$)/g,"");
}

function getObj(id)
{
	return document.getElementById(id);
}


function getHttpRequest( URL )
{
    var xmlhttp = null;

    if( window.XMLHttpRequest )
    {
        xmlhttp = new XMLHttpRequest();
    }
    else
    {
        xmlhttp = new ActiveXObject( "Microsoft.XMLHTTP" );
    }
    xmlhttp.open( 'GET', URL, false );
    xmlhttp.onreadystatechange = function()
    {
        if( xmlhttp.readyState==4 && xmlhttp.status == 200 && xmlhttp.statusText=='OK' )
        {
            responseText = xmlhttp.responseText;
        }
    }
    xmlhttp.send( '' );
    return responseText = xmlhttp.responseText;
}


function IsDate(dateval){
     var arr = new Array();
    
     if(dateval.indexOf("-") != -1){
         arr = dateval.toString().split("-");
     }else if(dateval.indexOf("/") != -1){
         arr = dateval.toString().split("/");
     }else{
         return false;
     }
    

     //yyyy-mm-dd || yyyy/mm/dd
     if(arr[0].length==4){
         var date = new Date(arr[0],arr[1]-1,arr[2]);
         if(date.getFullYear()==arr[0] && date.getMonth()==arr[1]-1 && date.getDate()==arr[2]){
             return true;
         }
     }
     //dd-mm-yyyy || dd/mm/yyyy
     if(arr[2].length==4){
         var date = new Date(arr[2],arr[1]-1,arr[0]);
         if(date.getFullYear()==arr[2] && date.getMonth()==arr[1]-1 && date.getDate()==arr[0]){
             return true;
         }
     }
     //mm-dd-yyyy || mm/dd/yyyy
     if(arr[2].length==4){
         var date = new Date(arr[2],arr[0]-1,arr[1]);
         if(date.getFullYear()==arr[2] && date.getMonth()==arr[0]-1 && date.getDate()==arr[1]){
             return true;
         }
     }
    
     return false;
}
