﻿// JScript File
function correctPNG(img) // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   if (img.height<=55) { document.getElementById("ARLink").style.marginTop = "25px";}
   else { document.getElementById("ARLink").style.marginTop = (0 + (92-img.height)/2) + "px";}
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters) && (version < 7)) 
   {
        
        var imgTitle = "alt='" + img.alt + "' ";
        var imgStyle = "display:inline-block;" + img.style.cssText ;
        if (img.align == "left") imgStyle = "float:left;" + imgStyle;
        if (img.align == "right") imgStyle = "float:right;" + imgStyle;
        if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
        var strNewHTML = "<span " + imgTitle +
         " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
        + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
        + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" ;
        img.outerHTML = strNewHTML;
   }    
}
function recalculateHERF()
{
    if (document.getElementById('hfNavBar').value == 'false'){
        var arr = getQueryString(location.search.substring(1,location.search.length));
        if (arr[1]){
            document.getElementById('aQuote').href = document.getElementById('aQuote').href + 'WBDQuote.aspx?RID=' + arr[1];
            document.getElementById('hfAValue').value = document.getElementById('aCalculator').href + 'calculator.aspx?RID=' + arr[1];
        }
    }
}
function getQueryString(loc)
{
    var index=0;
    var aNameValuePair = loc.split("&");
    var QList = new Array();
    QList = new Array(aNameValuePair.length);
    for ( var i=0; i<aNameValuePair.length; i++ ) {
        param = aNameValuePair[i].split("=");
        QList[index] = param[0];index++;
        QList[index] = param[1];index++;
    }
    
    return QList;
}
function justTest()
{
    var para = getQueryString("");
    
    window.location = "http://localhost:1422/WBD%20INQUIRIES/start.aspx"
}
function getQueryString(loc)
{
    var QList = new Array();
    var index=0;
    var aNameValuePair = loc.split("&");
    QList = new Array(aNameValuePair.length);
    for ( var i=0; i<aNameValuePair.length; i++ ) {
        param = aNameValuePair[i].split("=");
        QList[index] = param[0];index++;
        QList[index] = param[1];index++;
    }
    return QList;
}
function showQuoteProperty(trID, hfID, hfHeight)
{
    
    if (document.getElementById(hfID).value == 'Open')
    {
        document.getElementById(trID).style.display = 'none';
        document.getElementById(trID).style.visibility='hidden';
        document.getElementById(hfID).value = 'Close';//alert(document.getElementById("divOnlineQuote").offsetHeight);
    }
    else
    {
        document.getElementById(trID).style.display = '';
        document.getElementById(trID).style.visibility='visible';
        document.getElementById(hfID).value = 'Open';//alert(document.getElementById("divOnlineQuote").offsetHeight);
    }
    if (parseInt(document.getElementById("divOnlineQuote").offsetHeight) < 500 ){
            this.parent.document.getElementById("frmMainBody").style.height = 500 + "px";
    }
    else {
        this.parent.document.getElementById("frmMainBody").style.height = document.getElementById("divOnlineQuote").offsetHeight + "px";
    }
}
function changeCheckbox(control, index, propID)
{
    if (control.checked == true)
    {
        document.getElementById("hf" + index).value = propID;   
    }
}
function showProperties()
{   
    var control = document.getElementById("cboPropertyNumber");
    if (control != null)
    {
        var pNo = parseInt(control.value);
        if (pNo > 10)
        {
            var phoneNo = document.getElementById("hfCompanyDetails")
            alert ("Please Call Our Office On - " + phoneNo.value);
            control.value = 1;
            pNo = parseInt(control.value);
        }
       for (var x = 1; x <= pNo; x++)
       {

            var pnlProperty = document.getElementById("pnlPropertyDetails" + x);
            if (pnlProperty != null)
            {
                pnlProperty.style.display = '';
                //pnlProperty.style.display = '';
            }
       }
       
       for (var x = pNo + 1; x <= 10; x++)
       {
            var pnlProperty = document.getElementById("pnlPropertyDetails" + x);
            if (pnlProperty != null)
            {
                pnlProperty.style.display = 'none';
            }
       }
    }
}
function getQueryString(loc)
{
    var QList = new Array();
    var index=0;
    var aNameValuePair = loc.split("&");
    QList = new Array(aNameValuePair.length);
    for ( var i=0; i<aNameValuePair.length; i++ ) {
        param = aNameValuePair[i].split("=");
        QList[index] = param[0];index++;
        QList[index] = param[1];index++;
    }
    
    return QList;
}

function showBox(index)
{
    var td = this.parent.document.getElementById("box" + index);
    td.className = 'boxDone';
    for (var i = index+1; i<=2; i++)
    {
        this.parent.document.getElementById("box" + i).className = 'box';
    }
    
}


function EnableDisableControl(status)
{ 
    var suburbID = "txtSuburb";
    var PostcodeID = "txtPostcode";
    var stateID = "txtState"
//    if (document.getElementById(stateID).value == "--")
//    {
//        document.getElementById(suburbID).disabled = status;
//        document.getElementById(PostcodeID).disabled = status;
//    }
    for (var i=1; i<11; i++){
        suburbID = "txtPropertySuburb" + i;
        PostcodeID = "txtPropertyPostcode" + i;
        stateID = "txtPropertyState" + i;
        if (document.getElementById(stateID).value == "--")
        {
            document.getElementById(suburbID).value = "Please Select State";
            document.getElementById(suburbID).disabled = status;
            document.getElementById(PostcodeID).disabled = status;
        }
    }
}

function closeDivSuburbBody()
{
    var divInquiryBody = document.getElementById("divInquiryBody");
    var divSuburbBody = document.getElementById("divSuburbBody")
    if (divInquiryBody !=   null)
    {
        divInquiryBody.style.display = '';
    }
    if (divSuburbBody !=   null)
    {
        divSuburbBody.style.display = 'none';
    }
}

function hideProperties()
{
    for (var x = 2; x <= 10; x++)
   {
        
        var pnlProperty = document.getElementById("pnlPropertyDetails" + x);
        //alert(pnlProperty.id);
        if (pnlProperty == null)
        {
            pnlProperty.style.display = 'none';
        }
   }
}

function captureKeys (evt) {
   var c = document.layers ? evt.which : document.all ? event.keyCode : evt.keyCode;
   var control = document.getElementById("txtPropertySuburb1");
      var suburb = new Array(3)
        suburb[0] = "abcd"
        suburb[1] = "bcde"
        suburb[2] = "cdrt"
        //alert(control.value.length);
        for (i=0; i<=suburb.length; i++)
        {   //alert(suburb[i].substring(0,control.value.length));
            if (suburb[i].substr(0,control.value.length)== control.value )
            {
                alert(suburb[i]);
                break;
            }
        }
  
}

function NodeClick(treeId, nodeId) {
         var tree = igtree_getTreeById(treeId);
         var node = tree.getSelectedNode();
         
        alert(node.dataKey());

    }

function CheckTextBoxInput(btnControl,controlName, txtName)
{
    var control = document.getElementById(controlName);
    if (control.value == "")
    {
        alert("Please enter " + txtName + " OR first few words from " + txtName);
        return false;
    }
    else {return true;}
}

function changeImage1(control)
{
    control.src = "./images/WBDButton01.gif"
}
function changeImage2(control)
{
    control.src = "./images/WBDButton02.gif"
}
function changeRequestQuoteImage(control,btnPressed)
{   
    if (btnPressed)
    {
        control.src = "./images/requestquote_over.gif"
    }
    else
    {
        control.src = "./images/requestQuote.gif"
    }
}

