isIE = (document.all)? true:false
// Function to get the current document size.
function getDocumentSize() {
  var doc = new Object();
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    doc.width = window.innerWidth;
    doc.height = window.innerHeight;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    doc.width = document.documentElement.clientWidth;
    doc.height = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    doc.width = document.body.clientWidth;
    doc.height = document.body.clientHeight;
  }
  return doc;
}
//Function to prevent cursor at 500 letters

function textboxMultilineMaxNumber(txt,maxLen)

{

    // if(txt.value.length > (maxLen-1))

    // return false;

    if(txt.value.length > (maxLen-1))

    {

        txt.value = (txt.value).substr(0,maxLen-1);

        return false;

    }

}


// Function to resize the current document.
function resizeDocument(){
//	alert(document.body.clientHeight);
	var offSetHeight = 165;
	var obj = document.getElementById("applicationSection");
	//var obj1 = document.getElementById("mainContainerTable1");
	if(obj!= null)
	{
	    var docSize = getDocumentSize();	
//	    alert(docSize.height);
	    obj.style.height = docSize.height - offSetHeight + "px";
//	    alert(obj.style.height);
	}
//	obj.style.width = docSize.width  + "px";
//	var pageContainer = document.getElementById("pageCntr");
//	pageContainer.style.width = docSize.width  + "px";
	
	
	//obj1.style.height = docSize.height - 185 + "px";
}

function ConfirmAction(confirmMessage)
    {   
        if(window.confirm( confirmMessage))
        {   
            return true;
        }
        else
        {
            return false;
        }
        return false;
    }
function ConfirmAnserToCustomer(confirmMessage,redirectionURL)
{   
    if(window.confirm(confirmMessage))
    {   
        window.open(redirectionURL, 800, 500);         
    }
    else
    {
        return false;
    }
    return false;
}
    
function checkBrw(){
	var agt=navigator.userAgent.toLowerCase();
		if (agt.indexOf("opera") != -1) return 'Opera';
		if (agt.indexOf("staroffice") != -1) return 'Star Office';
		if (agt.indexOf("webtv") != -1) return 'WebTV';
		if (agt.indexOf("beonex") != -1) return 'Beonex';
		if (agt.indexOf("chimera") != -1) return 'Chimera';
		if (agt.indexOf("netpositive") != -1) return 'NetPositive';
		if (agt.indexOf("phoenix") != -1) return 'Phoenix';
		if (agt.indexOf("firefox") != -1) return 'Firefox';
		if (agt.indexOf("safari") != -1) return 'Safari';
		if (agt.indexOf("skipstone") != -1) return 'SkipStone';
		if (agt.indexOf("msie") != -1) return 'Internet Explorer';
		if (agt.indexOf("netscape") != -1) return 'Netscape';
		if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
		if (agt.indexOf('\/') != -1) {
		if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
		return navigator.userAgent.substr(0,agt.indexOf('\/'));}
		else return 'Netscape';} else if (agt.indexOf(' ') != -1)
		return navigator.userAgent.substr(0,agt.indexOf(' '));
		else return navigator.userAgent;
}

function expColl(id,imgName)
{
   var imgObj = document.images[imgName];
   var bFlag = (document.getElementById(id).style.display == "") ? 0 : 1;
	 if(bFlag){
		document.getElementById(id).style.display="";
		imgObj.src="Images/minus.gif";
		imgObj.alt="Hide Details";
		imgObj.title="Hide Details";
	}
	else{
		document.getElementById(id).style.display="none";
		imgObj.src="Images/plus.gif";
		imgObj.alt="Show Details";
		imgObj.title="Show Details";
	 }
}

function expCollHeader(id,imgName,expTitle,colTitle)
{
   var imgObj = document.images[imgName];
   var bFlag = (document.getElementById(id).style.display == "") ? 0 : 1;
	 if(bFlag){
		document.getElementById(id).style.display="";
		imgObj.src="../Images/up.png";
		imgObj.title=colTitle;
	}
	else{
		document.getElementById(id).style.display="none";
		imgObj.src="../Images/down.png";
		imgObj.title=expTitle;
	 }
}


function valuationType(obj){
	if(obj == "Financing"){
		//document.getElementById('vatLabel').style.display='';
		document.getElementById('priceRw').style.display='';
		document.getElementById('financeType').style.display='';
		//document.getElementById('financeTypeRw2').style.display='';
		}
	else{
		//document.getElementById('vatLabel').style.display='none';
		document.getElementById('priceRw').style.display='none';
		document.getElementById('financeType').style.display='none';
		//document.getElementById('financeTypeRw2').style.display='none';
		}	
}

function newExpert(obj){
	if(obj == "NewExpert"){
		document.getElementById('newExpertRw1').style.display='';
		document.getElementById('newExpertRw2').style.display='';
		}
	else{
		document.getElementById('newExpertRw1').style.display='none';
		document.getElementById('newExpertRw2').style.display='none';
		}	
}

function openPopWin(url,width,height)
{	
	//var divheight = document.getElementById("wapper").offsetHeight;
	
	//var divheight = document.getElementById('wapper')
	//alert(divheight);
	var newWindow;
	var i;
	var newHeight
	newWindow = window.open(url,"PopupSceern","menubar=no,toolbar=no,status=no,resizable=no,scrollbars=yes,width="+width+",height="+height);
	/*for(i = 0; i < newWindow.document.all.length; i++){
		if (newWindow.document.all(i).tagName == 'DIV')
	   		if (newWindow.document.all(i).id.toLowerCase() == 'wapper')
			{
				newHeight = newWindow.document.all(i).offsetHeight;
				newHeight = newHeight + 63;
				newWindow.resizeTo(width, newHeight)
			}
	}*/
	
	//alert(newWindow.document.getElementsByTagName('*'));
	//var obj = newWindow.document.getElementsByTagName('*')
	
	
	
	
	//my_window= window.open ("","mywindow1","status=1,width=350,height=150"); 
	//alert(my_window.document);
	return false;
}
function closeWindow(){
	window.close();
		}
function showHide(obj,id){
	var element = document.getElementById(id);
	if(element.style.display =="none"){
		element.style.display = "";
		obj.innerHTML = "Hide Details"
		}
	else{
		element.style.display ="none";
		obj.innerHTML = "Show Details"
		}	
}
function showHideLinks(obj,id){
	var element = document.getElementById(id);
	if(element.style.display =="none"){
		element.style.display = "";
		obj.innerHTML = "Hide Links"
		}
	else{
		element.style.display ="none";
		obj.innerHTML = "Show Links"
		}	
}

var ID;
function mainMenu(obj){
	if(ID != undefined) {
		dv = document.getElementById(ID);
		dv.className = '';
		dv = obj.parentNode;
		dv.className = 'leftNavCurrent';
		var x = obj.parentNode.id;
	}
	else{
		dv = obj.parentNode;
		dv.className = 'leftNavCurrent';
		var x = obj.parentNode.id;
		}
ID=x;
}

function Close()
{
 window.close();
}
		
function CallDateFun(sender, args)
{
   var date=document.getElementById("DateTextBox").value
  
   if(IsValidDate(date))
        args.IsValid=true;
   else
        args.IsValid=false;
 }
 function IsValidDate(date)
 {
    var dateArray = date.split("/");
    if(dateArray.length != 3)
    {
       return(false);
    }
    else
    {
        var Mn = dateArray[0];
        var Day= dateArray[1];
        var Yr = dateArray[2];
        
        if(Yr.length != 4)
        {
             return(false);
        }
        var dt = new Date(date);

        if(dt.getDate()!=Day)
        {
            //alert('Invalid Date');
            return(false);
        }
        else if(dt.getMonth()!=Mn-1)
        {
        //this is for the purpose JavaScript starts the month from 0
            //alert('Invalid Date');
            return(false);
        }
        else if(dt.getFullYear()!=Yr)
        {
            //alert('Invalid Date');
            return(false);
        }
     }
    return(true);
 }

