history.forward(1); 
//ClassCodes...
function updateParentWindow()
{
    //alert(document.getElementById('<%= hdnTest.ClientID %>'));
    alert(document.getElementById('hdnTest'));
    
}
function updateParentWindow1()
{
    updateParentWindow();
    window.close();
    
}


//help functionality
function ControlHelp(ControlName,path)
{

	
	window.open(path+"HelpViewer.aspx?CValue="+ControlName,"Help","width=380,height=450,top=200,left=500,toolbars=no,scrollbars=no,status=no,resizable=yes");
}
 function ValIsDateFormat()
 {
	var keyCode
	if (document.all)
	{
		keyCode = event.keyCode;
	}
	else
	{
		keyCode = event.which;
	}
	if(keyCode <47 || keyCode >=58)
	{ 
		return false;
	}
	return true;
 }
  //Check for Numeric entry at the time of keypress
	function valIsNumeric()
	{
		var keyCode
		
		if (document.all)
		{
		keyCode = event.keyCode
		}
		else
		{
			keyCode = event.which
		}
		if(keyCode <48 || keyCode >=58)
		{ 
		return false
		}
		return true
	}
  
  
  //  check for valid numeric strings			
      function alphanumeric(strString)
      {
	     var strValidChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
         var strChar;
         var blnResult = true;

         if (strString.length == 0) return false;

         //  test strString consists of valid characters listed above
        
         strChar = strString.charAt(0);
         if (strValidChars.indexOf(strChar) == -1)
         {
                blnResult = false;
         }
         return blnResult;
    }
    
    //check for valid numeric strings	
    function IsNumeric(strString)
    {
         var strValidChars = "0123456789";
         var strChar;
         var blnResult = true;

         if (strString.length == 0) return false;

         //  test strString consists of valid characters listed above
        
         strChar = strString.charAt(0);
         if (strValidChars.indexOf(strChar) == -1)
         {
                blnResult = false;
         }
         return blnResult;
   }


function trim(str)
{
	return str.replace(/^\s*|\s*$/g,"");
}

function ShowPageHelp(Page)
{
	window.open("HelpViewer.aspx?Page="+Page,"Help","width=380,height=450,top=200,left=500,toolbars=no,scrollbars=yes,status=no,resizable=yes");		
}
function GetDate(CtrlName)
{
	ChildWindow = window.open('popupCalendar.aspx?FormName=' + document.forms[0].name + 
							'&CtrlName=' + CtrlName + 
							'&SelDate=' +  document.forms[0].elements[CtrlName].value  , 
							"PopUpCalendar", "width=270,height=300,top=200,left=200,toolbars=no,scrollbars=no,status=no,resizable=yes");
}	

function GetDate(CtrlName, minDate, maxDate)
{
	ChildWindow = window.open('popupCalendar.aspx?FormName=' + document.forms[0].name + 
							'&CtrlName=' + CtrlName + 
							'&SelDate=' +  document.forms[0].elements[CtrlName].value  +
							'&MinDate=' + minDate +
							'&MaxDate=' + maxDate, 
							"PopUpCalendar", "width=270,height=300,top=200,left=200,toolbars=no,scrollbars=no,status=no,resizable=yes");
}

function AddOption(selectbox,text,value )
{
	var optn = document.createElement("OPTION");
	optn.text = text;
	optn.value = value;
	selectbox.options.add(optn);
}
function RemoveAllOptions(selectbox)
{
	var i;
	for(i=selectbox.options.length-1;i>=0;i--)
	{
		selectbox.remove(i);
	}
}
function SelectOptionByValue(selectbox, value)
{
	var i;
	for(i= 0;i < selectbox.options.length ;i++)
	{		
		if (selectbox.options[i].value == value)
			selectbox.options[i].selected = true;
	}
}

function PopulateOptionsFromArray(selectbox, arrayList)
{
	for(i= 0;i < arrayList.length ;i++)
	{		
		AddOption(selectbox, arrayList[i], arrayList[i]);
	}
}

function OpenSendEmail(psURLParams)
{
	window.open("Sendmail.aspx","SendMail","width=400,height=200,top=10,left=100,toolbars=no,scrollbars=yes,status=no,resizable=no");	
}

// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isValidEmail(str)
     {
      	var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true					
	 }


function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		return false
	}
return true
}

/***********************************************
* Pop-it menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var defaultMenuWidth="150px" //set default menu width.

var linkset=new Array()
//SPECIFY MENU SETS AND THEIR LINKS. FOLLOW SYNTAX LAID OUT

linkset[0]='<a href="ClientList.aspx">Client List</a>'
linkset[0]+='<a href="ClientDetails.aspx">Edit Client Details</a>'
linkset[0]+='<a href="ClientList.aspx">Product List</a>'
linkset[0]+='<a href="ClientList.aspx">Main Quote Vault</a>'

var ie5=document.all && !window.opera
var ns6=document.getElementById

if (ie5||ns6)
document.write('<div id="popitmenu" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>')

function iecompattest(){
return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body
}

function showmenu(e, which, optWidth){
if (!document.all&&!document.getElementById)
return
clearhidemenu()
menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu")
menuobj.innerHTML=which
menuobj.style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth
menuobj.contentwidth=menuobj.offsetWidth
menuobj.contentheight=menuobj.offsetHeight
eventX=ie5? event.clientX : e.clientX
eventY=ie5? event.clientY : e.clientY
//Find out how close the mouse is to the corner of the window
var rightedge=ie5? iecompattest().clientWidth-eventX : window.innerWidth-eventX
var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<menuobj.contentwidth)
//move the horizontal position of the menu to the left by it's width
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-menuobj.contentwidth+"px" : window.pageXOffset+eventX-menuobj.contentwidth+"px"
else
//position the horizontal position of the menu where the mouse was clicked
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX+"px" : window.pageXOffset+eventX+"px"
//same concept with the vertical position
if (bottomedge<menuobj.contentheight)
menuobj.style.top=ie5? iecompattest().scrollTop+eventY-menuobj.contentheight+"px" : window.pageYOffset+eventY-menuobj.contentheight+"px"
else
menuobj.style.top=ie5? iecompattest().scrollTop+event.clientY+"px" : window.pageYOffset+eventY+"px"
menuobj.style.visibility="visible"
return false
}

function contains_ns6(a, b) {
//Determines if 1 element in contained in another- by Brainjar.com
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function hidemenu(){
if (window.menuobj)
menuobj.style.visibility="hidden"
}

function dynamichide(e){
if (ie5&&!menuobj.contains(e.toElement))
hidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
hidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu(){
if (window.delayhide)
clearTimeout(delayhide)
}

if (ie5||ns6)
document.onclick=hidemenu


/***********************************************
end of
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