function CheckQuoteInput()
{
    var c_PleaseSelect = "Please Select..";
    var errString = "";
    if (document.getElementById("txtFirstName").value == "")
    {
        errString = "Your Details:\n\nPlease enter first name\n";
    }
    if (document.getElementById("txtLastName").value == "")
    {
        errString = errString + "Please enter last name\n";
    }
    if ((document.getElementById("txtPhone").value == "") & (document.getElementById("txtEmail").value == ""))
    {
        errString = errString + "Please enter phone number or email address\n";
    }

    //Property
    var PropertyNo = document.getElementById("cboPropertyNumber").value; 
    var tempStr = "";
    for (i=1; i <= PropertyNo; i++)
    {
        tempStr = "\n\nProperty-" + i + " Details:\n\n"
        if (document.getElementById("txtPropertyStreet" + i).value == "")
        {
            errString = errString + tempStr + "Please enter street name\n";
            tempStr = "";
        }
        if (document.getElementById("txtPropertyState" + i).value == "--")
        {
            errString = errString + tempStr + "Please select state\n";
            tempStr = "";
        }
        if ((document.getElementById("txtPropertySuburb" + i).value == "") ||(document.getElementById("txtPropertySuburb" + i).value == "Please Select State"))
        {
            errString = errString + tempStr + "Please enter suburb name\n";
            tempStr = "";
        }
        if (document.getElementById("txtPropertyPostcode" + i).value == "")
        {
            errString = errString + tempStr + "Please enter postcode\n";
            tempStr = "";
        }
        if (document.getElementById("txtPropertyPrice" + i).value == "")
        {
            errString = errString + tempStr + "Please enter purchase price of your property\n";
            tempStr = "";
        }

        if (document.getElementById("cboBuildingQuality" + i).value == 0)
        {
            errString = errString + tempStr + "Please select building quality\n";
            tempStr = "";
        }
        if (document.getElementById("cboBuildingCategory" + i).value == 0)
        {
            errString = errString + tempStr + "Please select building category\n";
            tempStr = "";
        }
        
        if ((document.getElementById("cboPropertyAge" + i).value == c_PleaseSelect)||(document.getElementById("cboPropertyAge" + i).value == ""))
        {
            errString = errString + tempStr + "Please select building age\n";
            tempStr = "";
        }
        if (document.getElementById("cboFirstPropertyOwner" + i).value == "-1")
        {
            errString = errString + tempStr + "Please answer, are you the first owner or not\n";
            tempStr = "";
        }
        if (document.getElementById("cboPropertyFurnished" + i).value == "-1")
        {
            errString = errString + tempStr + "Please answer, is your property fully furnished or not\n";
            tempStr = "";
        }
       
    }
    
    if (errString == "")
    {
        showWaitingMsg('Submitting your enquiry');
        return true;
    }
    else 
    {
        alert ("Please respond to the following error/s:\n\n" + errString);
        return false;
    }
}

function openInquiryPage()
{
    window.open("frmInquiries.aspx","_blank","location=1,status=1,scrollbars=1,resizable=0,titlebar=1,menubar=1,toolbar=1");
}

function PriceValidator(sender, args)
{   
    if (!IsNumeric(args.Value))
    {
        args.IsValid = false;
        return;
    }
    args.IsValid = true;
}
function IsNumeric(strString)
{
    var strValidChars = "0123456789.,";
    var strChar;
    var blnResult = true;
    if (strString == "") return false;
    var countChar = strString.match(/[.]/g);
    if (countChar != null){
    if (countChar.length > 1) return false;}
    for (i=0; i<strString.length && blnResult == true; i++)
    {
        strChar = strString.charAt(i);
        if (strValidChars.indexOf(strChar) == -1)
        {   
            blnResult = false;
        }
    }
    //alert (countChar.length)
    
    return blnResult;
}

function cNum(e) {
	var strCheck = '0123456789\b\t';//alert(e.keyCode);
    var whichCode = 0;
    if (window.navigator.userAgent.indexOf("MSIE 6.0") > 0){
        whichCode  = (window.Event) ? e.which : e.keyCode;
    } else {
        whichCode  = (e.which) ? e.which : e.keyCode;
    }
    
    if (whichCode == 0 || whichCode == 13)
    {
      return valSubmit() ;                   
    }
    key = String.fromCharCode(whichCode);  // Get key value from key code
    if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
}

//******************************************************************
//
//   XML Data Access
//
//******************************************************************

var isIE = false;
var cboPropertyAge;var xmlDataName;
var req;

function loadXMLDoc(url) {
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChange;
        req.open("GET", url, true);
        req.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        isIE = true;
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = processReqChange;
            req.open("GET", url, true);
            req.send();
        }
    }
}

function processReqChange() {
    if (req.readyState == 4) {
        if (req.status == 200) {
            buildAgeList();
         } else {
            alert("There was a problem retrieving the XML data:\n" +
                req.statusText);
         }
    }
}

function populatePropertyAge(control, conID)
{
    cboPropertyAge = document.getElementById(conID);
    var buildingCategory = parseInt(control.value);
    controlID = conID;
    if (buildingCategory == 1 || buildingCategory == 2 || buildingCategory == 3){xmlDataName = "CboYear";} //1 = House, 2 = Unit, 3 = Highrise
    else {xmlDataName = "CboYear1";}
    var filePath = "XMLFile.xml";
    while (cboPropertyAge.hasChildNodes()) {cboPropertyAge.removeChild(cboPropertyAge.childNodes[0]);}

    try {
            loadXMLDoc(filePath);
    }
    catch(e) {
        var msg = (typeof e == "string") ? e : ((e.message) ? e.message : "Unknown Error");
        alert("Unable to get XML data:\n" + msg);
        return;
    }
}

function getElementTextNS(prefix, local, parentElem, index) {
    var result = "";
    if (prefix && isIE) {
        result = parentElem.getElementsByTagName(prefix + ":" + local)[index];
    } else {
        result = parentElem.getElementsByTagName(local)[index];
    }
    if (result) {
        if (result.childNodes.length > 1) {
            return result.childNodes[1].nodeValue;
        } else {
            return result.firstChild.nodeValue;    		
        }
    } else {
        return "n/a";
    }
}

function clearTopicList() {
    var select = document.getElementById("topics");
    while (select.length > 0) {
        select.remove(0);
    }
}

function appendToSelect(select, index, value) {
    
    var addOption;
    addOption = new Option(value,value);
    cboPropertyAge.options[index]=addOption ;
}

function buildAgeList() {
    
    var items = req.responseXML.getElementsByTagName(xmlDataName);
    for (var i = 0; i < items.length; i++) {
        appendToSelect(cboPropertyAge, i, items[i].getAttribute("ItemName"));
    }
}


//*******************************************************************
//*******************************************************************



function savePropertyAge(val, index)
{
    document.getElementById("hfPropertyAge" + index).value = val ;
}

function changeBtnImage(control, imageURL)
{
    control.style.backgroundImage = imageURL;
}

function checkInput()
{
    var userName = document.getElementById("txtLoginName").value;
    var password = document.getElementById("txtPassword").value;
    userName = removeAnySpace(userName);
    password = removeAnySpace(password);
    if ((userName.length <= 0) || (password.length <= 0))
    {
        alert("Please enter valid username and password !")
    }
    else 
    {
        document.getElementById("btnLoginClicked").value = true;
        document.getElementById("form1").submit();
    }
   
}

function removeAnySpace(str)
{
    return str.replace(/\s/g, "");
}

function changeTabImage(control, clsname)
{
    if (control.className != "tabDown")
    {
        control.className = clsname;
    }
}

function tabClick(control)
{
    //for (var i=1; i<=3; i++){document.getElementById("tab" + i).className = "tab";}
    control.className = "tabDown";
    switch (control.id){
        case "tab1":{
            document.getElementById("spPlace").innerHTML = "Quote";
            document.getElementById("frmMainBody").src = "frmAcceptQuote.aspx"
//            var te = top.frames['frmMainBody'].document.getElementById("hfPropertyNo").value
//            alert(te);
            break;
        }
        case "tab2":{
            document.getElementById("spPlace").innerHTML = "Job"
            document.getElementById("frmMainBody").src = "frmJobs.aspx"
            break;
        }
        case "tab3":{
            document.getElementById("spPlace").innerHTML = "Invoice"
            document.getElementById("frmMainBody").src = "frmInvoices.aspx"
            break;
        }
    }
}

function setFrameHeight(control)
{
    var fHeight=0;
    if (window.frames['frmMainBody'].document.getElementById("frmHeight"))
    {
        fHeight = parseInt(window.frames['frmMainBody'].document.getElementById("frmHeight").value);
    }
    else {fHeight = 500;}
    if (fHeight < 400) fHeight = 400;
    control.style.height = fHeight + "px";
}

function submitForm()
{           
    var anyProperty = false;
    if (document.getElementById("hfSubmitButton").value == "submit"){
        if (document.getElementById("hfPropertyCount")){
            var propertyCount = parseInt(document.getElementById("hfPropertyCount").value);
            var strErr = '';
            for (var i = 1; i<=propertyCount; i++){
                if (document.getElementById("chkProp"+i)){if (document.getElementById("chkProp"+i).checked){strErr += "Property " + (i + 1);}anyProperty=true;}
            }
            if (anyProperty){
                if (strErr == ''){alert("You have not selected any property!");return;}
                showWaitingMsg('Submitting your job(s)'); 
                if (this.frmBody){
                    this.frmBody.frmMainBody.document.form1.submit();
                }
                else if (this.frmMainBody)
                { 
                    this.frmMainBody.document.form1.submit();
                }
                else {document.form1.submit();}
            }else{
                alert('There is no order to be submitted');
            }
        }
        else{
            alert('There is no order to be submitted');
        }
    }
}