function CalculationValidation(marketValueCheckBoxId, securityValueCheckBoxId, errorMessageCheckBox)
{
    var marketValueCheckBoxId = "TabContainer1_ValuationTabPanel_ObjectValuation_CalculationGrid_ctl01_IncludeMarketValueAnswerCheckBox";
    var securityValueCheckBoxId = "TabContainer1_ValuationTabPanel_ObjectValuation_CalculationGrid_ctl01_IncludeSecurityValueAnswerCheckBox";    
    if(!document.getElementById(marketValueCheckBoxId).checked && !document.getElementById(securityValueCheckBoxId).checked)
    {
     alert(errorMessageCheckBox);
     //return false;
    }
    //return true;
}
function ValidateRequestContentPage(userNameId,errorMessageInitialValue)
{
    var userName = trim(document.getElementById(userNameId).value);
    document.getElementById(userNameId).value = userName;
    
    if(userName == null || userName == "")
    {
        alert("Plese enter username.");
        document.getElementById(userNameId).focus();
        return false;
    }
   
    return true;
}
//function added by Srikrishna 
//Function to validate login page.
function ValidateLoginPage(userNameId,passwordId)
{
    
//    var userName = trim(document.getElementById('ctl00$ContentPlaceHolder1$TabContainer2$TabPanel6$UsernameTextBox').value);
//    var passWord = document.getElementById('ctl00$ContentPlaceHolder1$TabContainer2$TabPanel6$PasswordTextBox').value;   
//    document.getElementById('ctl00$ContentPlaceHolder1$TabContainer2$TabPanel6$UsernameTextBox').value = userName 
//    
//    
//    
//    //alert(userName);
//    if(userName == null || userName == "")
//    {
//        alert("Plese enter username.");
//        document.getElementById('ctl00$ContentPlaceHolder1$TabContainer2$TabPanel6$UsernameTextBox').focus();
//        return false;
//    }
//    if (passWord == null || passWord == "")
//    {
//        alert("Plese enter password.");
//        document.getElementById('ctl00$ContentPlaceHolder1$TabContainer2$TabPanel6$PasswordTextBox').focus();
//        return false;
//    }
//    if(passWord.length <  8)
//    {
//        alert('Password must be minimum of 8 characters');
//        document.getElementById('ctl00$ContentPlaceHolder1$TabContainer2$TabPanel6$PasswordTextBox').focus();    
//        return false;
//    }
//    if(passWord.length > 20)
//    {
//        alert('Password must be maximum of 20 characters');
//        document.getElementById('ctl00$ContentPlaceHolder1$TabContainer2$TabPanel6$PasswordTextBox').focus();    
//        return false;
//    }

//    alert("fsdfsdf");
//    var userNameTextBox = document.getElementById(userNameId);
//    alert(userNameTextBox.value);


    var userName = trim(document.getElementById(userNameId).value);
    var passWord = document.getElementById(passwordId).value;
    document.getElementById(userNameId).value = userName;
    
    if(userName == null || userName == "")
    {
        alert("Plese enter username.");
        document.getElementById(userNameId).focus();
        return false;
    }
    if (passWord == null || passWord == "")
    {
        alert("Plese enter password.");
        document.getElementById(passwordId).focus();
        return false;
    }
    if(passWord.length <  8)
    {
        alert('Password must be minimum of 8 characters');
        document.getElementById(passwordId).focus();    
        return false;
    }
    if(passWord.length > 20)
    {
        alert('Password must be maximum of 20 characters');
        document.getElementById(passwordId).focus();    
        return false;
    }
    return true;
}

// Function used to trim string on both the sides. 
//function added by Srikrishna
function trim(stringToTrim) 
{
   return stringToTrim.replace(/^\s+|\s+$/g,"");
}

//Check mandatory dropDown for ObjectClassification page
function Validate(ctrToVal1,ctrToVal2,ctrToVal3,errorMessage1,errorMessage2,errorMessage3)
{  
    var myindex = document.getElementById(ctrToVal1.id).selectedIndex;
    var myindex1 = document.getElementById(ctrToVal2.id).selectedIndex;
    var myindex2 = document.getElementById(ctrToVal3.id).selectedIndex;
    if(myindex > -1)
    {
        var dropDownVal = document.getElementById(ctrToVal1.id).options[myindex].value;
        if (dropDownVal == '')
        {
             alert(errorMessage1);
             document.getElementById(ctrToVal1.id).focus();
             return false;
        }            
    }
    else
    {
             alert(errorMessage1);
             document.getElementById(ctrToVal1.id).focus();
             return false;
    }
    if(myindex1 > -1)
    {
        var dropDownVal1 = document.getElementById(ctrToVal2.id).options[myindex1].value;
        if(dropDownVal1 == '')
        {
            alert(errorMessage2);               
            document.getElementById(ctrToVal2.id).focus();
            return false;
        }            
    }
    else
    {
            alert(errorMessage2);               
            document.getElementById(ctrToVal2.id).focus();
            return false;
    }
    if(myindex2 > -1)
    {
        var dropDownVal2 = document.getElementById(ctrToVal3.id).options[myindex2].value;
        if(dropDownVal2 == '')
        {
            alert(errorMessage3);               
            document.getElementById(ctrToVal3.id).focus();
            return false;
        }            
    }
    else
    {
            alert(errorMessage3);               
            document.getElementById(ctrToVal3.id).focus();
            return false;
    }
    
    return true;
}
//validate model year for object valuation
//scenariotype-used to identify the type of validation needed for different scenario
function ModelYearIsSelected(ctrToVal1,ctrlraisedby,strMessage,scenariotype)
{
 var myindex = document.getElementById(ctrToVal1.id).selectedIndex;  
 if(myindex > 0)
    {        
        return true ;  
    }
    else
    {
        if(scenariotype=="dropdownlist")
        {       
         document.getElementById(ctrlraisedby.id).selectedIndex = 0;        
        }
        alert(strMessage);
        
    }
    
}
// validate date with custom error message
function DateValidateMsg(ctrToVal,errorMessage,dateCondition)
{
    if(document.getElementById(ctrToVal.id).value != '')
    {     
        if(!IsValidDate(document.getElementById(ctrToVal.id).value))
        {
            alert(errorMessage);
            document.getElementById(ctrToVal.id).value = ""; 
            document.getElementById(ctrToVal.id).focus();
            return false;
        }      
        if(dateCondition == "GREATER")
        {
            if (CompareDates(new Date(document.getElementById(ctrToVal.id).value), 'GREATER'))
            {      
             alert(errorMessage);
             document.getElementById(ctrToVal.id).value = ""; 
             document.getElementById(ctrToVal.id).focus();    
             return false;
            }
        }
        else if(dateCondition == "LESSER")
        {
            if (CompareDates(new Date(document.getElementById(ctrToVal.id).value), 'LESSER'))
            {         
             alert(errorMessage);
             document.getElementById(ctrToVal.id).value = ""; 
             document.getElementById(ctrToVal.id).focus();    
             return false;
            }
        }
    }
    return true;
}


    function CompareDates(enteredDate, dateCondition)
    {
        var dateToday = new Date();  
        var month = dateToday.getMonth() + 1
        var day = dateToday.getDate()
        var year = dateToday.getFullYear()
        
        var enteredMonth = enteredDate.getMonth() + 1
        var enteredDay = enteredDate.getDate()
        var enteredYear = enteredDate.getFullYear()
        
        if(dateCondition == "GREATER")
        {
            if(enteredYear < year)
            {
                return true;
            }
            if(enteredMonth < month)
            {
                return true;
            }
            if(enteredDay < day)
            {
                return true;
            }
            return false;
        }

        else if(dateCondition == "LESSER")
        {
            if(enteredYear > year)
            {
                return true;
            }
            if(enteredMonth > month)
            {
                return true;
            }
            if(enteredDay > day)
            {
                return true;
            }
            return false;
        }
    }
   
//  check for valid numeric strings	    
function IsNumeric(strString,errMsg)
 {
   var strForValidate ;
   if(document.getElementById(strString).value != null)
   {
   strForValidate = document.getElementById(strString).value;  
   }
   var strValidChars = "0123456789.";
   var strChar;
   var blnResult = true;

   if(strForValidate != '')
   {
       //if (strString.length == 0) return false;
       //  test strString consists of valid characters listed above
       for (i = 0; i < strForValidate.length && blnResult == true; i++)
          {
          strChar = strForValidate.charAt(i);
          if (strValidChars.indexOf(strChar) == -1)
             {
             alert(errMsg);
             document.getElementById(strString).value = '';
             document.getElementById(strString).focus();
             blnResult = false;
             }
          }
    }
    return blnResult;
 }
 
 //for cc textbox
 function CCemailCheck (id, errorMessageForInvalidEmail)
 {
var emailStr=trim(document.getElementById(id).value);
if(emailStr=="")
{
    return true;
}
/* The following variable tells the rest of the function whether or not
to verify that the address ends in a two-letter country or well-known
TLD.  1 means check it, 0 means don't. */

var checkTLD=1;

/* The following is the list of known TLDs that an e-mail address must end with. */

var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

/* The following pattern is used to check if the entered e-mail address
fits the user@domain format.  It also is used to separate the username
from the domain. */

var emailPat=/^(.+)@(.+)$/;

/* The following string represents the pattern for matching all special
characters.  We don't want to allow special characters in the address. 
These characters include ( ) < > @ , ; : \ " . [ ] */

var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

/* The following string represents the range of characters allowed in a 
username or domainname.  It really states which chars aren't allowed.*/

var validChars="\[^\\s" + specialChars + "\]";

/* The following pattern applies if the "user" is a quoted string (in
which case, there are no rules about which characters are allowed
and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
is a legal e-mail address. */

var quotedUser="(\"[^\"]*\")";

/* The following pattern applies for domains that are IP addresses,
rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
e-mail address. NOTE: The square brackets are required. */

var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

/* The following string represents an atom (basically a series of non-special characters.) */

var atom=validChars + '+';

/* The following string represents one word in the typical username.
For example, in john.doe@somewhere.com, john and doe are words.
Basically, a word is either an atom or quoted string. */

var word="(" + atom + "|" + quotedUser + ")";

// The following pattern describes the structure of the user

var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

/* The following pattern describes the structure of a normal symbolic
domain, as opposed to ipDomainPat, shown above. */

var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

/* Finally, let's start trying to figure out if the supplied address is valid. */

/* Begin with the coarse pattern to simply break up user@domain into
different pieces that are easy to analyze. */

var matchArray=emailStr.match(emailPat);



if (matchArray==null) {

/* Too many/few @'s or something; basically, this address doesn't
even fit the general mould of a valid e-mail address. */

alert(errorMessageForInvalidEmail);
setfocusctrl(id);  
return false;
}
var user=matchArray[1];
var domain=matchArray[2];

// Start by checking that only basic ASCII characters are in the strings (0-127).

for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert(errorMessageForInvalidEmail);
setfocusctrl(id);  
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert(errorMessageForInvalidEmail);
setfocusctrl(id);  
return false;
   }
}

