var ns4 = document.layers;
			var ns6 = document.getElementById && !document.all;
			var ie4 = document.all;
			
			function getObjectByID(Objid){	
				if(ns4)
				{
					return eval('document.' + Objid)
				}
				if(ns6)
				{
					return document.getElementById(Objid);
				}
				if(ie4)
				{
					return document.all(Objid);      
				}  
				return null
			}


			function SetText(objid,msg, fg, bg){
				if(!fg) fg = "#ff0000";
				if(!bg) bg = "#FFFFFF";
				
				var content = msg ;
				if(ns4)
				{
					objItm = eval('document.' + objid)
					objItm.document.write(content);
					objItm.document.close();
					objItm.visibility = "visible";
				}
				if(ns6)
				{
					document.getElementById(objid).innerHTML = content;
				}
				if(ie4)
				{
					document.all(objid).innerHTML=content;
				}  
			}
			
function check(val)
{
//alert(val);uncheck
	var con=0;
	for (var i=0; i<document.aspnetForm.length; i++)
	{
		if(document.aspnetForm.elements[i].type == "checkbox")
		{
			if ( document.aspnetForm.elements[i].checked == true )
			{
				con++;
			}
		}	
	}
	if (con==0)
	{
			alert('Please select at least a single record for more information.');
			return false;
	}
}

function checkheader(name)
{
	var con = 0;
	for (var i=0; i<document.aspnetForm.length; i++)
	{
		if(document.aspnetForm.elements[i].type == "checkbox")
		{			
			var chkname = document.aspnetForm.elements[i].name
			var ch = chkname.split("$");
			//var ch = chkname.split(":");
			if (ch[4] == name)
			{
				if ( document.aspnetForm.elements[i].checked == true )
				{
					con = 1;
					i = document.aspnetForm.length ;
				}
			}
		}	
	}
	
	if (con==1)
	{
		for (var i=0; i<document.aspnetForm.length; i++)
		{
			if(document.aspnetForm.elements[i].type == "checkbox")
			{
				document.aspnetForm.elements[i].checked = true ;
			}	
		}	
	}
	else
	{
		for (var i=0; i<document.aspnetForm.length; i++)
		{
			if(document.aspnetForm.elements[i].type == "checkbox")
			{
				document.aspnetForm.elements[i].checked = false ;
			}	
		}	
	}
}

function checkother(name)
{
	var con = 0;
	for (var i=0; i<document.aspnetForm.length; i++)
	{
		if(document.aspnetForm.elements[i].type == "checkbox")
		{			
			var chkname = document.aspnetForm.elements[i].name
			var ch = chkname.split("$");
			//var ch = chkname.split(":");
			if (ch[4] != name)
			{
				if ( document.aspnetForm.elements[i].checked == false )
				{
					con = 1 ;
					i = document.aspnetForm.length ;
				}
			}
		}	
	}
	if (con==1)
	{
		for (var i=0; i<document.aspnetForm.length; i++)
		{
			if(document.aspnetForm.elements[i].type == "checkbox")
			{			
				var chkname = document.aspnetForm.elements[i].name
				var ch = chkname.split("$");
				//var ch = chkname.split(":");
				if (ch[4] == name)
				{
					document.aspnetForm.elements[i].checked = false ;
					i = document.aspnetForm.length ;
				}
			}	
		}	
	}
	
}

/////////////////////

function checkheader1(name)
{
    var test =0;
	var con = 0;
	for (var i=0; i<document.aspnetForm.length; i++)
	{
	    if(document.aspnetForm.elements[i].type == "checkbox")
		{	
			var chkname = document.aspnetForm.elements[i].name
			var ch = chkname.split("$");	
			//var ch = chkname.split(":");
			if (ch[4] == name)
			{
		        if ( document.aspnetForm.elements[i].checked == true )
				{
					con = 1;
					i = document.aspnetForm.length ;
				}
			}
		}	
	}
	
	if (con==1)
	{
		for (var i=0; i<document.aspnetForm.length; i++)
		{
		    if(document.aspnetForm.elements[i].type == "checkbox")
			{
			    test=document.aspnetForm.elements[i].name.indexOf("chkDelete")
			    if (test > 0)
			    {
			        document.aspnetForm.elements[i].checked = true ; 
			    }	
			}	
		}	
	}
	else
	{
		for (var i=0; i<document.aspnetForm.length; i++)
		{
			if(document.aspnetForm.elements[i].type == "checkbox")
			{
			test=document.aspnetForm.elements[i].name.indexOf("chkDelete")
			if (test > 0)
			{
			document.aspnetForm.elements[i].checked = false ;
			}
			}	
		}	
	}
}

function checkother1(name)
{
	var con = 0;
	for (var i=0; i<document.aspnetForm.length; i++)
	{
		if(document.aspnetForm.elements[i].type == "checkbox")
		{			
			var chkname = document.aspnetForm.elements[i].name
			var ch = chkname.split("$");
			//var ch = chkname.split(":");
			if (ch[4] != name)
			{
				if ( document.aspnetForm.elements[i].checked == false )
				{
					con = 1 ;
					i = document.aspnetForm.length ;
				}
			}
		}	
	}
	if (con==1)
	{
		for (var i=0; i<document.aspnetForm.length; i++)
		{
			if(document.aspnetForm.elements[i].type == "checkbox")
			{			
				var chkname = document.aspnetForm.elements[i].name
				var ch = chkname.split("$");
				//var ch = chkname.split(":");
				if (ch[4] == name)
				{
					document.aspnetForm.elements[i].checked = false ;
					i = document.aspnetForm.length ;
				}
			}	
		}	
	}
	
}