function showHelp(control,helpType,direction)
{
    var msg = document.getElementById("dvWait");
    var Question;
    var Answer;
    var Left =  findPosX(control); 
    var Top = findPosY(control);
    var W;
    var H;
    var tH;
    var tabOpen="";
    var tabClose="";
    var pageScrollY = getScrollY();
    var leftPad = 0;
    switch (helpType)
    {
        
        case "fullyfurnished":
        {
            Question = "Is your property fully furnished?";
            Answer = "Only answer yes to this question, if you own all the furniture in the property, and you would like us to include them in our report.<br/><br/>" +
                    "This question is applicable for owners of serviced apartments, hotel rooms and holiday houses. <br/><br>" +
                    "Items may include beds, linen, cutlery, crockery, lounges etc<br/><br/>" +
                    "If answering yes, we will require an inventory and there will be an additional charge of <b>$110 Inc GST</b> to include these items in your report.<br/>";
            Top = Top - 200;
            if (direction=='left') {Left = Left - 600;leftPad=600;}
            else {Left = Left - 50;leftPad = 50;}
            if (pageScrollY > Top) {
                Top = Top + 235;
                tabOpen = "<table cellpadding='0' cellspacing='0' width='100%'><tr><td style='padding-left:" + (leftPad+2) + "px;' align='left'><img src='./Images/point_up.gif' align='center' border='0' style='vertical-align:bottom;'/></td></tr><tr><td width='100%'>"
                tabClose = "</td></tr></table>"
            }else {
                tabOpen = "<table cellpadding='0' cellspacing='0' width='100%'><tr><td width='100%'>"
                tabClose = "</td></tr><tr><td style='padding-left:" + (leftPad+2) + "px;' align='left'><img src='./Images/point_down.gif' align='center' border='0' style='vertical-align:top;'/></td></tr></table>"
            }
            W= 660;
            H= 210;
            tH = H - 60; 
            
            break;
        }
        case "includeFurniture":
        {
            Question = "Include furniture package...";
            Answer = "Only select this option, if you own all the furniture in the property, and you would like us to include them in our report.<br/><br/>" +
                    "This question is applicable for owners of serviced apartments, hotel rooms and holiday houses. <br/><br>" +
                    "Items may include beds, linen, cutlery, crockery, lounges etc<br/><br/>" +
                    "we will require an inventory and there will be an additional charge of <b>$110 Inc GST</b> to include these items in your report.<br/>";
            Top = Top - 200;
            if (direction=='left') {Left = Left - 600;leftPad=600;}
            else {Left = Left - 50;leftPad = 50;}
            if (pageScrollY > Top) {
                Top = Top + 235;
                tabOpen = "<table cellpadding='0' cellspacing='0' width='100%'><tr><td style='padding-left:" + (leftPad+2) + "px;' align='left'><img src='./Images/point_up.gif' align='center' border='0' style='vertical-align:bottom;'/></td></tr><tr><td width='100%'>"
                tabClose = "</td></tr></table>"
            }else {
                tabOpen = "<table cellpadding='0' cellspacing='0' width='100%'><tr><td width='100%'>"
                tabClose = "</td></tr><tr><td style='padding-left:" + (leftPad+2) + "px;' align='left'><img src='./Images/point_down.gif' align='center' border='0' style='vertical-align:top;'/></td></tr></table>"
            }
            W= 650;
            H= 210;
            tH = H - 60; 
            
            break;
        }
        case "20YearForecast":
        {
            Question = "Forecast...";
            Answer = "The 10 year estimate results are produced via the Washington Brown Tax Depreciation Calculator.<br/><br/>" +
                    "<b style='text-decoration:underline;'>Please note:</b> Washington Brown Tax Depreciation reports last for up to <b>40 years</b>, depending on the age of your investment property.";
            Top = Top - 120;
            if (direction=='left') {Left = Left - 600;leftPad=600;}
            else {Left = Left - 50;leftPad = 50;}
            if (pageScrollY > Top) {
                Top = Top + 235;
                tabOpen = "<table cellpadding='0' cellspacing='0' width='100%'><tr><td style='padding-left:" + (leftPad+2) + "px;' align='left'><img src='./Images/point_up.gif' align='center' border='0' style='vertical-align:bottom;'/></td></tr><tr><td width='100%'>"
                tabClose = "</td></tr></table>"
            }else {
                tabOpen = "<table cellpadding='0' cellspacing='0' width='100%'><tr><td width='100%'>"
                tabClose = "</td></tr><tr><td style='padding-left:" + (leftPad+2) + "px;' align='left'><img src='./Images/point_down.gif' align='center' border='0' style='vertical-align:top;'/></td></tr></table>"
            }
            W= 650;
            H= 130;
            tH = H - 60; 
            
            break;
        }
    }
    
    
    
    msg.style.position="absolute";
    msg.style.top = Top + "px";
    msg.style.left = Left + "px";
    msg.style.display = 'block';
    msg.style.visibility='visible';
    msg.style.height= H + "px"; // "150px";
    msg.style.width= W + "px"; //"580px";
    msg.style.overflow = "auto";
    msg.style.zIndex = 5;
    msg.className = "transparent";
    msg.innerHTML = tabOpen +
                    "<table cellpadding='0' cellspacing='0' width='100%' style='background-color:red;'><tr><td class='tableHeader1' width='100%'>" +
                    "<table width='100%' cellpadding='0' cellspacing='0' height='100%'><tr><td width='20px' align='right'>" +
                    "<img src='./Images/bullet.gif' align='center'/></td><td align='left' class='tdHeaderText'>&nbsp;&nbsp;" + Question + "</td></tr></table></td></tr>" + 
                    "<tr><td width='100%' height='" + tH + "px' class='tdText toolTipClass' style='padding:5px 5px 5px 5px;'>" + Answer +
                    "</td></tr></table>" + tabClose;
                    
    var iframe = document.getElementById('frmWait');
    iframe.style.position="absolute";
    iframe.style.display = 'block';
    iframe.style.zIndex = 4;
    iframe.style.width = msg.offsetWidth-1;
    iframe.style.height = msg.offsetHeight-1;
    Left += 0; Top+=0;
    iframe.style.left = Left + "px";
    iframe.style.top = Top + "px";
    if ((navigator.appName.indexOf("Netscape")!=-1) && (parseInt(navigator.appVersion)>=5)){
        iframe.style.MozOpacity=0;iframe.style.KhtmlOpacity = 0;}
    else if ((navigator.appName.indexOf("Microsoft")!=-1) && (parseInt(navigator.appVersion)>=4)){
        iframe.style.filter="alpha(opacity:0)";}
    else {iframe.style.opacity = 0;}
}

function hideMessageBox()
{
    var msg = document.getElementById("dvWait");
    msg.innerHTML = "";
    msg.style.display = 'none';
    msg.style.visibility='hidden';
    
    if(document.getElementById('frmWait')!=null)
	{
    // hide IFRAME
		var iframe = document.getElementById('frmWait');
		iframe.style.display = 'none';
	}
}