// See if "user" is valid 

if (user.match(userPat)==null) {

// user is not valid

alert(errorMessageForInvalidEmail);
setfocusctrl(id);  
return false;
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
host name) make sure the IP address is valid. */

var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {

// this is an IP address

for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert(errorMessageForInvalidEmail);
setfocusctrl(id);  
return false;
   }
}
return true;
}

// Domain is symbolic name.  Check if it's valid.
 
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
alert(errorMessageForInvalidEmail);
setfocusctrl(id);  
return false;
   }
}

/* domain name seems valid, but now make sure that it ends in a
known top-level domain (like com, edu, gov) or a two-letter word,
representing country (uk, nl), and that there's a hostname preceding 
the domain or country. */

if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert(errorMessageForInvalidEmail);
setfocusctrl(id);  
return false;
}

// Make sure there's a host name preceding the domain.

if (len<2) {
alert(errorMessageForInvalidEmail);
setfocusctrl(id);  
return false;
}

// If we've gotten this far, everything's valid!
return true;
}
 
 




function emailCheck(id, errorMessageForInvalidEmail, errorMessageForRequiredEmail) {

    try {
        var emailStr = trim(document.getElementById(id).value);
        
        /* The following variable tells the rest of the function whether or not
        to verify that the address ends in a two-letter country or well-known
        TLD.  1 means check it, 0 means don't. */

        var checkTLD = 1;

        /* The following is the list of known TLDs that an e-mail address must end with. */

        var knownDomsPat = /^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

        /* The following pattern is used to check if the entered e-mail address
        fits the user@domain format.  It also is used to separate the username
        from the domain. */

        var emailPat = /^(.+)@(.+)$/;

        /* The following string represents the pattern for matching all special
        characters.  We don't want to allow special characters in the address. 
        These characters include ( ) < > @ , ; : \ " . [ ] */

        var specialChars = "\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

        /* The following string represents the range of characters allowed in a 
        username or domainname.  It really states which chars aren't allowed.*/

        var validChars = "\[^\\s" + specialChars + "\]";

        /* The following pattern applies if the "user" is a quoted string (in
        which case, there are no rules about which characters are allowed
        and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
        is a legal e-mail address. */

        var quotedUser = "(\"[^\"]*\")";

        /* The following pattern applies for domains that are IP addresses,
        rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
        e-mail address. NOTE: The square brackets are required. */

        var ipDomainPat = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

        /* The following string represents an atom (basically a series of non-special characters.) */

        var atom = validChars + '+';

        /* The following string represents one word in the typical username.
        For example, in john.doe@somewhere.com, john and doe are words.
        Basically, a word is either an atom or quoted string. */

        var word = "(" + atom + "|" + quotedUser + ")";

        // The following pattern describes the structure of the user

        var userPat = new RegExp("^" + word + "(\\." + word + ")*$");

        /* The following pattern describes the structure of a normal symbolic
        domain, as opposed to ipDomainPat, shown above. */

        var domainPat = new RegExp("^" + atom + "(\\." + atom + ")*$");

        /* Finally, let's start trying to figure out if the supplied address is valid. */

        /* Begin with the coarse pattern to simply break up user@domain into
        different pieces that are easy to analyze. */

        var matchArray = emailStr.match(emailPat);

        if (emailStr == "") {
            alert(errorMessageForRequiredEmail);
            //setfocusctrl(id);    
            return false;
        }

        if (matchArray == null) {

            /* Too many/few @'s or something; basically, this address doesn't
            even fit the general mould of a valid e-mail address. */

            alert(errorMessageForInvalidEmail);
            setfocusctrl(id);
            return false;
        }
        var user = matchArray[1];
        var domain = matchArray[2];

        // Start by checking that only basic ASCII characters are in the strings (0-127).

        for (i = 0; i < user.length; i++) {
            if (user.charCodeAt(i) > 127) {
                alert(errorMessageForInvalidEmail);
                setfocusctrl(id);
                return false;
            }
        }
        for (i = 0; i < domain.length; i++) {
            if (domain.charCodeAt(i) > 127) {
                alert(errorMessageForInvalidEmail);
                setfocusctrl(id);
                return false;
            }
        }

        // See if "user" is valid 

        if (user.match(userPat) == null) {

            // user is not valid

            alert(errorMessageForInvalidEmail);
            setfocusctrl(id);
            return false;
        }

        /* if the e-mail address is at an IP address (as opposed to a symbolic
        host name) make sure the IP address is valid. */

        var IPArray = domain.match(ipDomainPat);
        if (IPArray != null) {

            // this is an IP address
            for (var i = 1; i <= 4; i++) {
                if (IPArray[i] > 255) {
                    alert(errorMessageForInvalidEmail);
                    setfocusctrl(id);
                    return false;
                }
            }
            return true;
        }

        // Domain is symbolic name.  Check if it's valid.
        var atomPat = new RegExp("^" + atom + "$");
        var domArr = domain.split(".");
        var len = domArr.length;
        for (i = 0; i < len; i++) {
            if (domArr[i].search(atomPat) == -1) {
                alert(errorMessageForInvalidEmail);
                setfocusctrl(id);
                return false;
            }
        }

        /* domain name seems valid, but now make sure that it ends in a
        known top-level domain (like com, edu, gov) or a two-letter word,
        representing country (uk, nl), and that there's a hostname preceding 
        the domain or country. */
        if (checkTLD && domArr[domArr.length - 1].length != 2 && domArr[domArr.length - 1].search(knownDomsPat) == -1) {
            alert(errorMessageForInvalidEmail);
            setfocusctrl(id);
            return false;
        }

        // Make sure there's a host name preceding the domain.

        if (len < 2) {
            alert(errorMessageForInvalidEmail);
            setfocusctrl(id);
            return false;
        }
    }
    catch(E)
    {
        // Don't bother....
    }
    
    // If we've gotten this far, everything's valid!
    return true;
}













//Function used for Confirmation on Cancel Button Click 
function CancelClick(cancelmessage)
{
    if(confirm(cancelmessage))
    {
	    return true;	
    }
    else
    {
	    return false;
    }
}

 //function ShowProductGuideInfo(levelId, level,elementId,parentId1,parentId2,classificationId)
 function ShowProductGuideInfo(url,elementId)
 {
    var myObj = document.getElementById(elementId);    
    var curleft = curtop = 0;
    if (myObj.offsetParent)
    { 
        curleft = myObj.offsetLeft
        curtop = myObj.offsetTop
        
        while (myObj = myObj.offsetParent)
        {
            curleft += myObj.offsetLeft
            curtop += myObj.offsetTop
        }        
    }
    //alert(<%=Server.MapPath('ProductGuide.aspx')%>);
    //window.open("../ProductGuide/ProductGuide.aspx?levelId="+levelId+"&level="+level+"&parentId1="+parentId1+"&parentId2="+parentId2+"&classificationId="+classificationId,null,"toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=200,height=200,top ="+curtop+",left ="+ curleft +"",null);
    window.open(url,null,"toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=250,height=340,top ="+curtop+",left ="+ curleft +"",null);
    return false;
 } 
 
 function openFullScreen(url,screenName,resize)
 {
    var w = screen.availWidth - 10;
	var h = screen.availHeight - 49;
	//alert(w + '-' + h);
    window.open(url,screenName,"toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=" + resize + ",width=" + w + ",height=" + h + "top =0,left =0",null);
    return false;
 }
 
function ValidateFileUpload(noFileMsg, invalidPathMsg, invalidFileTypemsg, id)
{
    var objUpload=eval("document.getElementById(id)");
    var sUpload=objUpload.value;
    if(sUpload=="")
    {
     alert(noFileMsg);
     event.returnValue=false; 
     return; 
    }
    if(sUpload!="")
    {
	    var iExt=sUpload.indexOf("\\");
	    var iDot=sUpload.indexOf(".");
        if((iExt < 0 ) || (iDot < 0))
        {
            alert(invalidPathMsg);
            objUpload.focus();
            return
            return; 
        }
        if(iDot > 0)
        {
            var aUpload=sUpload.split(".");
     // if(aUpload[aUpload.length-1]!="txt" && aUpload[aUpload.length-1]!="doc" && aUpload[aUpload.length-1]!="xls" && aUpload[aUpload.length-1]!="img" && aUpload[aUpload.length-1]!="pdf" && aUpload[aUpload.length-1]!="zip" && aUpload[aUpload.length-1]!="rar" && aUpload[aUpload.length-1]!="jpeg" && aUpload[aUpload.length-1]!="jpg" && aUpload[aUpload.length-1]!="xlsx" && aUpload[aUpload.length-1]!="docx" && aUpload[aUpload.length-1]!="TXT" && aUpload[aUpload.length-1]!="DOC" && aUpload[aUpload.length-1]!="XLS" && aUpload[aUpload.length-1]!="IMG" && aUpload[aUpload.length-1]!="PDF" && aUpload[aUpload.length-1]!="ZIP" && aUpload[aUpload.length-1]!="RAR" && aUpload[aUpload.length-1]!="JPEG" && aUpload[aUpload.length-1]!="JPG" && aUpload[aUpload.length-1]!="XLSX" && aUpload[aUpload.length-1]!="DOCX")
     if(aUpload[aUpload.length-1].toLowerCase() =="exe")
            {
                alert(invalidFileTypemsg);
                objUpload.focus();
                event.returnValue=false; 
                return; 
            }
        }
    }
}
 
