﻿
function del()
{
    if(confirm("Are you sure you want to delete?"))
	{
		return true;
	}
	return false;
}

function WinOpen(url,width,height)
{  
   var result = window.showModalDialog(url,window,"dialogHeight:"+height+"px;dialogWidth:"+width+"px;center:yes;help:no;scroll:no;status:yes;")
   if(result != null)
   location.reload();
} 

function WinOpenResize(url,width,height)
{  
   var result = window.showModalDialog(url,window,"dialogHeight:"+height+"px;dialogWidth:"+width+"px;center:yes;help:no;scroll:yes;status:yes;")
   if(result != null)
   location.reload();
} 

function WinOpenReSize(url,width,height)
{  
   var result = window.showModalDialog(url,window,"dialogHeight:"+height+"px;dialogWidth:"+width+"px;center:yes;help:no;scroll:yes;status:yes;")
   if(result != null)
   location.reload();
} 

function showPanel(divName)
{
    hidePanel();
    document.getElementById(divName).style.display="";
}

function hidePanel()
{
    for(i=0;i<document.all.tags("DIV").length;i++)
    {
        if(document.all.tags("DIV")[i].id.indexOf('md_')==0)
        {
            document.all.tags("DIV")[i].style.display='none'
        }
    }
}



function isDate(v)
{
  var r = v.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/); 
  if(r==null)
return false; 
  var d = new Date(r[1], r[3]-1,r[4]); 
  return (d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]);
}
 


    


function showPanel1(divName)
{
    hidePanel1();
    document.getElementById(divName).style.display="";
}

function hidePanel1()
{
    for(i=0;i<document.getElementsByTagName("DIV").length;i++)
    {
        if(document.getElementsByTagName("DIV")[i].id.indexOf('sd_')==0)
        {
            document.getElementsByTagName("DIV")[i].style.display='none'
        }
    }
}


function SetCookie(name,value)
{
    var Days = 365;
    var exp   = new Date();
    exp.setTime(exp.getTime() + Days*24*60*60*1000);
    document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}


function getCookie(name)     
{
    var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
    if(arr != null) return unescape(arr[2]); return null;

}
function delCookie(name)
{
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval=getCookie(name);
    if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}

String.prototype.trim=function(){      
    return this.replace(/(^\s*)|(\s*$)/g, '');   
}  