function locationHref(strAnchorID)
{
//    var hashValue='#' + strAnchorID;
//    if(location.hash!=hashValue){location.hash=hashValue;}
    this.parent.window.scrollTo(0,0);
   
}
var Height = 266; 
var h=0;
var interval;var intervalD;var intervalFalse;
var Top;
var opt;
var Width;
var Left;var reqProperty;
function imgMouseOver(trID, tr2ID, controlNo)
{  
    var iframe;var doc;
    var index = parseInt(controlNo); 
    var pageScrollY = getScrollY();
    var myIdentifier = Math.round(Math.random() * 10000);
    var url = "./frmPropertyDetails.aspx?PropertyNo=" + index + "&a=" + myIdentifier;
    if (this.parent.document.getElementById("iframetop")){iframe = this.parent.document.getElementById("iframetop");Left = this.parent.document.getElementById("form1").offsetLeft;}
        else if (document.getElementById("iframetop")){iframe = document.getElementById("iframetop");Left = document.getElementById("form1").offsetLeft;}
    //createXMLHTTP();
    
    
    if ((intervalD == null) && (interval == null)){
        
        
        Height = 306;h=0;Top = 145; Width=0; 
        document.getElementById(trID).className = "tableHeader2";
        document.getElementById(tr2ID).className = "tableHeader2";
        getPropertyPopupCords(document.getElementById(trID));
        if( iframe.contentDocument )
            doc = iframe.contentDocument; // For NS6
        else if( iframe.contentWindow ) 
            doc = iframe.contentWindow.document; // For IE5.5 and IE6
        else if( iframe.document )
            doc = iframe.document; // For IE5
        else
            doc = control.document;
        doc.writeln("<body ondragstart='return false;' style='Margin: 0px; Background: transparent;'>");
        doc.writeln("   <table style='vertical-align:top; height:100%; width:100%; Background: transparent;' cellpadding='0' cellspacing='0'>");
        doc.writeln(" <tr style='Background: transparent;'>");
        doc.writeln(" <td style='vertical-align:middle; width:100%;height:100%;Background: transparent;' align='center'>");
        doc.writeln("  <img src='./Images/dot_ani.gif' alt='Processing' style='border:0;' id='waitImg'/><br>Loading...");
        doc.writeln("     </td>");
        doc.writeln("  </tr>");
        doc.writeln("  </table>");
        doc.writeln("</body>");
        doc.close();
    	    
        iframe.style.position="absolute";
        iframe.style.zIndex = 4;
        iframe.style.height = "0px"; //Height + "px";
        iframe.style.width = Width + "px"; //917px
        iframe.style.top = Top + "px";
        iframe.src = "frmPropertyDetails.aspx?PropertyNo=" + index + "&a=" + myIdentifier;
        iframe.style.left = Left + "px"; // screen.availHeight and screen.availWidth gives the height and width of the screen viewable area.
        iframe.className = "tdTop2px";
        //iframe.style.display = '';
        h = 0;opt=0;
        if (pageScrollY > (Top - 3)){
            document.getElementById("hfPopupStatus").value = "down";Top += 3;
            interval = setInterval('slideOutDownwardStatus()', 10);
        }
        else{
            document.getElementById("hfPopupStatus").value = "up";
            interval = setInterval('slideOutUpwardStatus()', 10);
        }
    }
}

function createXMLHTTP()
{
    try {reqProperty = new ActiveXObject("Msxml2.XMLHTTP");}
    catch (e) {
        try {reqProperty = new ActiveXObject("Microsoft.XMLHTTP");}
        catch (oe){reqProperty = null; }
    }
    if (!reqProperty && typeof XMLHttpRequest != "undefined") {reqProperty = new XMLHttpRequest();}
}

function imgStatusOver(controlNo, statusID)
{  
    
    var iframe;
    var index = parseInt(controlNo); 
    var pageScrollY = getScrollY();
    if ((intervalD == null) && (interval == null)){
        
        if (this.parent.document.getElementById("iframetop")){iframe = this.parent.document.getElementById("iframetop");Left = this.parent.document.getElementById("frmMainBody").offsetLeft;}
	    else if (document.getElementById("iframetop")){iframe = document.getElementById("iframetop");Left = document.getElementById("frmMainBody").offsetLeft;}
        Height = 232;h=0; 
        
        document.getElementById("trProp" + index).className = "tableHeader2";
        Top = 183;
        
        
        document.getElementById("trProp" + index).className = "tableHeader2";
        var doc ;

        getPropertyPopupCordsStatus(document.getElementById("trProp" + index));
        
        if( iframe.contentDocument )
	            doc = iframe.contentDocument; // For NS6
        else if( iframe.contentWindow ) 
            doc = iframe.contentWindow.document; // For IE5.5 and IE6
        else if( iframe.document )
            doc = iframe.document; // For IE5
        else
            doc = control.document;
        doc.writeln("<body ondragstart='return false;' style='Margin: 0px; Background: transparent;'>");
        doc.writeln("   <table style='vertical-align:top; height:100%; width:100%; Background: transparent;' cellpadding='0' cellspacing='0'>");
        doc.writeln(" <tr style='Background: transparent;'>");
        doc.writeln(" <td style='vertical-align:middle; width:100%;height:100%;Background: transparent;' align='center'>");
        doc.writeln("  <img src='./Images/dot_ani.gif' alt='Processing' style='border:0;' id='waitImg'/><br>Loading...");
        doc.writeln("     </td>");
        doc.writeln("  </tr>");
        doc.writeln("  </table>");
        doc.writeln("</body>");
        doc.close();
        
        iframe.style.position="absolute";
        iframe.style.zIndex = 4;
        iframe.style.height = "0px"; //Height + "px";
        iframe.style.width = "470px";
        iframe.style.top = Top + "px";
        iframe.src = "frmStatus.aspx?Status=" + statusID;
        iframe.style.left = Left + "px"; // screen.availHeight and screen.availWidth gives the height and width of the screen viewable area.
        iframe.style.display = 'block';
        h = 0;opt=0;
        if (pageScrollY > (Top - 3)){
            document.getElementById("hfPopupStatus").value = "down";alert("");
            interval = setInterval('slideOutDownwardStatus()', 10);
        }
        else{
            document.getElementById("hfPopupStatus").value = "up";
            interval = setInterval('slideOutUpwardStatus()', 10);
        }
    }
}