function ValidateEntry(initialValueId, errorMessageInitialValue)
{
    var textboxvalue= trim(document.getElementById(initialValueId).value);
    if(textboxvalue=="")
    {
        alert("Please enter Initial Value!");
        document.getElementById(initialValueId).value = "";
        document.getElementById(initialValueId).focus();
        return false;
    }
    for(var j=0;j<document.getElementById(initialValueId).value.length;j++)
    {
        var ch = document.getElementById(initialValueId).value.charAt(j);
        if (ch < "0" || ch > "9")
        {
          alert(errorMessageInitialValue);
          document.getElementById(initialValueId).value = "";
          document.getElementById(initialValueId).focus();
          return false;
        }
    }
//    for (var i = 0; i < document.getElementById(creditTimeId).value.length; i++)
//    {
//        var ch1 = document.getElementById(creditTimeId).value.charAt(i);
//        if (ch1 < "0" || ch1 > "9")
//        {
//           alert(errorMessageCreditTime);
//            return false;
//        }
//    }
    
        return true;
}

function ValidateCreditTime(creditTimeBoxId, errorMessageForInvalidCreditTime)
{

    var creditTime = trim(document.getElementById(creditTimeBoxId).value);
    if(creditTime%12 != 0)
    {
   
        alert(errorMessageForInvalidCreditTime);
        document.getElementById(creditTimeBoxId).focus();
        return false;
    }
    return true;
}
function IsDecimal(ctrl,nullerr,invalid)
   //  check for valid numeric strings	
{ 
 
 
  var userName = trim(document.getElementById(ctrl).value);
 
    document.getElementById(ctrl).value = userName;
    
    if(userName == null || userName == "")
    {
        alert(nullerr);
        document.getElementById(ctrl).focus();
        return false;
    }
   var amount=parseFloat(document.getElementById(ctrl).value);
     if (isNaN(document.getElementById(ctrl).value))
     {  
        alert(invalid)         
        return false
     }

     
   }
   
   function IsDecimalNull(ctrl,invalid)
   //  check for valid numeric strings	
{ 
 
 
  var userName = trim(document.getElementById(ctrl).value);
 
    document.getElementById(ctrl).value = userName;
   var amount=parseFloat(document.getElementById(ctrl).value);
     if (isNaN(document.getElementById(ctrl).value))
     {  
        alert(invalid)         
        return false
     }

     
   }

   
    // This function enables/disables panels
    // History: 2008-06-24: Ketan N Kahsyap - Created
    function DisablePanel(src)
    {
        if (src == "ObjectInformationPanel")
        {
            SetDisabled(document.getElementById('ValuationInformationPanel'), true);
            SetDisabled(document.getElementById('RequestContentInAnswerPanel'), true);
            if(document.getElementById('CalculationPanel') != null)
            {
              SetDisabled(document.getElementById('CalculationPanel'), true);
            }
            document.getElementById('HandleValuationPageButtonListLower_AskExpertsLinkButton').href = "#";
            SetDisabled(document.getElementById('HandleValuationPageButtonListLower_AskExpertsLinkButton'), true);
            document.getElementById('HandleValuationPageButtonListUpper_AskExpertsLinkButton').href = "#";
            SetDisabled(document.getElementById('HandleValuationPageButtonListUpper_AskExpertsLinkButton'), true);
            document.getElementById('HandleValuationPageButtonListLower_CloseLinkButton').href = "#";
            SetDisabled(document.getElementById('HandleValuationPageButtonListLower_CloseLinkButton'), true);
            document.getElementById('HandleValuationPageButtonListUpper_CloseLinkButton').href = "#";
            SetDisabled(document.getElementById('HandleValuationPageButtonListUpper_CloseLinkButton'), true);
        }
        else if (src == "ValuationInformationPanel")
        {
            SetDisabled(document.getElementById('ObjectInformationPanel'), true);
            SetDisabled(document.getElementById('RequestContentInAnswerPanel'), true);
            if(document.getElementById('CalculationPanel')!= null)
            {
              SetDisabled(document.getElementById('CalculationPanel'), true);
            }
            if(document.getElementById('ChassisFamilyPanel')!= null)
            {
              SetDisabled(document.getElementById('ChassisFamilyPanel'), true);
            }
            if(document.getElementById('SuperStructurePanel')!= null)
            {
              SetDisabled(document.getElementById('SuperStructurePanel'), true);
            }
            if(document.getElementById('QualityConditionPanel')!= null)
            {
              SetDisabled(document.getElementById('QualityConditionPanel'), true);
            }
            document.getElementById('HandleValuationPageButtonListLower_AskExpertsLinkButton').href = "#";
            SetDisabled(document.getElementById('HandleValuationPageButtonListLower_AskExpertsLinkButton'), true);
            document.getElementById('HandleValuationPageButtonListUpper_AskExpertsLinkButton').href = "#";
            SetDisabled(document.getElementById('HandleValuationPageButtonListUpper_AskExpertsLinkButton'), true);
            document.getElementById('HandleValuationPageButtonListLower_CloseLinkButton').href = "#";
            SetDisabled(document.getElementById('HandleValuationPageButtonListLower_CloseLinkButton'), true);
            document.getElementById('HandleValuationPageButtonListUpper_CloseLinkButton').href = "#";
            SetDisabled(document.getElementById('HandleValuationPageButtonListUpper_CloseLinkButton'), true);
            document.getElementById('HandleValuationPageButtonListUpper_SaveLinkButton').href = "#";
            document.getElementById('HandleValuationPageButtonListUpper_SaveLinkButton').disabled = true;
            document.getElementById('HandleValuationPageButtonListLower_SaveLinkButton').href = "#";
            document.getElementById('HandleValuationPageButtonListLower_SaveLinkButton').disabled = true;
            document.getElementById('HandleValuationPageButtonListUpper_AttachDocumentLinkButton').href = "#";
            document.getElementById('HandleValuationPageButtonListUpper_AttachDocumentLinkButton').disabled = true;
            document.getElementById('HandleValuationPageButtonListLower_AttachDocumentLinkButton').href = "#";
            document.getElementById('HandleValuationPageButtonListLower_AttachDocumentLinkButton').disabled = true;
            document.getElementById('HandleValuationPageButtonListUpper_ReferencesPopUpLinkButton').href = "#";
            document.getElementById('HandleValuationPageButtonListUpper_ReferencesPopUpLinkButton').disabled = true;
            document.getElementById('HandleValuationPageButtonListLower_ReferencesPopUpLinkButton').href = "#";
            document.getElementById('HandleValuationPageButtonListLower_ReferencesPopUpLinkButton').disabled = true;
        }
        else if (src == "RequestContentInAnswerPanel")
        {
            SetDisabled(document.getElementById('ObjectInformationPanel'), true);
            SetDisabled(document.getElementById('ValuationInformationPanel'), true);
            if(document.getElementById('CalculationPanel')!= null)
            {
              SetDisabled(document.getElementById('CalculationPanel'), true);
            }
            if(document.getElementById('ChassisFamilyPanel')!= null)
            {
              SetDisabled(document.getElementById('ChassisFamilyPanel'), true);
            }
            if(document.getElementById('SuperStructurePanel')!= null)
            {
              SetDisabled(document.getElementById('SuperStructurePanel'), true);
            }
            if(document.getElementById('QualityConditionPanel')!= null)
            {
              SetDisabled(document.getElementById('QualityConditionPanel'), true);
            }
            document.getElementById('HandleValuationPageButtonListLower_AskExpertsLinkButton').href = "#";
            SetDisabled(document.getElementById('HandleValuationPageButtonListLower_AskExpertsLinkButton'), true);
            document.getElementById('HandleValuationPageButtonListUpper_AskExpertsLinkButton').href = "#";
            SetDisabled(document.getElementById('HandleValuationPageButtonListUpper_AskExpertsLinkButton'), true);
            document.getElementById('HandleValuationPageButtonListLower_CloseLinkButton').href = "#";
            SetDisabled(document.getElementById('HandleValuationPageButtonListLower_CloseLinkButton'), true);
            document.getElementById('HandleValuationPageButtonListUpper_CloseLinkButton').href = "#";
            SetDisabled(document.getElementById('HandleValuationPageButtonListUpper_CloseLinkButton'), true);
            document.getElementById('HandleValuationPageButtonListUpper_SaveLinkButton').href = "#";
            document.getElementById('HandleValuationPageButtonListUpper_SaveLinkButton').disabled = true;
            document.getElementById('HandleValuationPageButtonListLower_SaveLinkButton').href = "#";
            document.getElementById('HandleValuationPageButtonListLower_SaveLinkButton').disabled = true;
            document.getElementById('HandleValuationPageButtonListUpper_AttachDocumentLinkButton').href = "#";
            document.getElementById('HandleValuationPageButtonListUpper_AttachDocumentLinkButton').disabled = true;
            document.getElementById('HandleValuationPageButtonListLower_AttachDocumentLinkButton').href = "#";
            document.getElementById('HandleValuationPageButtonListLower_AttachDocumentLinkButton').disabled = true;
            document.getElementById('HandleValuationPageButtonListUpper_ReferencesPopUpLinkButton').href = "#";
            document.getElementById('HandleValuationPageButtonListUpper_ReferencesPopUpLinkButton').disabled = true;
            document.getElementById('HandleValuationPageButtonListLower_ReferencesPopUpLinkButton').href = "#";
            document.getElementById('HandleValuationPageButtonListLower_ReferencesPopUpLinkButton').disabled = true;
        }
        else if (src == "CalculationPanel")
        {
            SetDisabled(document.getElementById('ObjectInformationPanel'), true);
            SetDisabled(document.getElementById('RequestContentInAnswerPanel'), true);
            SetDisabled(document.getElementById('ValuationInformationPanel'), true);
            if(document.getElementById('ChassisFamilyPanel')!= null)
            {
              SetDisabled(document.getElementById('ChassisFamilyPanel'), true);
            }
            if(document.getElementById('SuperStructurePanel')!= null)
            {
              SetDisabled(document.getElementById('SuperStructurePanel'), true);
            }
            if(document.getElementById('QualityConditionPanel')!= null)
            {
              SetDisabled(document.getElementById('QualityConditionPanel'), true);
            }
            document.getElementById('HandleValuationPageButtonListLower_AskExpertsLinkButton').href = "#";
            SetDisabled(document.getElementById('HandleValuationPageButtonListLower_AskExpertsLinkButton'), true);
            document.getElementById('HandleValuationPageButtonListUpper_AskExpertsLinkButton').href = "#";
            SetDisabled(document.getElementById('HandleValuationPageButtonListUpper_AskExpertsLinkButton'), true);
            document.getElementById('HandleValuationPageButtonListLower_CloseLinkButton').href = "#";
            SetDisabled(document.getElementById('HandleValuationPageButtonListLower_CloseLinkButton'), true);
            document.getElementById('HandleValuationPageButtonListUpper_CloseLinkButton').href = "#";
            SetDisabled(document.getElementById('HandleValuationPageButtonListUpper_CloseLinkButton'), true);
            document.getElementById('HandleValuationPageButtonListUpper_SaveLinkButton').href = "#";
            document.getElementById('HandleValuationPageButtonListUpper_SaveLinkButton').disabled = true;
            document.getElementById('HandleValuationPageButtonListLower_SaveLinkButton').href = "#";
            document.getElementById('HandleValuationPageButtonListLower_SaveLinkButton').disabled = true;
            document.getElementById('HandleValuationPageButtonListUpper_AttachDocumentLinkButton').href = "#";
            document.getElementById('HandleValuationPageButtonListUpper_AttachDocumentLinkButton').disabled = true;
            document.getElementById('HandleValuationPageButtonListLower_AttachDocumentLinkButton').href = "#";
            document.getElementById('HandleValuationPageButtonListLower_AttachDocumentLinkButton').disabled = true;
            document.getElementById('HandleValuationPageButtonListUpper_ReferencesPopUpLinkButton').href = "#";
            document.getElementById('HandleValuationPageButtonListUpper_ReferencesPopUpLinkButton').disabled = true;
            document.getElementById('HandleValuationPageButtonListLower_ReferencesPopUpLinkButton').href = "#";
            document.getElementById('HandleValuationPageButtonListLower_ReferencesPopUpLinkButton').disabled = true;
        }
    }
    
    // This function enables/disables a control and its child controls
    // History: 2008-06-24: Ketan N Kahsyap - Created
	function SetDisabled(elem,val) 
	{
        try
        {
            // Change enabled state for the root element
            elem.disabled = val;
        }
        catch(E)
        {
            // Ignore possible error and continue (the current element donīt have disabled-attribute)
        }

        if (elem.childNodes && elem.childNodes.length > 0)
        {
            // Change enable state for any child element(s)
            for (var x = 0; x < elem.childNodes.length; x++)
            {
                SetDisabled(elem.childNodes[x],val);
            }
        }
    }
    
    function ValidateCaclulationSectionTextBoxes(id)
    {
        var value = document.getElementById(id).value
        if(value == "")
        {
            document.getElementById(id).value = 0;
            document.getElementById(id).focus();
        }
    }

    function KeyPressValidate()
    {
        if (!((event.keyCode >= 48 && event.keyCode <= 57)||(event.keyCode==32)))return false;
    }
    
    