function resizeMe(imgObj){
	//alert(imgObj);
	hbuff = 90
	wbuff = 30		
if(typeof(imgObj) != "undefined"){			
	nheight = imgObj.height
	nwidth = imgObj.width
	if(nheight > 0 && nwidth > 0){
		maxhth  = screen.availHeight 
		maxwdh = screen.availWidth 
		//status = maxhth + " , " + maxwdh
		if(nwidth >= maxwdh-wbuff){
			nwidth = maxwdh - (wbuff + 10)
		}
		if(nheight >= maxhth-hbuff){															
			nheight = maxhth - (hbuff + 10)										
		}				
		resizeTo(nwidth + wbuff,nheight + hbuff)				
		midx = (maxwdh / 2) - ((nwidth + wbuff) / 2)				
		moveTo(midx,0)
		focus()
	}
}
}


function uncheck(val)
{
//alert(val);uncheck
	var con=0;
	for (var i=0; i<document.aspnetForm.length; i++)
	{
		if(document.aspnetForm.elements[i].type == "checkbox")
		{
			if ( document.aspnetForm.elements[i].checked == true )
			{
				con++;
			}
		}	
	}
	if (con==0)
	{
	    alert('Please Select Atleast One Record For Restore');
		return false;
    }
	else
	{
	    return confirm('This Will Restore All Recods Related To This, Are You Sure?');
	}
	
}

function checkrep(val)
{
	var con=0;
	for (var i=0; i<document.aspnetForm.length; i++)
	{
		if(document.aspnetForm.elements[i].type == "checkbox")
		{
			if ( document.aspnetForm.elements[i].checked == true )
			{
				con++;
			}
		}	
	}
	if (con==0)
	{
		alert('Please Select atleast one Lead for Assignment');
		return false;
    }
	else
	{
		return confirm('Selected lead(s) will be assigned to selected Rep. Click OK to continue');
	}
	
}

function checkprice(val)
{
	var con=0;
	for (var i=0; i<document.aspnetForm.length; i++)
	{
		if(document.aspnetForm.elements[i].type == "checkbox")
		{
			if ( document.aspnetForm.elements[i].checked == true )
			{
				con++;
			}
		}	
	}
	if (con==0)
	{
		alert('please select atleast one record');
		return false;
    }
}

function checkheadbuy(name)
{   
	var con = 0;
	for (var i=0; i<document.aspnetForm.length; i++)
	{
		if(document.aspnetForm.elements[i].type == "checkbox")
		{			
			var chkname = document.aspnetForm.elements[i].name
			var ch = chkname.split("$");
			//var ch = chkname.split(":");
			if (ch[4] == name)
			{
				if ( document.aspnetForm.elements[i].checked == true )
				{
					con = 1;
					i = document.aspnetForm.length ;
				}
			}
		}	
	}
	
	if (con==1)
	{
		for (var i=0; i<document.aspnetForm.length; i++)
		{
			if(document.aspnetForm.elements[i].type == "checkbox")
			{  
				if(document.aspnetForm.elements[i].disabled == true)
				{
				    document.aspnetForm.elements[i].checked = false ;
				}
				else
				{
				    document.aspnetForm.elements[i].checked = true ;
				}
			}	
		}	
	}
	else
	{
		for (var i=0; i<document.aspnetForm.length; i++)
		{
			if(document.aspnetForm.elements[i].type == "checkbox")
			{
				document.aspnetForm.elements[i].checked = false ;
			}	
		}	
	}
}

function checkEmailnew(myForm) {

if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm)){
return (true)
}
return (false)
}


function fillregistrationform() {

    document.aspnetForm.txtcompanyname.value = document.aspnetForm.txtcompanyname1.value;
    document.aspnetForm.txtmailingadd.value = document.aspnetForm.txtmailingadd1.value;
    document.aspnetForm.txtselfdesc.value = document.aspnetForm.txtselfdesc1.value;
    if (document.aspnetForm.ddltimezoneid1.value == "") {
        document.aspnetForm.ddltimezoneid.value = 0;
    }
    else {
        document.aspnetForm.ddltimezoneid.value = document.aspnetForm.ddltimezoneid1.value;
    }
    document.aspnetForm.chkapplydst.value = document.aspnetForm.chkapplydst1.value;
    document.aspnetForm.txtfirstname.value = document.aspnetForm.txtfirstname1.value;
    document.aspnetForm.txtlastname.value = document.aspnetForm.txtlastname1.value;
    document.aspnetForm.txtemailid.value = document.aspnetForm.txtemailid1.value;
    document.aspnetForm.txtcity.value = document.aspnetForm.txtcity1.value;
    if (document.aspnetForm.ddlstate1.value == "") {
        document.aspnetForm.ddlstate.value = 0;
    }
    else {
        document.aspnetForm.ddlstate.value = document.aspnetForm.ddlstate1.value;
    }
    document.aspnetForm.txtpostalcode.value = document.aspnetForm.txtpostalcode1.value;
    document.aspnetForm.txtusername.value = document.aspnetForm.txtusername1.value;
    document.aspnetForm.txtpassword.value = document.aspnetForm.txtpassword1.value;
    document.aspnetForm.txtconfirmpass.value = document.aspnetForm.txtconfirmpass1.value;
    document.aspnetForm.chkemail.value = document.aspnetForm.chkemail1.value;
}