function getPropertyPopupCords(control)
{
    var pageScrollY = getScrollY();
    var pageStatus = document.getElementById("hfFormStatus").value;
    
    //Left = ((screen.availWidth/2);
   
    Left =  findPosX(control);//getScreenWidth()/2 ; 
    Top = findPosY(control);
    if (IsBrowserIE()){
        Left += 2;
        Height = 306;
	    if (Top>=306){
	        if (window.navigator.userAgent.indexOf("MSIE 6.0")>0){Top = Top - 315;Width = 870;}
	        else {Top = Top - 310;Width = 872;}
	    }
	    
    }
    else if (IsBrowserSafari()){
        Height = 344;Left += 1;
	    if (Top>=344){Top = Top - 349;}
	    Width = 873;
    }
    else if (IsBrowserFirefox()){
        Height = 340;
        if (Top>=340){Top = Top - 346;}
	    Width = 873;
    }
    else{
        Height = 331;
        if (Top>=331) {Top = Top - 337;}
	    Width = 872;
    }
}
function getPropertyPopupCordsStatus(control)
{
    var pageScrollY = getScrollY();
    var pageStatus = document.getElementById("hfFormStatus").value;
    //Left = ((screen.availWidth/2);
   
    Left =  getScreenWidth()/2 ; 
    Top = findPosY(control);
    if (IsBrowserIE()){
        Height = 232;
	    if (Top>=75){Top = Top - 28;}
	    if (Left>=393){Left = Left - 0; }
	    Width = 855;
	    if (pageScrollY > (Top - 3)) {Top -= 4;}
	    
    }
    else if (IsBrowserSafari()){
        Height = 230;
	    if (Top>=114){Top = Top - 17;}
	   
	    if (Left>=404){Left = Left - 10;} 
	    Width = 855;
	    if (pageScrollY > (Top - 3)) {Top -= 4;}
    }
    else if (IsBrowserFirefox()){
        Height = 230;
        if (Top>=119){Top = Top - 25;} 
        if (Left>=407){Left = Left - 8;}
	    Width = 856;
	    if (pageScrollY > (Top - 3)) {Top -= 5;}
    }
    else{
        Height = 232;
        if (Top>=110){Top = Top - 27;}
        if (Left>=404){Left = Left - 8;} 
	    Width = 854;
	    if (pageScrollY > (Top - 3)) {Top -= 5;}
    }
}
function getScreenWidth()
{
    if (window.innerWidth) {return window.innerWidth;}
    else {return document.documentElement.clientWidth;}
}
function slideOutUpward()
{
    h += 8;opt += 3;if (opt > 100) {opt = 100;}
    if (h > Height) {h = Height;}
    if (h < Height){
        fnSlideOutUpward();
    }
    else {
        fnSlideOutUpward();
        clearInterval(interval);
        interval = null;
    }
}
function slideOutUpwardStatus()
{
    h += 8;opt += 4;if (opt > 100) {opt = 100;}
    if (h > Height) {h = Height;}
    if (h < Height){
        fnSlideOutUpward();
    }
    else {
        fnSlideOutUpward();
        clearInterval(interval);
        interval = null;
    }
}
function fnSlideOutUpward()
{
    var iframe = this.parent.document.getElementById('iframetop');
    iframe.style.height = h + "px";
    iframe.style.top = (Top + (Height-h)) + "px";
    iframe.style.display = '';
    if ((navigator.appName.indexOf("Netscape")!=-1) && (parseInt(navigator.appVersion)>=5)){
        iframe.style.MozOpacity=opt/100;iframe.style.KhtmlOpacity = opt/100;}
    else if ((navigator.appName.indexOf("Microsoft")!=-1) && (parseInt(navigator.appVersion)>=4)){
        iframe.style.filter="alpha(opacity:" + opt + ")";}
    else {iframe.style.opacity = opt/100;}
}
function slideOutDownward()
{
    h += 8;opt += 3;if (opt > 100) {opt = 100;}
    if (h > Height) {h = Height;}
    if (h < Height){
        fnSlideOutDownward();
    }
    else {
        fnSlideOutDownward();
        clearInterval(interval);
        interval = null;
    }
}
function slideOutDownwardStatus()
{
    h += 8;opt += 4;if (opt > 100) {opt = 100;}
    if (h > Height) {h = Height;}
    if (h < Height){
        fnSlideOutDownward();
    }
    else {
        fnSlideOutDownward();
        clearInterval(interval);
        interval = null;
    }
}
function fnSlideOutDownward()
{
    var iframe = this.parent.document.getElementById('iframetop');
    iframe.style.height = h + "px";
    iframe.style.top = (Top + (Height+43)) + "px";
    iframe.style.display = '';
    if ((navigator.appName.indexOf("Netscape")!=-1) && (parseInt(navigator.appVersion)>=5)){
        iframe.style.MozOpacity=opt/100;iframe.style.KhtmlOpacity = opt/100;}
    else if ((navigator.appName.indexOf("Microsoft")!=-1) && (parseInt(navigator.appVersion)>=4)){
        iframe.style.filter="alpha(opacity:" + opt + ")";}
    else {iframe.style.opacity = opt/100;}
}
var curTR;var curTR2;
function imgMouseOut(trID, tr2ID, Index)
{
    if (interval != null){resetAll();clearInterval(interval);interval=null;eraseBackgroundTR();
    }
    else if (intervalD != null){resetAll();clearInterval(intervalD);intervalD=null;eraseBackgroundTR();
    }
    
    var status = document.getElementById("hfPopupStatus").value;
    var iframe = this.parent.document.getElementById('iframetop');
    var tempStr = iframe.style.height;
    
    curTR = trID; curTR2 = tr2ID;
    Height = parseInt(tempStr.substring(0, (tempStr.length-2)));
    tempStr = iframe.style.top;
    Top = parseInt(tempStr.substring(0, (tempStr.length-2)));
    document.getElementById("hfPopupStatus").value = "closed";
	h = 0; opt = 0;
    if (status == "up") {intervalD = setInterval('slideInDownward()', 10);}
    else if (status == "down") {intervalD = setInterval('slideInUpward()', 10);}
}
function imgMouseOutStatus(trID, Index)
{
    if (interval != null){resetAll();clearInterval(interval);interval=null;eraseBackgroundTR();}
    else if (intervalD != null){resetAll();clearInterval(intervalD);intervalD=null;eraseBackgroundTR();}
    
    var status = document.getElementById("hfPopupStatus").value;
    var iframe = this.parent.document.getElementById('iframetop');
    var tempStr = iframe.style.height;
    curTR = trID;
    Height = parseInt(tempStr.substring(0, (tempStr.length-2)));
    tempStr = iframe.style.top;
    Top = parseInt(tempStr.substring(0, (tempStr.length-2)));
    document.getElementById("hfPopupStatus").value = "closed";
	h = 0; opt = 0;
    if (status == "up") {intervalD = setInterval('slideInDownwardStatus()', 10);}
    else if (status == "down") {intervalD = setInterval('slideInUpwardStatus()', 10);}
}
function slideInUpward()
{
    h += 8;opt += 3;if (opt > 100) {opt = 100;}
    if (h > Height) {h = Height;}
    if (h < Height){
        fnSlideInUpward();
    }
    else {
        fnSlideInUpward();
        resetAll();
        clearInterval(intervalD);
        intervalD = null;
    }
}
function slideInUpwardStatus()
{
    h += 8;opt += 4;if (opt > 100) {opt = 100;}
    if (h > Height) {h = Height;}
    if (h < Height){
        fnSlideInUpward();
    }
    else {
        fnSlideInUpward();
        resetAll();
        clearInterval(intervalD);
        intervalD = null;
    }
}
function fnSlideInUpward()
{
    var iframe = this.parent.document.getElementById('iframetop');
    iframe.style.height = (Height - h) + "px";
    //iframe.style.top = (Top + (Height+25)) + "px";
    iframe.style.display = '';
    if ((navigator.appName.indexOf("Netscape")!=-1) && (parseInt(navigator.appVersion)>=5)){
        iframe.style.MozOpacity=(100-opt)/100;iframe.style.KhtmlOpacity = (100-opt)/100;}
    else if ((navigator.appName.indexOf("Microsoft")!=-1) && (parseInt(navigator.appVersion)>=4)){
        iframe.style.filter="alpha(opacity:" + (100-opt) + ")";}
    else {iframe.style.opacity = (100-opt)/100;}
}
function fnSlideInDownward()
{
    var iframe = this.parent.document.getElementById('iframetop');
    iframe.style.height = (Height - h) + "px";
    iframe.style.top = (Top + h) + "px";
    iframe.style.display = '';
    if ((navigator.appName.indexOf("Netscape")!=-1) && (parseInt(navigator.appVersion)>=5)){
        iframe.style.MozOpacity=(100-opt)/100;iframe.style.KhtmlOpacity = (100-opt)/100;}
    else if ((navigator.appName.indexOf("Microsoft")!=-1) && (parseInt(navigator.appVersion)>=4)){
        iframe.style.filter="alpha(opacity:" + (100-opt) + ")";}
    else {iframe.style.opacity = (100-opt)/100;}
}
function slideInDownward()
{
    h += 8;opt += 3;if (opt > 100) {opt = 100;}
    if (h > Height) {h = Height;}
    if (h < Height){
        fnSlideInDownward();
    }
    else {
        fnSlideInDownward();
        resetAll();
        clearInterval(intervalD);
        intervalD = null;
    }
}
function slideInDownwardStatus()
{
    h += 8;opt += 4;if (opt > 100) {opt = 100;}
    if (h > Height) {h = Height;}
    if (h < Height){
        fnSlideInDownward();
    }
    else {
        fnSlideInDownward();
        resetAll();
        clearInterval(intervalD);
        intervalD = null;
    }
}

function resetAll()
{
    var iframe;
    if (interval){clearInterval(interval);interval=null;}
    else if (intervalD){clearInterval(intervalD);intervalD=null;}
    if (this.parent.document.getElementById("iframetop")){iframe = this.parent.document.getElementById("iframetop");}
	else if (document.getElementById("iframetop")){iframe = document.getElementById("iframetop");}
	
	Height = 0; Top = 0; h=0;opt=0;
	iframe.style.display = 'none';
	iframe.src = "";
	eraseBackgroundTR();
//	if (this.parent.document.getElementById("waitMsg")){this.parent.document.getElementById("waitMsg").style.display = 'none';}
//	else if (document.getElementById("waitMsg")){document.getElementById("waitMsg").style.display = 'none';}
}
function eraseBackgroundTR()
{
    if (curTR){
        if (this.parent.document.getElementById(curTR)){this.parent.document.getElementById(curTR).className = "noBackground";}
	    else if (document.getElementById(curTR)){document.getElementById(curTR).className = "noBackground";}
	}
	if (curTR2){
        if (this.parent.document.getElementById(curTR2)){this.parent.document.getElementById(curTR2).className = "noBackground";}
	    else if (document.getElementById(curTR2)){document.getElementById(curTR2).className = "noBackground";}
	}
}
function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }

  function getScrollX()
  {
    var pX ;
    if (document.all){
        if (document.body.scrollLeft){pX = document.body.scrollLeft;}
        else {pX = document.documentElement.scrollLeft;}
    }
    else{
        pX = window.pageXOffset;
    }
    return pX;
  }
  function getScrollY()
  {
    var pY ;
    if (document.all){
        if (document.body.scrollTop){pY = document.body.scrollTop;}
        else {pY = document.documentElement.scrollTop;}
    }
    else{
        pY = window.pageYOffset;
    }
    return pY;
  }