function ConfirmSaveNewUsageYear(hiddenControlId , usageYearErrMsg,drpCtrl,selectedvalue)
{
  if(confirm(usageYearErrMsg))
  {
        if (document.getElementById(hiddenControlId) != null)
        {
            document.getElementById(hiddenControlId).value = "SavedCalculationData-OK";
        }
  }
  else
  {
        ctrlDrp = document.getElementById(drpCtrl)
        ctrlDrp.value = selectedvalue;
        document.getElementById(hiddenControlId).value = "";
        
  }
 // document.forms[0].submit()
  
}  
 
 
 //for the ask expert response date
   function ExpertcheckDate(sender,args)
 {


        var de = sender._selectedDate.getDate();        
        if (de < new Date().getDate()) 
        {

        var ctrl = document.getElementById('<%=ResponseDateGreaterThanErrMsg.ClientID %>')
          alert(ctrl.value);
          sender._selectedDate = new Date(); 
        // set the date back to the current date
         sender._textbox.set_Value(sender._selectedDate.format(sender._format))
        }
    }	 
//For target pop up page
 function close2()
 {
    self.close();
    return;
 }
  function RedirectPage(dt)
 {   
   return true;
 }
 function close1(txtTargetDate,txtDescription,errRequiredFieldDescription,errRequiredFieldDate)
 { 

  var TargetDate = document.getElementById(txtTargetDate).value;
  var Description = document.getElementById(txtDescription).value;
   var Status = false;
window.opener.AssignValue(TargetDate,Description);
   if(Description== "" && TargetDate == "")
    { 
 
         var ctrl1 = document.getElementById(errRequiredFieldDescription).value
          var ctrl2 = document.getElementById(errRequiredFieldDate).value
        alert(ctrl1+"\n"+ctrl2);
        return false;        
    }
    else if(Description == "")
    {
 
       var ctrl = document.getElementById(errRequiredFieldDescription).value
       alert(ctrl);       
       return false;
    }
    else if(TargetDate == "")
    {
  
        var ctrl = document.getElementById(errRequiredFieldDate).value
        alert(ctrl);
        return false;
    }    
    else
    
  {

        self.opener.document.forms[0].submit();
           self.close();
        return true;
    }   
    return false;
 }
  function AssignValue(val1,val2)
 {  
 
    var ctrl1 = document.getElementById('ctl00_ContentPlaceHolder1_HdnTargetDate');
    var ctrl2 = document.getElementById('ctl00_ContentPlaceHolder1_HdnTargetDateDescription');
    ctrl1.value = val1;  
    ctrl2.value =  val2;
           
 }
 
 //Stock valuation page
 function setTooltipforGridRow(element,tooltipString)
{
    element.title = tooltipString;
}
var oldgridSelectedColor;
function setMouseOverColor(element)
{
    oldgridSelectedColor = element.style.backgroundColor;
    element.style.backgroundColor='#bdcfed';
    element.style.cursor='hand';
    element.style.textDecoration='underline';    
}