function GetValueFromArray(arr,searchChr)
{
    for (var i=0;i<arr.length;i++){
        if (arr[i]==searchChr) return arr[i+1];
    }
    return -1;
}
function lightup(opacity){
    var iframe = this.parent.document.getElementById('iframetop');
   //var frm; if (top.document.getElementById('frm')) {alert(""); frm = document.getElementById('frm');}
   while (opacity != 99) {
    opacity = opacity + 10; if (opacity > 99){opacity = 99;}
    if (navigator.appName.indexOf("Netscape")!=-1&&parseInt(navigator.appVersion)>=5){
    iframe.style.MozOpacity=opacity/100;}
    else if (navigator.appName.indexOf("Microsoft")!=-1&&parseInt(navigator.appVersion)>=4){
    iframe.style.filter="alpha(opacity=" + opacity + ")";wait(10);}
    
    }
}
function wait(sec) 
{
    var now = new Date();
    now.setMilliseconds(parseInt(now.getMilliseconds()) + parseInt(sec));
    var n2 = new Date();
    while (now > n2){n2 = new Date();}
}

function getBrowserWindowSize() {
    var winW = 630, winH = 460;

    if (parseInt(navigator.appVersion)>3) {
        if (navigator.appName=="Netscape") {
            winW = window.innerWidth;
            winH = window.innerHeight;
        }
        if (navigator.appName.indexOf("Microsoft")!=-1) {
            winW = this.parent.parent.document.body.offsetWidth;
            winH = this.parent.parent.document.body.offsetHeight;
        }
    }

    var rval = {
        width: winW,
        height: winH
    };

    return rval;
}

function GetIFrameDocument(conName)
{
	var doc;
	var control = document.getElementById(conName);
	if( control.contentDocument )
		// For NS6
		doc = control.contentDocument; 
	else if( control.contentWindow ) 
		// For IE5.5 and IE6
		doc = control.contentWindow.document;
	else if( control.document )
		// For IE5
		doc = control.document;
	else
// TODO: Confirm this should be the default
		doc = control.document;
	
	return doc;
}

function IsBrowserIE()
{
	try
	{ return (window.navigator.userAgent.indexOf("MSIE ") > 0); }
	catch(x)
	{ return false; }
}

function IsBrowserNS()
{
	try
	{ return (window.navigator.userAgent.indexOf("Netscape") > 0); }
	catch(x)
	{ return false; }
}
function IsBrowserSafari()
{
	try
	{ return (window.navigator.userAgent.indexOf("Safari") > 0); }
	catch(x)
	{ return false; }
}
function IsBrowserChrome()
{
	try
	{ return (window.navigator.userAgent.indexOf("Chrome") > 0); }
	catch(x)
	{ return false; }
}
function IsBrowserFirefox()
{
	try
	{ return (window.navigator.userAgent.indexOf("Firefox") > 0); }
	catch(x)
	{ return false; }
}

function pausecomp(millis)
{
    var date = new Date();
    var curDate = null;

    do { curDate = new Date(); }
    while(curDate-date < millis);
}




function moveWin()
{
    for (var i=1; i<1001; i++)
    window.moveBy(1,1);
    window.moveBy(-1000,-1000);
}


function EnableDisableSubmitButton(status)
{
    if (document.getElementById("chk")){
        if (document.getElementById("chk").checked) status = true;
    }
    if (document.getElementById("btnSubmitQuoteLeft")){
        var btnLeft = document.getElementById("btnSubmitQuoteLeft");
        var btnMiddle = document.getElementById("btnSubmitQuote");
        var btnRight = document.getElementById("btnSubmitQuoteRight");
        
        if (status){
            document.getElementById("hfSubmitButton").value = "submit"; 
            btnLeft.className = "btnAcceptQuoteLeft";
            btnMiddle.className = "btnAcceptQuote";
            btnRight.className = "btnAcceptQuoteRight";
            setOpt(btnLeft , 100)
            setOpt(btnMiddle , 100)
            setOpt(btnRight , 100)
            
        }
        else {
            document.getElementById("hfSubmitButton").value = "donotsubmit"; 
            btnLeft.className = "btnAcceptQuoteLeftInactive";
            btnMiddle.className = "btnAcceptQuoteInactive";
            btnRight.className = "btnAcceptQuoteRightInactive";
            setOpt(btnLeft , 50)
            setOpt(btnMiddle , 50)
            setOpt(btnRight , 50)
        }
    }
}
function fnChkTANDC(control)
{
    if (control.checked){
        EnableDisableSubmitButton(true);
    }
    else {
        EnableDisableSubmitButton(false);
    }
}

function setOpt(control, optInt)
{
    if ((navigator.appName.indexOf("Netscape")!=-1) && (parseInt(navigator.appVersion)>=5)){
        control.style.MozOpacity=optInt/100;control.style.KhtmlOpacity = optInt/100;}
    else if ((navigator.appName.indexOf("Microsoft")!=-1) && (parseInt(navigator.appVersion)>=4)){
        control.style.filter="alpha(opacity:" + optInt + ")";}
    else {control.style.opacity = optInt/100;}
}
function removeFurnitureFee(control, index)
{
    if (control.checked){
        document.getElementById("lblFurnitureFee" + index).style.visibility = "visible";
        document.getElementById("lblFurnitureText" + index).style.visibility = "visible";
    }
    else{
        document.getElementById("lblFurnitureFee" + index).style.visibility = "hidden";
        document.getElementById("lblFurnitureText" + index).style.visibility = "hidden";
    }
    calculateTotalFee(control, index);
}
function calculateTotalFee(control, index)
{
    var tempStr = '';
    var totalDiscount = 0.0;
    var totalFee = 0.0;
    var totalFurnitureFee = 0.0;
    var allSelected = true;
    var lblTotalFee = document.getElementById('lblTotalFee');
    var fixedDiscount = parseBool(document.getElementById('hfFixedDiscount').value);
    var propertyCount = parseInt(document.getElementById("hfPropertyCount").value);
    for (var i=1; i<=propertyCount; i++){
        if (document.getElementById("chkProp"+i)){
            if (document.getElementById("chkProp"+i).checked) {
                totalFee += getFloat(document.getElementById('hfFee'+i).value);
                totalDiscount += getFloat(document.getElementById('hfDiscount'+i).value);
                if (document.getElementById('chkFurniture' + i)){
                    if (document.getElementById("chkFurniture"+i).checked){totalFurnitureFee += getFloat(document.getElementById('lblFurnitureFee'+i).innerHTML);}
                }
            }
            else {allSelected=false;}
        }
    }
    
    totalFee = totalFee + totalFurnitureFee;
    if (document.getElementById("rSubTotal")){
        var subRow = document.getElementById("rSubTotal");
        var sDiscount = document.getElementById("rDiscount");
        var blackRow = document.getElementById("rBlank");
        if (allSelected){
            subRow.style.display = '';
            sDiscount.style.display = '';
            blackRow.style.display = '';
            document.getElementById("hfAllSelected").value = true;
            setFloatText(document.getElementById("lblrSubTotal"),totalFee);
            setFloatText(document.getElementById("lblrDiscount"),totalDiscount);
            totalFee -= totalDiscount;
            
            for (var i=1; i<=propertyCount; i++){
                if (document.getElementById('lblFeeWithDiscount' + i)){
                    if (document.getElementById('tdFee' + i)) document.getElementById('tdFee' + i).className = "normalFont crossText";
                    if (document.getElementById('lblFee' + i)) document.getElementById('lblFee' + i).innerHTML = document.getElementById("hfFee" + i).value;
                    if (document.getElementById('lblFeeWithDiscount' + i)) {
                        document.getElementById('lblFeeWithDiscount' + i).style.display = "";
                        document.getElementById('lblFeeWithDiscount' + i).style.visibility = "visible";
                    }
                }
            }
        }
        else {
            for (var i=1; i<=propertyCount; i++){
                if (document.getElementById('lblFeeWithDiscount' + i)){
                    if (document.getElementById('tdFee' + i)) document.getElementById('tdFee' + i).className = "normalFont";
                    if (document.getElementById('lblFeeWithDiscount' + i)) {
                        document.getElementById('lblFeeWithDiscount' + i).style.display = "none";
                        document.getElementById('lblFeeWithDiscount' + i).style.visibility = "hidden";
                    }
                }
            }
            if (control.checked) {if (document.getElementById('lblFee' + index)) document.getElementById('lblFee' + index).innerHTML = document.getElementById("hfFee" + index).value;}
            else {if (document.getElementById('lblFee' + index)) document.getElementById('lblFee' + index).innerHTML = "$0";}
            document.getElementById("hfAllSelected").value = false;
            if (fixedDiscount){
                setFloatText(document.getElementById("lblrSubTotal"),totalFee);
                setFloatText(document.getElementById("lblrDiscount"),totalDiscount);
                totalFee -= totalDiscount;
            }
            else{
                subRow.style.display = 'none';
                sDiscount.style.display = 'none';
                blackRow.style.display = 'none';
            }
        }
    }
    setFloatText(lblTotalFee,totalFee);
}
function setFloatText(control,totalFee)
{
    if (!totalFee.toFixed){
        totalFee = Math.round (totalFee*Math.pow (10,2)) / Math.pow (10,2)
        control.innerHTML = "$" + totalFee;
    }
    else{
        control.innerHTML = "$" + totalFee.toFixed(2);
    }
}
function getFloat(text)
{
    var tempArr = new Array('$',',');
    for (var i=0; i<tempArr.length; i++){
        text = text.replace(tempArr[i],"");
    }
    return parseFloat(text);
}
function parseBool(text)
{
    text = text.toUpperCase();
    if (text=='TRUE') {return true;}
    else {return false;}
}
function GetWidth()
{
    var x=0;
    if (self.innerHeight){
        x=self.innerWidth;
    }
    else if (document.documentElement && document.documentElement.clientHeight){
        x=document.documentElement.clientWidth;
    }
    else if (document.body){
        x=document.body.clientWidth;
    }
    return x;
}