function setMouseOutColor(element)
{
    element.style.backgroundColor=oldgridSelectedColor;
    element.style.textDecoration='none';
}
    var styleToSelect;
    function onOk() {
   alert('<%=testString %>');
    }
 function openpopup()
 {
 var windowWidth = 310;
 var windowHeight = 340;
 var myleft=(screen.width)?(screen.width-windowWidth)/2:100;	
 var mytop=(screen.height)?(screen.height-windowHeight)/2:100;
 openPopWin('TargetDatePopUp.aspx','310','240',mytop,myleft);    
 } 

 

 
  function setfocusctrl(ctrl)
 {
    var ctrlTxtBox = document.getElementById(ctrl);    
    ctrlTxtBox.focus();   
 }
 function onlyNumericKeypress(e)
{ 
    if (e.keyCode > 13 && (e.keyCode < 48 || e.keyCode > 57) && e.keyCode != 45)
	{
		e.keyCode = 0;
		return false; 
	}
	return true;
}	
function onlyNumbersKeypress(e,culture)
{ 
   	if(e.keyCode < 48 || e.keyCode > 57)
	{
	    if(culture!=null || culture != '')
	    {
	        if(culture == "en-US")
	        {
	            if(e.keyCode != 46)
	            {
		            e.keyCode = 0;
		            return false; 
		        }
		    }
		    else if(culture == "sv-SE")
		    {
		   
		        if(e.keyCode != 44)
	            {
		            e.keyCode = 0;
		            return false; 
		        }
		    }
		    else
		    {
		        if(e.keyCode != 46)
	            {
		            e.keyCode = 0;
		            return false; 
		        }
		    }
		}
		else
	    {
	        if(e.keyCode != 46)
            {
	            e.keyCode = 0;
	            return false; 
	        }
	    }
	}
	return true;
}	
 function ClearOtherEquipment()
 {
    var item1TxtBox = document.getElementById('<%=OtherEquipmentItem1TextBox.ClientID%>');    
    var item2TxtBox = document.getElementById('<%=OtherEquipmentItem2TextBox.ClientID%>');    
    var totalLabel = document.getElementById('<%=SumOtherEquipmentValueLabel.ClientID%>');
    item1TxtBox.innerHTML = "";
    item2TxtBox.innerHTML = "";
    totalLabel.innerHTML = "";
 }       
 function CalculateOtherEquipmentTotalVal()
 { 
    var item1TxtBox = document.getElementById('<%=OtherEquipmentItem1TextBox.ClientID%>');
    var item2TxtBox = document.getElementById('<%=OtherEquipmentItem2TextBox.ClientID%>');    
    var totalLabel = document.getElementById('<%=SumOtherEquipmentValueLabel.ClientID%>');
          
     if (isNaN(item1TxtBox.value))
     {  
        alert("Not numeric")         
        return
     }
      if(isNaN(item2TxtBox.value))
     {
        alert("Not numeric")         
        return        
     }
     
     if(!parseInt(item1TxtBox.value))
     {
        item1TxtBox.value="0"
     }
     else if(!parseInt(item2TxtBox.value))
     {
        item2TxtBox.value="0"
     }     
     
     totalLabel.innerHTML  = parseInt(item1TxtBox.value) + parseInt(item2TxtBox.value)
      
 
    
 }     
        function ShowSpecification()
        {
       
            var theDiv = document.getElementById('specification');           
            var theImage;
            if (specificationVisibilityState == true)
            {
                specificationDivHeight = theDiv.style.height;
                theDiv.style.height = 0+'px';
                theDiv.style.visibility = 'hidden';
                specificationVisibilityState = false;
                
                theImage = document.getElementById('imgSpecificationUp');
                theImage.style.width = 0+'px';
                theImage.style.visibility = 'hidden';
                theImage = document.getElementById('imgSpecificationDown');
                theImage.style.width = 16+'px';
                theImage.style.visibility = 'visible';
            }
            else
            {
                theDiv.style.visibility = 'visible';
                theDiv.style.height = specificationDivHeight;
                specificationVisibilityState = true;
                
                theImage = document.getElementById('imgSpecificationUp');
                theImage.style.width = 16+'px';
                theImage.style.visibility = 'visible';
                theImage = document.getElementById('imgSpecificationDown');
                theImage.style.width = 0+'px';
                theImage.style.visibility = 'hidden';
            }
        }
        
        var superStructureVisibilityState = true;
        var superStructureDivHeight;
       
        function ShowSuperStructure()
        {
            var theDiv = document.getElementById('superStructure');
            var theImage;
            
            if (superStructureVisibilityState == true)
            {
                superStructureDivHeight = theDiv.style.height;
                theDiv.style.height = 0+'px';
                theDiv.style.visibility = 'hidden';
                superStructureVisibilityState = false;
                
                theImage = document.getElementById('imgSuperStructureUp');
                theImage.style.width = 0+'px';
                theImage.style.visibility = 'hidden';
                theImage = document.getElementById('imgSuperStructureDown');
                theImage.style.width = 16+'px';
                theImage.style.visibility = 'visible';
            }
            else
            {
                theDiv.style.visibility = 'visible';
                theDiv.style.height = superStructureDivHeight;
                superStructureVisibilityState = true;
                
                theImage = document.getElementById('imgSuperStructureUp');
                theImage.style.width = 16+'px';
                theImage.style.visibility = 'visible';
                theImage = document.getElementById('imgSuperStructureDown');
                theImage.style.width = 0+'px';
                theImage.style.visibility = 'hidden';
            }
        }
        
        var otherEquipmentVisibilityState = true;
        var otherEquipmentDivHeight;
       
        function ShowOtherEquipment()
        {
            var theDiv = document.getElementById('otherEquipment');
            var theImage;

            if (otherEquipmentVisibilityState == true)
            {
                otherEquipmentDivHeight = theDiv.style.height;
                theDiv.style.height = 0+'px';
                theDiv.style.visibility = 'hidden';
                otherEquipmentVisibilityState = false;

                theImage = document.getElementById('imgOtherEquipmentUp');
                theImage.style.width = 0+'px';
                theImage.style.visibility = 'hidden';
                theImage = document.getElementById('imgOtherEquipmentDown');
                theImage.style.width = 16+'px';
                theImage.style.visibility = 'visible';
            }
            else
            {
                theDiv.style.visibility = 'visible';
                theDiv.style.height = otherEquipmentDivHeight;
                otherEquipmentVisibilityState = true;  
                              
                theImage = document.getElementById('imgOtherEquipmentUp');
                theImage.style.width = 16+'px';
                theImage.style.visibility = 'visible';
                theImage = document.getElementById('imgOtherEquipmentDown');
                theImage.style.width = 0+'px';
                theImage.style.visibility = 'hidden';
            }
        }
        
        var qualityParameterVisibilityState = true;
        var qualityParameterDivHeight;
       
        function ShowQualityParameters()
        {
            var theDiv = document.getElementById('qualityParameters');
            var theImage;
            
            if (qualityParameterVisibilityState == true)
            {
                qualityParameterDivHeight = theDiv.style.height;
                theDiv.style.height = 0+'px';
                theDiv.style.visibility = 'hidden';
                qualityParameterVisibilityState = false;

                theImage = document.getElementById('imgQualityParametersUp');
                theImage.style.width = 0+'px';
                theImage.style.visibility = 'hidden';
                theImage = document.getElementById('imgQualityParametersDown');
                theImage.style.width = 16+'px';
                theImage.style.visibility = 'visible';
            }
            else
            {
                theDiv.style.visibility = 'visible';
                theDiv.style.height = qualityParameterDivHeight;
                qualityParameterVisibilityState = true;
                
                theImage = document.getElementById('imgQualityParametersUp');
                theImage.style.width = 16+'px';
                theImage.style.visibility = 'visible';
                theImage = document.getElementById('imgQualityParametersDown');
                theImage.style.width = 0+'px';
                theImage.style.visibility = 'hidden';
            }
        }
        
         function checkDate(sender,args)
        {
         if (sender._selectedDate > new Date()) 
            {
                var ctrl = document.getElementById('<%=soldDateGreaterThanErrMsg.ClientID %>')
                alert(ctrl.value);                        
                sender._selectedDate = new Date(); 
                // set the date back to the current date
                sender._textbox.set_Value(sender._selectedDate.format(sender._format))
            }
        }
        
        
        
        //for the handle search valuation page
  function HideAdvanceSearchCriteria(IndustryTextLabel,ProductTextLabel,UsageTextLabel,RangeTextLabel,MakeTextLabel,ModelTextLabel,IndustryID,ProductID,UsageID,RangeID,MakeID,ModelID,MakeOthers,ModelOthers,adveSrchPal)
{    	

    document.getElementById(IndustryTextLabel).innerText=" ";
 
	document.getElementById(ProductTextLabel).innerText=" ";
	document.getElementById(UsageTextLabel).innerText=" ";
	document.getElementById(RangeTextLabel).innerText=" ";
	document.getElementById(MakeTextLabel).innerText=" ";
	document.getElementById(ModelTextLabel).innerText=" ";
	document.getElementById(IndustryID).innerText= "";
	document.getElementById(ProductID).innerText= "";
	document.getElementById(UsageID).innerText= "";
	document.getElementById(RangeID).innerText= "";
	document.getElementById(MakeID).innerText= "";
	document.getElementById(ModelID).innerText= "";
	document.getElementById(MakeOthers).innerText= "";
	document.getElementById(ModelOthers).innerText= "";
    document.getElementById(adveSrchPal).style.display='none';
}
function ShowAdvanceSearchCriteria()
{
    document.getElementById('adveSrchPal').style.display='';    
}
function openHandleObjectValuation(url,screenName,resize)
{
    window.open(url);
    self.close();
}
 function SetScroll()
        {   
           
            var hdnCtrl = document.getElementById('hdnScroll')            
            document.getElementById('DivTV').scrollTop=hdnCtrl;
        }
         function HandleValuationSetScroll(hdnScroll,DivTV)
        {   
          var hdnCtrl = document.getElementById(hdnScroll)
          document.getElementById(DivTV).scrollTop=hdnCtrl.value;
        }
 function DivScroll(divPos)
        {
            var hdnCtrl = document.getElementById('hdnScroll')
            
            hdnCtrl.value = divPos            
        }        
        

function alarm(selectRequestCheckBox)
{
    var ctrl = document.getElementById(selectRequestCheckBox)
    ctrl.checked = true
    var flag = chkValue.checked;
    var chks = document.getElementsByTagName("input");     
    for(var i=0;i<chks.length;i++)
    {
        chks[i].checked=false;
    }
    ctrl.checked =flag;

}

function CheckObjectPrivilege(chkValue)
{
   var flag = chkValue.checked;
    var chks = document.getElementsByTagName("input");
    for(var i=0;i<chks.length;i++)
    {
        chks[i].checked=false;
    }
    chkValue.checked =flag;
}
function CloseButton()
{
    window.location.replace("../Index.aspx")
}

function varifyPosAndNegNumber(theControl) 
{
    if (theControl.value.length > 0)
    {
        var re = new RegExp("^[-]?[0-9]+$");

        if (re.test(theControl.value) == true) 
            return true;
        else 
        {
            alert("Not a number, please correct the error");
            theControl.focus();
            return false;
        }
    }
    else
        return true;
      
}

//Functions for the panel       
        
       function setfocusctrl(ctrl)
         {
            var ctrlTxtBox = document.getElementById(ctrl);    
            ctrlTxtBox.focus();   
         } 
        
        function RequestCheckBoxClick()
        {       
           InitilizeRequestRelatedPanels();
        }
        function ObjectCheckBoxClick()
        {       
           InitilizeObjectRelatedPanels();
        }

        function AssignControlDropDownChange()
        {  
            SetDisabled(document.getElementById('SearchPanel'),true);        
            SetDisabled(document.getElementById('GridViewPanel'),true);
        }
        function AssignControlCancelButton(obj)
        {          
            SetDisabled(document.getElementById('SearchPanel'),false);        
            SetDisabled(document.getElementById('GridViewPanel'),false);
            SetDisabled(document.getElementById('AssignControlPanel'),true);            
        }
        function EnablePanels(ctrl1,ctrl2)
        {
            var pnlctrl1 =document.getElementById(ctrl1);
            var pnlctrl2 =document.getElementById(ctrl2);
            SetDisabled(searchPanel,false);
            SetDisabled(grdVwPanel,false);
        }
        function PnlDisable(ctrl)
        {
            var pnlctrl =document.getElementById(ctrl);            
            SetDisabled(pnlctrl,true);            
           
        }
       
        function DisableAllPanelsExeptThis(ctrl)
        {           
       
            var searchPanel = document.getElementById('SearchPanel');
            var grdVwPanel = document.getElementById('GridViewPanel');
            var grdAssignPanel = document.getElementById('AssignControlPanel');
            var invoicePanel = document.getElementById('InvoiceControlPanel')
            var estimatedCostPanel = document.getElementById('EstimatedCostControlPanel');           
            var changeResponsePanel = document.getElementById('ChangeResponseDateControlPanel');           
            var passedctrl =document.getElementById(ctrl); 
            SetDisabled(searchPanel,true);
            SetDisabled(grdVwPanel,true);
            if(passedctrl == grdAssignPanel)
            {
                SetDisabled(grdAssignPanel,false);  
            }
            else
            {
                SetDisabled(grdAssignPanel,true);  
            }
            if(passedctrl == invoicePanel)
            {
                SetDisabled(invoicePanel,false);  
            }
            else
            {
                SetDisabled(invoicePanel,true);  
            }
            if(passedctrl == changeResponsePanel)
            {
                SetDisabled(changeResponsePanel,false); 
            }   
            else
            {
                SetDisabled(changeResponsePanel,true); 
            }                     
            if(passedctrl == estimatedCostPanel)
            {
                 SetDisabled(estimatedCostPanel,false); 
            }
            else
            {
                 SetDisabled(estimatedCostPanel,true); 
            }
            
        }
        //This will disable all panels exept GridViewPanel and SearchPanel
        function InitilizePanels()
        {
       
            SetDisabled(document.getElementById('SearchPanel'),false);
            SetDisabled(document.getElementById('GridViewPanel'),false); 
            SetDisabled(document.getElementById('AssignControlPanel'),true);
            SetDisabled(document.getElementById('InvoiceControlPanel'),true);             
            SetDisabled(document.getElementById('EstimatedCostControlPanel'),true);             
            SetDisabled(document.getElementById('ChangeResponseDateControlPanel'),true);             
        }
        //This will disable all panels exept Request Related
        function InitilizeRequestRelatedPanels()
        {
  
            SetDisabled(document.getElementById('SearchPanel'),false);
             
            SetDisabled(document.getElementById('GridViewPanel'),false); 
            SetDisabled(document.getElementById('AssignControlPanel'),false);
            SetDisabled(document.getElementById('InvoiceControlPanel'),false);  
            SetDisabled(document.getElementById('ChangeResponseDateControlPanel'),false);                        
        }
        //This will disable all panels exept Object Related
        function InitilizeObjectRelatedPanels()
        {
       
            SetDisabled(document.getElementById('SearchPanel'),false);
            SetDisabled(document.getElementById('GridViewPanel'),false); 
            SetDisabled(document.getElementById('AssignControlPanel'),false);            
            SetDisabled(document.getElementById('EstimatedCostControlPanel'),false);                         
        }
        // This function enables/disables a control and its child controls
        // History: 2008-06-04: Peter A - Created
		function SetDisabled(elem,val) 
		{
	
            try
            {
            
                // Change enabled state for the root element
                elem.disabled = val;
            }
            catch(E)
            {
                // Ignore possible error and continue (the current element donīt have disabled-attribute)
            }

            if (elem.childNodes && elem.childNodes.length > 0)
            {	
                // Change enable state for any child element(s)
                for (var x = 0; x < elem.childNodes.length; x++)
                {                
                    SetDisabled(elem.childNodes[x],val);
                }
            }
            	
        }
        
         //For advance search pop up
   function showAdvanceSearchPannel()
    {
        var IndustryOthers = (document.getElementById('IndustryOthers'));
        var ProductOthers = (document.getElementById('ProductOthers')); 
        var UsageOthers = (document.getElementById('UsageOthers'));
        var RangeOthers = (document.getElementById('RangeOthers')); 
        var MakeOthers = (document.getElementById('MakeOthers'));
        var ModelOthers = (document.getElementById('ModelOthers')); 
       
        if(IndustryOthers.value=="")
        {
        
        window.opener.document.getElementById('IndustryOthersLabel').innerText = '';
        }
        else
        {  
        
         window.opener.document.getElementById('IndustryOthersLabel').innerText = window.opener.document.getElementById('IndustryOthersHidden').value;
         
        } 
  	 
         if(ProductOthers.value=="")
        {
       
        window.opener.document.getElementById('ProductOthersLabel').innerText = '';
        }
        else
        { 
             
        window.opener.document.getElementById('ProductOthersLabel').innerText = window.opener.document.getElementById('ProductOthersHidden').value;
        } 
         if(UsageOthers.value=="")
        {
        
        window.opener.document.getElementById('UsageOthersLabel').innerText = '';
        }
        else
        {        
        window.opener.document.getElementById('UsageOthersLabel').innerText = window.opener.document.getElementById('UsageOthersHidden').value;
        } 
         if(RangeOthers.value=="")
        {
        
        window.opener.document.getElementById('RangeOthersLabel').innerText = '';
        }
        else
        {        
        window.opener.document.getElementById('RangeOthersLabel').innerText = window.opener.document.getElementById('RangeOthersHidden').value;
        } 
        if(MakeOthers.value=="")
        {
        
        window.opener.document.getElementById('MakeOthersLabel').innerText = '';
        }
        else
        {   
           
        window.opener.document.getElementById('MakeOthersLabel').innerText = window.opener.document.getElementById('MakeOthersLabelHdn').value;
        }
        if(ModelOthers.value == "")
        {
        window.opener.document.getElementById('ModelOthersLabel').innerText = '';
        }
        else
        {

         window.opener.document.getElementById('ModelOthersLabel').innerText = window.opener.document.getElementById('ModelOthersLabelHdn').value;
        }

        opener.document.getElementById('adveSrchPal').style.display = '';		
        window.opener.document.getElementById('IndustryTextLabel').innerText=document.getElementById('IndustryName').value	
        window.opener.document.getElementById('IndustryName').innerText=document.getElementById('IndustryName').value	
        window.opener.document.getElementById('ProductTextLabel').innerText=document.getElementById('ProductName').value	
        window.opener.document.getElementById('ProductName').innerText=document.getElementById('ProductName').value	
        window.opener.document.getElementById('UsageTextLabel').innerText=document.getElementById('UsageName').value	
        window.opener.document.getElementById('UsageName').innerText=document.getElementById('UsageName').value
        window.opener.document.getElementById('RangeTextLabel').innerText=document.getElementById('RangeName').value	
        window.opener.document.getElementById('RangeName').innerText=document.getElementById('RangeName').value
        window.opener.document.getElementById('MakeTextLabel').innerText=document.getElementById('MakeName').value	
        window.opener.document.getElementById('MakeName').innerText=document.getElementById('MakeName').value	
        window.opener.document.getElementById('ModelTextLabel').innerText=document.getElementById('ModelName').value	
        window.opener.document.getElementById('ModelName').innerText=document.getElementById('ModelName').value	
        window.opener.document.getElementById('IndustryID').innerText= document.getElementById('IndustryID').value	
        window.opener.document.getElementById('ProductID').innerText= document.getElementById('ProductID').value
        window.opener.document.getElementById('UsageID').innerText= document.getElementById('UsageID').value
        window.opener.document.getElementById('RangeID').innerText= document.getElementById('RangeID').value
        window.opener.document.getElementById('MakeID').innerText= document.getElementById('MakeID').value
        window.opener.document.getElementById('ModelID').innerText= document.getElementById('ModelID').value
         window.opener.document.getElementById('IndustryOthersTextLabel').innerText= document.getElementById('IndustryOthers').value
        window.opener.document.getElementById('IndustryOthers').innerText= document.getElementById('IndustryOthers').value
         window.opener.document.getElementById('ProductOthersTextLabel').innerText= document.getElementById('ProductOthers').value
        window.opener.document.getElementById('ProductOthers').innerText= document.getElementById('ProductOthers').value
         window.opener.document.getElementById('UsageOthersTextLabel').innerText= document.getElementById('UsageOthers').value
        window.opener.document.getElementById('UsageOthers').innerText= document.getElementById('UsageOthers').value
         window.opener.document.getElementById('RangeOthersTextLabel').innerText= document.getElementById('RangeOthers').value
        window.opener.document.getElementById('RangeOthers').innerText= document.getElementById('RangeOthers').value
        window.opener.document.getElementById('MakeOthersTextLabel').innerText= document.getElementById('MakeOthers').value
        window.opener.document.getElementById('MakeOthers').innerText= document.getElementById('MakeOthers').value
        window.opener.document.getElementById('ModelOthersTextLabel').innerText= document.getElementById('ModelOthers').value
        window.opener.document.getElementById('ModelOthers').innerText= document.getElementById('ModelOthers').value
        window.close();
    }
 	
 	 function SetFocus(GoImageButton2)
 {    
    var ctrl = document.getElementById(GoImageButton2)
    ctrl.focus();
 }  
 
  function TestCheckBox(aspnetForm,errorCheckBoxNotSelected)
   {
 
   var chkflag = 0;
   
   //alert(aspnetForm.length);
   for(i=0;i<aspnetForm.length;i++)
   {   
    e=aspnetForm.elements[i];
    if ( e.type=='checkbox')
    {
     if(e.checked == true)
     {
      chkflag = 1;
      break;
     } 
    }
   }
   if (chkflag == 0)
   {
    alert(errorCheckBoxNotSelected);
    return false;
   } 
}
  function ExpertTestCheckBox(aspnetForm,errorCheckBoxNotSelected,ConfirmMsg)
   {
 
   var chkflag = 0;
   
   //alert(aspnetForm.length);
   for(i=0;i<aspnetForm.length;i++)
   {   
    e=aspnetForm.elements[i];
    if ( e.type=='checkbox')
    {
     if(e.checked == true)
     {
      chkflag = 1;
      break;
     } 
    }
   }
   if (chkflag == 0)
   {
    alert(errorCheckBoxNotSelected);
    return false;
   } 
     else
   {
    var agree = confirm(ConfirmMsg);
    if(agree)
    {
     return true;
    }
    else
    {
     return false;
    }
   }
}
function checkprivilegeHandleValSearch(ctrl)
{
    if(ctrl.value == "True")
    {
        return true;
    }
    else
    {
        return false;
    }    
}
 function setPageChanged()
            {
                var ctrl = document.getElementById('ctl00_HidIsPageChanged');
                if(ctrl != null)                
                    ctrl.value = "1";
                else
                    {
                        ctrl = document.getElementById('HidIsPageChanged');
                        if(ctrl!=null)
                        {
                            ctrl.value = "1";
                        }
                    } 
                    
                var ctrlRequestVal = document.getElementById('ctl00_ContentPlaceHolder1_HidStructureSelected');                 
                if (ctrlRequestVal != null)
                {
                    ctrlRequestVal.value = "1";                    
                } 
                /*
                    the user has saved one object and started to work on a new one, 
                    when pressing edit on the saved one a popup shall appears and says 
                    "Do you want to save?
                */
                var ctrlHidChangeFlag = document.getElementById('ctl00_ContentPlaceHolder1_HidChangeFlag');                 
                if (ctrlHidChangeFlag != null)
                {
                    ctrlHidChangeFlag.value = "1";                    
                } 
            }
            
            function checkpagechange(strMsg)
            {
                var ctrl = document.getElementById('ctl00_HidIsPageChanged');
                var ctrlPage = document.getElementById('HidIsPageChanged');
                if(ctrl != null)
                {
                    if(ctrl.value == "1")
                    {
                        return(confirm(strMsg));
                    }
                }
                else if(ctrlPage != null)
                {       
                    if(ctrlPage.value == "1")
                    {
                        return(confirm(strMsg));
                    }
                }
                return true; 
            }
            function resetPageChanged()
            {
                var ctrlMasterPage = document.getElementById('ctl00_HidIsPageChanged');
                var ctrlPage = document.getElementById('HidIsPageChanged');
                if(ctrlPage != null)
                {
                   ctrlPage.value = "0";                
                }
                else if(ctrlMasterPage != null)
                {
                    ctrlMasterPage.value ="0";
                }   
            }
            	function MM_jumpMenu(targ,selObj,restore)
	{ 
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
	}
	
	function show(id)
	{

         var divList = document.getElementById("tabs").getElementsByTagName("p");
           for (i = 0; i < divList.length; i++)
           
            {
                  if(id == divList[i].id )
                  {
	             //alert(divList[i].id);
		              document.getElementById(divList[i].id).style.display = '';
	              }
	              else 
	              {
		              document.getElementById(divList[i].id).style.display = 'none';
	              }
	          }
	  }
	   function highlightLinks(obj)
     {
     var linkList = document.getElementById("tabHeadings").getElementsByTagName("li");
         for (i = 0; i < linkList.length; i++) 
         {
          linkList[i].className = "";
         }
     obj.className = "selected";
    }