var eInt;var eHeight;
function showTANDC()
{
    
    var status = document.getElementById("hfTANDCStatus");
    var divTandC = document.getElementById("divTANDC");
    var frmTandC = document.getElementById("frmTANDC");
    if (status.value == 'false')
    {
        status.value = 'true';
        eHeight = 0;
        frmTandC.style.height = "200px";
        divTandC.style.display = 'block';
        divTandC.style.visibility = 'visible';
        frmTandC.style.display = 'block';
        frmTandC.style.visibility = 'visible';
        eInt = setInterval('expandSlow()', 10);
    }
    else
    {
        eHeight = 200;
        status.value = 'false';
        
        eInt = setInterval('collapseSlow()', 10);
    }
}

function expandSlow()
{
    eHeight += 20;
    var frmTandC = document.getElementById("frmTANDC");
    if (eHeight > 200)
    {
        clearInterval (eInt);
    }
    else
    { 
        frmTandC.style.height = eHeight + "px";
    }
    
}

function collapseSlow()
{
    eHeight = eHeight - 20;
    var frmTandC = document.getElementById("frmTANDC");
    if (eHeight <= 0)
    {
        var divTandC = document.getElementById("divTANDC");
        frmTandC.style.height = "0px";
        divTandC.style.display = 'none';
        divTandC.style.visibility = 'hidden';
        frmTandC.style.display = 'none';
        frmTandC.style.visibility = 'hidden';
        clearInterval (eInt);
    }
    else
    { 
        frmTandC.style.height = eHeight + "px";
    }
}
//************************************************************
//                  Show waiting image / message
//*************************************************************

var opt1,opt2;var iInterval;
function showWaitingMsg(tText)
{   
        var msg = document.getElementById("dvWait");var isIE = false;
        if (window.navigator.userAgent.indexOf("MSIE 6.0")>0) {document.getElementById('mainPageBody').className='ForIE6';msg.style.position="absolute";msg.style.top = 0 + "px";isIE=true;}
        else {msg.style.position="fixed";msg.style.top = "0px";}
        msg.style.left = "0px";
        msg.style.height= screen.availHeight + "px"; 
        msg.style.width= (parseInt(screen.availWidth) - 21) + "px"; 
        msg.style.zIndex = 9999;
        msg.style.overflow = "visible";
        msg.style.display = 'block';
        msg.style.visibility='visible';
        if ((navigator.appName.indexOf("Netscape")!=-1) && (parseInt(navigator.appVersion)>=5)){
                msg.style.MozOpacity=0;msg.style.KhtmlOpacity = 0;}
            else if ((navigator.appName.indexOf("Microsoft")!=-1) && (parseInt(navigator.appVersion)>=4)){
                msg.style.filter="alpha(opacity:0)";}
            else {msg.style.opacity = 0;}
        
        msg.innerHTML = "<table cellpadding='0' cellspacing='0' width='100%' height='100%' style='border:solid 1px #9A9EC8; background-color:black;padding:5px 5px 5px 5px;'>" +
                    "<tr><td width='100%' height='100%' align='left'></td></tr></table>";
                    
        var mDiv = document.getElementById("dvWaitBody");
        var wHeight =  windowY()/ 2; //parseInt(screen.availHeight) / 2; 
        var wWidth = windowX() / 2;
        if (window.navigator.userAgent.indexOf("MSIE 6.0")>0) {
            mDiv.style.position="absolute";
            mDiv.style.top = ((wHeight+getScrollY()) - 50) + "px";
        }
        else {
            mDiv.style.position="fixed";
            mDiv.style.top = (wHeight - 50) + "px";
        }
        mDiv.style.left = (wWidth - 250) + "px";
        mDiv.style.height= "100px" ; 
        mDiv.style.width= "500px"; 
        
        mDiv.style.zIndex = 99999;
        mDiv.style.overflow = "visible";
        mDiv.style.display = 'block';
        mDiv.style.visibility='visible';
        mDiv.className = "divWait";
        if (!IsBrowserFirefox()){
            mDiv.innerHTML = "<table cellpadding='0' cellspacing='0' width='100%' height='99%' valign='top' style='border:solid 1px #797979; background-color:White;padding:5px 5px 5px 5px;'>" +
                        "<tr><td width='20%' align='center' valign='middle'><img src='./images/rotatingclock-fast.gif' /></td>"+
                        "<td width='80%' align='center' valign='middle'><p  style='font-size:11pt; text-align:justify;'>"  + tText + " <br/>Please wait...</p></td></tr></table>";
        }
        if ((navigator.appName.indexOf("Netscape")!=-1) && (parseInt(navigator.appVersion)>=5)){
            mDiv.style.MozOpacity=0;mDiv.style.KhtmlOpacity = 0;}
        else if ((navigator.appName.indexOf("Microsoft")!=-1) && (parseInt(navigator.appVersion)>=4)){
            mDiv.style.filter="alpha(opacity:0)";}
        else {mDiv.style.opacity = 0;}
        if (isIE){
            var iFrm = document.getElementById("frmWait"); 
            iFrm.style.left = "0px";
            iFrm.style.top = "0px";
            iFrm.style.position = "absolute";
            iFrm.style.height= screen.availHeight + "px"; 
            iFrm.style.width= (parseInt(screen.availWidth) - 21) + "px"; 
            iFrm.style.zIndex = 9998;
            iFrm.style.overflow = "visible";
            iFrm.style.display = 'block';
            iFrm.style.visibility='visible';
            iFrm.style.filter="alpha(opacity:60)";
        }
        opt1 = 0; opt2 = 0;
        iInterval = setInterval('incAlpha()', 10);
}
function incAlpha()
{
    opt1 += 30; opt2 += 18;
    if (opt1 > 100 || opt2 > 60) {
        clearInterval(iInterval); 
        opt1 = 100; opt2 = 60;
        incAlphaFn();
    }
    else{
        incAlphaFn();
    }
}
function incAlphaFn()
{
    var mDiv = this.parent.document.getElementById("dvWaitBody");
    var msg = this.parent.document.getElementById("dvWait");
    if ((navigator.appName.indexOf("Netscape")!=-1) && (parseInt(navigator.appVersion)>=5)){
        msg.style.MozOpacity=opt2/100;msg.style.KhtmlOpacity = opt2/100;}
    else if ((navigator.appName.indexOf("Microsoft")!=-1) && (parseInt(navigator.appVersion)>=4)){
        msg.style.filter="alpha(opacity:" + opt2 + ")";}
    else {msg.style.opacity = opt2/100;}
    if ((navigator.appName.indexOf("Netscape")!=-1) && (parseInt(navigator.appVersion)>=5)){
        mDiv.style.MozOpacity=opt1/100;mDiv.style.KhtmlOpacity = opt1/100;}
    else if ((navigator.appName.indexOf("Microsoft")!=-1) && (parseInt(navigator.appVersion)>=4)){
        mDiv.style.filter="alpha(opacity:" + opt1 + ")";}
    else {mDiv.style.opacity = opt1/100;}
}
var op1; var op2; var mInterval;
function hideMap()
{
    op1 = 100;
    op2 = 70;
    mInterval = setInterval('decAlpha()', 10);
}
function decAlpha()
{
    op1 -= 30; op2 -= 21;
    if (op1 <= 0 || op2 <= 0) {
        op1 = 0; op2 = 0;
        decAlphaFn();clearInterval(mInterval);
        closeMap();
        
    }
    else{
        decAlphaFn();
    }
}
function decAlphaFn()
{
    var mDiv = this.parent.document.getElementById("dvWaitBody");
    var msg = this.parent.document.getElementById("dvWait");
    if ((navigator.appName.indexOf("Netscape")!=-1) && (parseInt(navigator.appVersion)>=5)){
        msg.style.MozOpacity=op2/100;msg.style.KhtmlOpacity = op2/100;}
    else if ((navigator.appName.indexOf("Microsoft")!=-1) && (parseInt(navigator.appVersion)>=4)){
        msg.style.filter="alpha(opacity:" + op2 + ")";}
    else {msg.style.opacity = op2/100;}
    if ((navigator.appName.indexOf("Netscape")!=-1) && (parseInt(navigator.appVersion)>=5)){
        mDiv.style.MozOpacity=op1/100;mDiv.style.KhtmlOpacity = op1/100;}
    else if ((navigator.appName.indexOf("Microsoft")!=-1) && (parseInt(navigator.appVersion)>=4)){
        mDiv.style.filter="alpha(opacity:" + op1 + ")";}
    else {mDiv.style.opacity = op1/100;}
}
function windowX()
{
	var w = 0;

	//IE
	if(!window.innerWidth)
	{
		//strict mode
		if(!(document.documentElement.clientWidth == 0))
		{
			w = document.documentElement.clientWidth;
		}
		//quirks mode
		else
		{
			w = document.body.clientWidth;
		}
	}
	//w3c
	else
	{
		w = window.innerWidth;
	}
	return parseInt(w);
}
function windowY()
{
	var h = 0;

	//IE
	if(!window.innerHeight)
	{
		//strict mode
		if(!(document.documentElement.clientWidth == 0))
		{
			h = document.documentElement.clientHeight;
		}
		//quirks mode
		else
		{
			h = document.body.clientHeight;
		}
	}
	//w3c
	else
	{
		h = window.innerHeight;
	}
	return parseInt(h);
}