function UsageYearChanged(ctrl)
{
  var ctrl = document.getElementById(ctrl);
  if(ctrl!= null)
  {
    ctrl.value = "1";
  }
}

function SetValueToHdnCtrl(ctrl,val)
{
  var ctrl = document.getElementById(ctrl);  
  if(ctrl!= null)
  {
    ctrl.value = val;    
  }
}

/* for RequestValuation VLA*/
function checkstructureIsSelected(strErrMsg,ctrlName)
{
    var ctrl = document.getElementById(ctrlName);     
    var ctrlVlaChkBox = document.getElementById('ctl00_ContentPlaceHolder1_VLACheckBox');         
    if (ctrl != null)
    {
        
        if(ctrl.value == "1")
        {
            var result = confirm(strErrMsg);
            if(result)
            {
                SetValueToHdnCtrl(ctrlName,"0");
                __doPostBack('ctl00_ContentPlaceHolder1_VLACheckBox','');
            }
            else
            {
                if (ctrlVlaChkBox!=null)
                {
                    ctrlVlaChkBox.checked = true;
                }
            }
        }
        else
        {
        
            __doPostBack('ctl00_ContentPlaceHolder1_VLACheckBox','');
        }
    }
    else
    {
        return true;
    }
    
}

/*For Request valuation page,for showing confirm Do you want to save? in the edit object functionality of object grid*/
function checkConfirmSaveObjectGrid(errMsg)
{

    var ctrlHidChangeFlag = document.getElementById('ctl00_ContentPlaceHolder1_HidChangeFlag');          
    var ctrlIndDropDown = document.getElementById('ctl00_ContentPlaceHolder1_ObjectDetails_IndustryDropDown');       
    if (ctrlHidChangeFlag != null)
    {   
        if(ctrlIndDropDown != null)
        {
            if(ctrlIndDropDown.value == '-100')
            {
                 ctrlHidChangeFlag.value="0";
                 return true;
            }
            
        }        
        if(ctrlHidChangeFlag.value == "1")
        {
            if(confirm(errMsg))
            {
               return true;
            }
            else
            {
               SetValueToHdnCtrl('ctl00_ContentPlaceHolder1_HidChangeFlag','Reset')               
            }
            
        }                    
    } 
}


function CheckUnAssignedValuationPrivilege(ctrlPrivilige,ctrlErrMsg)
{
    if(ctrlPrivilige != null)
        {
            if(!checkprivilegeHandleValSearch(ctrlPrivilige))
            {   
                if(ctrlErrMsg != null)
                {
                    alert(ctrlErrMsg.value);
                    return false;
                }                           
            }
        }
    return true;
}

function OpenHandleObjectValuationPopUp(objectId,requestId,ObjectAssignID,objectStatusId,objectStatus,objectStatusId,screenWidth,screenHeight)
{
    
    confirmstatus = confirm(document.getElementById('ctl00_cphWorkArea_hidObjNotAssignedToYou').value);
        if(confirmstatus)
        {
            var settings = 'modal,scrollbars=yes,resizable=no,toolbar=no,menubar=no,location=no,directories=no,left=100,top=50,width='+screenWidth+', height='+screenHeight+'';           
            var fileName = '../HandleValuationVer2/HandleObjectValuationMainPage.aspx?function=assign&objectID='+objectId+'&requestID='+requestId+'&assignedID='+ObjectAssignID+'&objectStatus='+objectStatusId+'&objectstatustext='+objectStatus+'&objectstatusid='+objectStatusId+'';
            var task="_blank";
            window.open(fileName, task, settings); 
        }
        else
        {
            if(confirm(document.getElementById('ctl00_cphWorkArea_hidObjReadOnlyMode').value))
            {
                var settings = 'modal,scrollBars=yes,resizable=no,toolbar=no,menubar=no,location=no,directories=no,left=100,top=50,width='+screenWidth+', height='+screenHeight+'';            
                var fileName = '../HandleValuationVer2/HandleObjectValuationMainPage.aspx?function=readonly&objectID='+objectId+'&requestID='+requestId+'&assignedID='+ObjectAssignID+'&objectStatus='+objectStatusId+'&objectstatustext='+objectStatus+'&objectstatusid='+objectStatusId+'';
                var task="_blank";
                window.open(fileName, task, settings); 
            }
        }
}

function CheckFilterAndAssignRequestId()
{
    var hiddenField = window.opener.document.getElementById('ctl00_ContentPlaceHolder1_hidIsRequestFilterNeeded');
    
    if (hiddenField != null)
    {
        if(hiddenField.value == "False")
        {
            hiddenField.value = 0;
        }
    }
}