//*****************************************************
//          Edit Customer details
//
//*****************************************************
function EnableDisableClientDiv(status)
{
    if (status) {
        document.getElementById("dvClientDetailsEdit").style.display = "block";
        document.getElementById("dvClientDetailsEdit").style.visibility = "visible";
        document.getElementById("dvClientDetails").style.display = "none";
        document.getElementById("dvClientDetails").style.visibility = "hidden";
    }
    else {
        document.getElementById("dvClientDetailsEdit").style.display = "none";
        document.getElementById("dvClientDetailsEdit").style.visibility = "hidden";
        document.getElementById("dvClientDetails").style.display = "block";
        document.getElementById("dvClientDetails").style.visibility = "visible";
    }
}

//*****************************************************************************************
//
//                         Junk
//******************************************************************************************
//function setPageToShow(controlID)
//{
//    //<%-- OnChange="showProperties(this);"--%>
//    //var daysUsed = document.getElementById(controlID)[document.getElementById(controlID).selectedIndex].value;
//    alert (controlID);
//}
//function findPosX(obj)
//  {
//    var curleft = 0;
//    if(obj.offsetParent)
//        while(1) 
//        {
//          curleft += obj.offsetLeft;
//          if(!obj.offsetParent)
//            break;
//          obj = obj.offsetParent;
//        }
//    else if(obj.x)
//        curleft += obj.x;
//    return curleft;
//  }

//  function findPosY(obj)
//  {
//    var curtop = 0;
//    if(obj.offsetParent)
//        while(1)
//        {
//          curtop += obj.offsetTop;
//          if(!obj.offsetParent)
//            break;
//          obj = obj.offsetParent;
//        }
//    else if(obj.y)
//        curtop += obj.y;
//    return curtop;
//  }

//  function getScrollX()
//  {
//    var pX ;
//    var tX;
//    if (!IsBrowserSafari() && !IsBrowserFirefox()){
//        tX = getQueryString(window.top.name);alert()
//    }
//    else {tX = new Array(8);}
//    
//    var tempX = GetValueFromArray(tX,'x');
//    if (tempY>=0){pX = tempX;}
//    else {
//        if (this.parent.document.all){
//            if (this.parent.document.body.scrollLeft){pX = this.parent.document.body.scrollLeft;}
//            else {pX = this.parent.document.documentElement.scrollLeft;}
//        }
//        else{
//            pX = this.parent.window.pageXOffset;
//        }
//    }
//    
//    return pX;
//  }
//  function getScrollY()
//  {
//    var pY ;//alert(this.parent.window.location);
//    var tY ;
//    if (!IsBrowserSafari() && !IsBrowserFirefox()){
//        tY = getQueryString(window.top.name);
//    }
//    else {tY = new Array(8);}
//    var tempY = GetValueFromArray(tY,'y');
//    if (tempY>=0){pY = tempY;}
//    else {
//        if (this.parent.document.all){
//            if (this.parent.document.body.scrollTop){pY = this.parent.document.body.scrollTop;}
//            else {pY = this.parent.document.documentElement.scrollTop;}
//        }
//        else{
//            pY = this.parent.window.pageYOffset;
//        }
//    }
//    return pY;
//  }



//var xmlDoc;
//var xmlObj;
//var xmlDataName; 
//var controlID;
//function populatePropertyAge(control, conID)
//{   
//    var cboPropertyAge = document.getElementById(conID);
//    var buildingCategory = parseInt(control.value);
//    controlID = conID;
//    if (buildingCategory == 1 || buildingCategory == 2 || buildingCategory == 3){xmlDataName = "CboYear";} //1 = House, 2 = Unit, 3 = Highrise
//    else {xmlDataName = "CboYear1";}
//    var filePath = "XMLFile.xml";
//    while (cboPropertyAge.hasChildNodes()) {cboPropertyAge.removeChild(cboPropertyAge.childNodes[0]);}
//    loadXML(filePath);

//    
     
//    if (IsBrowserIE()){
//        for (var i=0; i<xmlObj.childNodes.length; i++){
//            var xmlData = xmlObj.childNodes(i)
//            if (xmlData.tagName == xmlDataName){ 
//                addOption = new Option(xmlData.getAttribute("ItemName"),xmlData.getAttribute("ItemName"));
//                cboPropertyAge.options[index]=addOption ;
//                index = index + 1;
//            }
//        }
//    }
//    else
//    {
//        for (var i=0; i<xmlObj.length; i++){
//            var xmlData = xmlObj(i)
//            if (xmlData.tagName == xmlDataName){ 
//                addOption = new Option(xmlData.getAttribute("ItemName"),xmlData.getAttribute("ItemName"));
//                cboPropertyAge.options[index]=addOption ;
//                index = index + 1;
//            }
//        }
//    }
    
//}
function ProcessXML() 
{ 
    var rootNode = xmlDoc.getElementsByTagName("WashingtonBrown");//alert(companies); "company"
    var yearData = rootNode[0].getElementsByTagName(xmlDataName); //("employee"); 
//    document.writeln(yearData[0].getAttribute("ItemName")); 
//    document.writeln("<br>"); 
//    document.writeln("yy-" + yearData[1].getAttribute("ItemName")); 
    var index = 0;
    var cboPropertyAge = document.getElementById(controlID);
    for (var i=0; i<yearData.length; i++){
        var xmlData = yearData[i]
        addOption = new Option(xmlData.getAttribute("ItemName"),xmlData.getAttribute("ItemName"));
        cboPropertyAge.options[index]=addOption ;
        index = index + 1;
    }
   
}

function loadXML(xmlFile) 
{ 

    var moz = (typeof document.implementation != 'undefined') && (typeof
    document.implementation.createDocument != 'undefined');
    var ie = (typeof window.ActiveXObject != 'undefined');

    if (moz) {
    xmlDoc = document.implementation.createDocument("", "doc", null);
    xmlDoc.onload = ProcessXML;
    } else if (ie) {
    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async = false;
    while(xmlDoc.readyState != 4) {};
    }
    xmlDoc.load(xmlFile);
    if ((ie) || (IsBrowserSafari()) ) {this.ProcessXML();}
}
function verify() 
{ 
 // 0 Object is not initialized 
 // 1 Loading object is loading data 
 // 2 Loaded object has loaded data 
 // 3 Data from object can be worked with 
 // 4 Object completely initialized 
 if (xmlDoc.readyState != 4) 
 { 
   return false; 
 } 
}

function testT()
{
//    var tt = document.getElementById("spPlace");
//    if (tt != null)
//    {
//        tt.innerHTML = "Test"
//    }
    if (window.frames['frmMainBody']) {alert("po");}
        var te = window.frames['frmMainBody'].document.getElementById("hfPropertyNo").value
    alert(te);
}

function myFn()
{
}