﻿// JScript File
function btncloseOver(control, status)
{
    if (status) {control.src = "Images/x_over.gif";}
    else {control.src = "Images/x.gif";}
}
function btnQuotation_click(status, referredByID, winFeatures)
{
    
    if (window.outHeight) {
      // Netscape code
        window.outerHeight = screen.availHeight;
        window.outerWidth = screen.availWidth ; 
        window.moveTo(0,0);
    }
    else {
      // Internet Explorer
       self.resizeTo(screen.availWidth ,screen.availHeight );
       self.moveTo(0,0);
    }
    if (referredByID == '0'){
        //window.open('http://localhost:1263/WbdInquiry/WBDQuote.aspx' ,'_self', "'" + winFeatures + "'");
        window.open('http://depreciationschedule.washingtonbrown.com.au/depreciation-schedule-quote/DepreciationScheduleQuote.aspx', '_self', "'" + winFeatures + "'");
    }
    else{
        window.open('http://depreciationschedule.washingtonbrown.com.au/depreciation-schedule-quote/DepreciationScheduleQuote.aspx?RID=' + referredByID ,'_self', "'" + winFeatures + "'");
    }
}
function showEmailMessageBox(emailType)
{
    var isEmpty;
    var published = false;
    var msg = document.getElementById("message");
    if (emailType == "Email Result"){
        if  (parseInt(document.getElementById("txtRecordCount2").value) > 0)
        {
            isEmpty = false;
        }
        else {isEmpty = true;}
        if (!isEmpty)
        {
            msg.style.position="relative";
            msg.style.top = "280px";
            msg.style.left = "15px";
            msg.style.display = 'block';
            msg.style.overflow = "auto";
            msg.style.zIndex = 5;
            msg.style.visibility='visible';
            msg.style.height="100px";
            msg.style.width="400px";
            
            msg.innerHTML = "<table width='400px' height='100px' background='Images/msg_Email_01.gif' cellpadding='0' cellspacing='0'>" +
                "<tr>" +
                    "<td width='100%' style='color:White; vertical-align:top;font-family:Tahoma;font-size:9pt;padding-top:1px;padding-left:5px' align='left' colspan='3'>" +
                        "<table width='100%'><tr><td><img alt='Error' src='Images/wbdSmallLogo.gif'/>&nbsp;&nbsp;<b>Washington Brown</b></td><td align='right'><img alt='Close' src='Images/x.gif' onmouseover='javascript: btncloseOver(this, true)' onmouseout='javascript: btncloseOver(this, false)' onclick='javascript: hideMessageBox()'/></td></table>" +
                    "</td>" +
                "</tr>" +
                "<tr>" + "<td width='5px'></td>" +
                    "<td style='color:black; vertical-align:top;font-family:Tahoma;' align='left' colspan='2'>" +
                        "Please Enter Email Address:" +
                    "</td>" +
                "</tr>" +
                "<tr><td width='5px'></td><td style='color:black; vertical-align:top;font-family:Tahoma;' align='left' width='60%'><input type='text' ID='txtEmail' style='width:90%;'/></td>" +
                "<td style='color:black; vertical-align:top;font-family:Tahoma;' align='left'><input type='button' ID='btnEmail' value='Submit' onclick='javascript:submitEmail(\"Email\")'/></td></tr>" +
            "</table>"
            published = true;
            //msg.focus(); 
        }
        else {
            //showErrorMessageBox("There are no results to email.");
            alert("There are no results to email.");
            published = false;
        }
    }
    else if (emailType == "Refer A Friend"){
        msg.style.position="relative";
        msg.style.top = "30px";
        msg.style.left = "15px";
        msg.style.display = 'block';
        msg.style.overflow = "auto";
        msg.style.zIndex = 5;
        msg.style.visibility='visible';
        msg.style.height="350px";
        msg.style.width="380px";
        msg.innerHTML = "<table width='380px' height='350px'  background='Images/msg_Email_Refer_small_01.gif' cellpadding='0' cellspacing='0'>" +
            "<tr>" +
                "<td width='100%' style='color:White; vertical-align:top;font-family:Tahoma;font-size:9pt;padding-top:1px;padding-left:5px' align='left' colspan='4'>" +
                        "<table width='100%'><tr><td><img alt='Error' src='Images/wbdSmallLogo.gif'/>&nbsp;&nbsp;<b>Washington Brown</b></td><td align='right'><img alt='Close' src='Images/x.gif' onmouseover='javascript: btncloseOver(this, true)' onmouseout='javascript: btncloseOver(this, false)' onclick='javascript: hideMessageBox()'/></td></table>" +
                "</td>" +
            "</tr>"+
            "<tr><td colspan='3' height='20px'></td></tr>"+
            "<tr><td style='color:Black; vertical-align:top;font-family:Tahoma;padding-top:3; height:18px;' align='left' colspan='4'>&nbsp;&nbsp;Fields marked with <font color=red>*</font> are compulsory</td></tr>"+
            "<tr><td colspan='3' height='15px'></td></tr>"+
            "<tr><td width='3%'></td>"+
                "<td style='color:black; vertical-align:top;font-family:Tahoma;width:45.5%;' height='35px' align='left'>"+
                    "Your Name<font color=red>*</font><br><input type='text' ID='txtName' runat='server' style='width:90%;'/>"+
                "</td><td width='1.5%'></td>"+
                "<td style='color:black; vertical-align:top;font-family:Tahoma;width:50%;' align='left'>"+
                    "Your Email<font color=red>*</font><br><input type='text' ID='txtEmail' style='width:90%;'/>"+
                "</td>"+
            "</tr>"+
            "<tr><td colspan='3' height='20px'></td></tr>"+
            "<tr><td></td>"+
                "<td style='color:black; vertical-align:top;font-family:Tahoma;width:45.5%;' height='35px' align='left'>"+
                    "1st Friends Name<font color=red>*</font><br><input type='text' ID='txtFriendName1' style='width:90%;'/>"+
                "</td><td width='1.5%'></td>"+
                "<td style='color:black; vertical-align:top;font-family:Tahoma;width:50%;' align='left'>"+
                    "1st Friends Email<font color=red>*</font><br><input type='text' ID='txtFriendEmail1' style='width:90%;'/>"+
                "</td>"+
            "</tr>"+
            "<tr><td ></td>"+
                "<td style='color:black; vertical-align:top;font-family:Tahoma;width:45.5%;' height='35px' align='left'>"+
                    "2nd Friends Name<br><input type='text' ID='txtFriendName2' style='width:90%;'/>"+
                "</td><td width='1.5%'></td>"+
                "<td style='color:black; vertical-align:top;font-family:Tahoma;width:50%;' align='left'>"+
                    "2nd Friends Email<br><input type='text' ID='txtFriendEmail2' style='width:90%;'/>"+
                "</td>"+
            "</tr>"+
            "<tr><td></td>"+
                "<td style='color:black; vertical-align:top;font-family:Tahoma;width:45.5%;' height='35px' align='left'>"+
                    "3rd Friends Name<br><input type='text' ID='txtFriendName3' style='width:90%;'/>"+
                "</td><td width='1.5%'></td>"+
                "<td style='color:black; vertical-align:top;font-family:Tahoma;width:50%;' align='left'>"+
                    "3rd Friends Email<br><input type='text' ID='txtFriendEmail3' style='width:90%;'/>"+
                "</td>"+
            "</tr>"+
//            "<tr><td></td><td style='color:black; vertical-align:top;font-family:Tahoma;' align='left' width='100%' colspan='3'>"+
//            "Message<br><textarea id='txtMessage' style='width:95%;' ID='txtMessage' rows='3'></textarea></td><td width='1.5%'></td></tr>"+
           "<tr><td style='height:30px'></td></tr>"+
            "<tr><td colspan='4' align='center' height='30px' style='vertical-align:Top;'><input type='image' ID='btnEmail' src='./images/refer_Email_btn.gif' class='btnEmail' onclick='return submitEmail(\"Refer To A Friend\");'/></td></tr>"+
            "<tr><td colspan='4' height='10px'></td></tr>" + 
        "</table>"
       // msg.focus(); 
        published = true;
        //<input type=image src='Images/refer_Email_btn.gif' ID='btnEmail' onclick='javascript: submitEmail(\"Refer To A Friend\")'/>
    }
    
    if (published)
    {
        var iframe = document.getElementById('iframetop');
        iframe.style.position="absolute";
        iframe.style.display = 'block';
        iframe.style.width = msg.offsetWidth-1;
        iframe.style.height = msg.offsetHeight-1;
        var cTop = msg.offsetTop + 1;
        var cLeft = msg.offsetLeft + 1;
        iframe.style.left = cLeft + "px";
        iframe.style.top = cTop + "px";
        iframe.style.zIndex = 4;
    }
}

function showHelp(control,helpType)
{
    var msg = document.getElementById("message");
    var Question;
    var Answer;
    var Left = findPosX(control);
    var Top = findPosY(control);
    var W;
    var H;
    var tH;
    var tabOpen;
    var tabClose;
    switch (helpType)
    {
        case "whatTypesExcluded":
        {
            
            Question = "How have you defined each property category?";
            Answer = "Properties have been defined according to the following broad definitions:<br><br>" +
                    "&nbsp;&nbsp;<b>House:</b> Any freestanding residential property<br><br>" +
                    "&nbsp;&nbsp;<b>Unit:</b> A residential strata titled unit in a building with no lift<br><br>" +
                    "&nbsp;&nbsp;<b>Highrise:</b> A residential strata titled unit in a building with a lift<br><br>" +
                    "&nbsp;&nbsp;<b>Commercial Suite:</b> A strata titled office within a commercial complex of many suites<br><br>" +
                    "&nbsp;&nbsp;<b>Industrial Suite:</b> A strata titled industrial unit within a complex of many industrial units<br><br>" +
                    "&nbsp;&nbsp;<b>Industrial building:</b> A wholly owned freestanding industrial building on one title<br><br>" +
                    "&nbsp;&nbsp;<b>Commercial building:</b> A wholly owned freestanding commercial building on one title<br><br>" +
                    "&nbsp;&nbsp;<b>Townhouse:</b> A strata titled residential building up to two levels above ground, the property may be adjoining other units within the complex.<br><br>" 
            
            tabOpen = "<table cellpadding='0' cellspacing='0' width='100%'><tr><td width='100%'>"
            tabClose = "</td><td style='padding-top:145px;' valign='top'><img src='./Images/point_vertical.gif' align='center' border='0'/></td></tr></table>"
                    
            Top =  - 323;
            Left = 35;
            W= 802;
            H= 290;
            tH = H - 35;
            break;
        }
        case "ageOfProperty":
        {
            Question = "How do I know the age of the property?";
            Answer = "In this field we need to know the year of construction commencement for your property. <br><br>" + 
                    "If you don't know this answer the relevant local council may be of assistance to you.";
            
            tabOpen = "<table cellpadding='0' cellspacing='0' width='100%'><tr><td width='100%'>"
            tabClose = "</td><td style='padding-top:45px;' valign='top'><img src='./Images/point_vertical.gif' align='center' border='0'/></td></tr></table>"
            
            Top = -199;
            Left = 288;
            W= 550;
            H= 100;
            tH = H - 35;  
            break;
        }
        case "yearsColumn":
        {
            Question = "What does the “years” column represent?";
            Answer = "Each year represents a full financial year. This calculator provides an estimate of the likely allowances on the basis you are going to settle on that property today. <br><br>" +
                   "So, for instance, Year 1 represents the amount you can claim over the next 365 days if you purchased a similar property to data you have already entered in.";
            Left = 30;
            Top = -159;
            if (IsBrowserIE()) Top = -155;
            W = 600;
            H = 125;
            tH = H - 50;  
            tabOpen = "<table cellpadding='0' cellspacing='0' width='100%'><tr><td width='100%'>"
            tabClose = "</td></tr><tr><td style='padding-left:10px;' align='left' width='100%' valign='top'><img src='./Images/point_down.gif' align='top' border='0'/></td></tr></table>"
            break;
        }
        case "DiminishingValue":
        {
            Question = "What does the Diminishing Value and Prime cost method mean?";
            Answer = "Both terms refer to the way in which Plant and Equipment is depreciated in accordance with the ATO guidelines. <br><br>" +
                     "The Diminishing Value method accelerates the allowances in the earlier years, where as the Prime Cost method evenly spreads the allowances out.";
            Left = 149;
            Top = -159;
            if (IsBrowserIE()) Top = -155;
            W= 600;
            H= 125;
            tH = H - 50;  
            tabOpen = "<table cellpadding='0' cellspacing='0' width='100%'><tr><td width='100%'>"
            tabClose = "</td></tr><tr><td style='padding-left:69px;' align='left'><img src='./Images/point_down.gif' align='top' border='0'/></td></tr></table>"
            break;
        }
        case "primeCostMethod":
        {
            Question = "What does the Diminishing Value and Prime cost method mean?";
            Answer = "Both terms refer to the way in which Plant and Equipment is depreciated in accordance with the ATO guidelines. <br><br>" +
                     "The Diminishing Value method accelerates the allowances in the earlier years, where as the Prime Cost method evenly spreads the allowances out.";
            Left = 228;
            Top = -159;
            if (IsBrowserIE()) Top = -155;
            W= 601;
            H= 125;
            tH = H - 50;
            tabOpen = "<table cellpadding='0' cellspacing='0' width='100%'><tr><td width='100%'>"
            tabClose = "</td></tr><tr><td style='padding-left:90px;' align='left'><img src='./Images/point_down.gif' align='top' border='0'/></td></tr></table>"
            break;
        }
        case "barometerWork":
        {
            Question = "How does the Tax Depreciation Calculator “Barometer” work?";
            Answer = "The higher the rating, the greater the degree of accuracy! <br><br>" +
                    "For instance if your property receives a Bronze rating, it means the Calculator has only been able to find a limited amount of properties that match your criteria. <br><br>" +
                    "However, if you receive a Platinum rating, the Tax Depreciation Calculator has been able to find a wide range of similar properties. This increases the rate of accuracy. <br><br>" +
                    "We must stress there is no 100% guarantee.";
            Top = 19;
            Left = -22;
            W= 451;
            H= 200;
            tH = H - 50; 
            tabOpen = "<table cellpadding='0' cellspacing='0' width='100%'><tr><td width='100%' valign='bottom'>"
            tabClose = "</td></tr><tr><td style='padding-left:246px;height:6px' align='left'><img src='./Images/point_down.gif' height='5px' align='top' border='0'/></td></tr></table>"
            break;
        }
    }
    
    
    
    msg.style.position="relative";
    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.innerHTML = tabOpen +
                    "<table cellpadding='0' cellspacing='0' width='100%'><tr><td class='tableHeader' 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'>" +
                    "<table class='toolTipClass' cellpadding='0' cellspacing='0' width='100%'><tr><td width='5px'></td>" +
                    "<td class='tdText' height='" + tH + "px'>" + Answer + "</td></tr></table>" +
                    "</td></tr></table>" + tabClose;
                    
    var iframe = document.getElementById('iframetop');
    iframe.style.position="absolute";
    iframe.style.display = 'block';
    iframe.style.zIndex = 4;
    iframe.style.width = W + "px";//msg.offsetWidth-2;
    iframe.style.height = tH + "px"; //msg.offsetHeight-50;
    Left += 3; Top+=3;
    iframe.style.left = Left + "px";
    iframe.style.top = Top + "px";
       
}
function setZposition(id, z) {
//  if (NS4) {eval("document." + id).zIndex = z}
//  else {eval("document.all." + id).style.zIndex = z}
  eval("document.all." + id).style.zIndex = z
}
function submitEmail(emailType)
{ 
    //var chartImage = document.getElementById("UltraChart1_BaseImage");
    var errStr;
    if (emailType == "Email"){
        document.getElementById("hfEmailType").value = emailType;
        var email = document.getElementById("txtEmail").value;
        document.getElementById("txtEmail").value='';
        document.getElementById("hfClientEmail").value = email;
        hideMessageBox();
        if (email == ""){}
        else if (email != ""){
            var emailAddress = email.split(",")
            var isValid = true;
            
            for (var i=0; i<emailAddress.length; i++)
            {
                if (!isValidEmailAddress(emailAddress[i]))
                {
                    isValid = false;
                }
            }
            if (isValid){document.form1.submit();}
            else{
                //showErrorMessageBox("Invalid Email Address!!");
                alert("Invalid Email Address!!");
            }
        }
    }
    else if (emailType == "Refer To A Friend"){
              
        document.getElementById("hfEmailType").value = emailType;
        
        document.getElementById("hfClientName").value = document.getElementById("txtName").value;
        document.getElementById("hfClientEmail").value = document.getElementById("txtEmail").value;

        document.getElementById("hfFriendsName1").value = document.getElementById("txtFriendName1").value;
        document.getElementById("hfFriendsEmail1").value = document.getElementById("txtFriendEmail1").value;

        document.getElementById("hfFriendsName2").value = document.getElementById("txtFriendName2").value;
        document.getElementById("hfFriendsEmail2").value = document.getElementById("txtFriendEmail2").value;

        document.getElementById("hfFriendsName3").value = document.getElementById("txtFriendName3").value;
        document.getElementById("hfFriendsEmail3").value = document.getElementById("txtFriendEmail3").value;

        //document.getElementById("hfMessage").value = document.getElementById("txtMessage").value;

        //hideMessageBox();

        var strError = "";
        if (!isValidEmailAddress(document.getElementById("hfClientEmail").value))  {strError += "Your Email";}
        if (!isValidEmailAddress(document.getElementById("hfFriendsEmail1").value))  {
            if (strError.length > 0){strError += ", ";}
            strError += "1st Friend";}
            
        var FriendEmail2 = document.getElementById("hfFriendsEmail2").value;
        if (FriendEmail2.length > 0){
            if (!isValidEmailAddress(FriendEmail2))  {
                if (strError.length > 0){strError += ", ";}
                strError += "2nd Friend";
            }
        }
        var FriendEmail3 = document.getElementById("hfFriendsEmail3").value;
        if (FriendEmail3.length > 0){
            if (!isValidEmailAddress(FriendEmail3))  {
                if (strError.length > 0){strError += ", ";}
                strError += "3rd Friend";
            }
        }
        
        if (strError.length == 0){
                return true;
        }    
        else{
            //showErrorMessageBox("Invalid Email Address : " + strError);
            hideMessageBox();
            alert("Invalid Email Address : " + strError);
            return false;
        }
    }
    
}
function TestMe()
{
    alert ("some test");
    return true;
}
function isValidEmailAddress(str)
{
        
        var sEmail, nAtLoc, ssEmail;
        sEmail = Trim(str);
        nAtLoc = sEmail.search("@"); //Location of "@"
        ssEmail = sEmail.substring(nAtLoc+1,sEmail.length); //substring after "@"
        if ((nAtLoc < 2) || ((sEmail.indexOf(".")< nAtLoc + 2) && (sEmail.indexOf(".")> nAtLoc))){
            //"@" must exist, and last "." in string must follow the "@"
            return false;
        }
        else if (ssEmail.indexOf("@") > 0){
            //String can't have more than one "@"
            return false;
        }
        else if (ssEmail.indexOf(".") <= 1){
            //String can't have "." immediately following "@" and String must have at least a two-character top-level domain.
            return false;
        }
        return true;
}

function showErrorMessageBox(errStr)
{
    var msg = document.getElementById("message");
    msg.style.position="absolute";
    msg.style.top = "0px";
    msg.style.left = "190px";
    msg.style.display = '';
    msg.style.visibility='visible';
    msg.style.height="250px";
    msg.style.width="400px";
    msg.innerHTML = "<table width='400px' height='100px' background='Images/msg_Email.gif'>" +
        "<tr>" +
            "<td width='100%' style='color:White; vertical-align:top;font-family:Tahoma;' align='left' colspan='3'>" +
                "<b>Washington Brown - Invalid Email Address</b>" +
            "</td>" +
        "</tr>" +
        "<tr>" + "<td width='5px'></td><td style='vertical-align:middle; width:50px;' align='left'><img src='Images/critical.gif' alt='Error'/></td>" +
            "<td style='color:black; vertical-align:middle;font-family:Tahoma; width:100%;' align='left'>" +
                errStr +
            "</td>" +
        "</tr>" +
        "<tr><td colspan='3' width='100%' align='center'><input type='button' name='btnEmail' value='Ok' style='width:70px;' onclick='javascript: hideMessageBox()'/></td></tr>" +
    "</table>"
    msg.focus();
}

function hideMessageBox()
{
    var msg = document.getElementById("message");
    msg.innerHTML = "";
    msg.style.display = 'none';
    msg.style.visibility='hidden';
    
    if(document.getElementById('iframetop')!=null)
	{
    // hide IFRAME
		var iframe = document.getElementById('iframetop');
		iframe.style.display = 'none';
	}
}

this.LTrim = LTrim;
function LTrim(str){
	if (str==null){return null;}
	for(var i=0;str.charAt(i)==" ";i++);
	return str.substring(i,str.length);
	}
	
this.RTrim = RTrim;
function RTrim(str){
	if (str==null){return null;}
	for(var i=str.length-1;str.charAt(i)==" ";i--);
	return str.substring(0,i+1);
	}

this.Trim = Trim;
function Trim(str){return LTrim(RTrim(str));}

function getNum(str)
{
    str = str.replace(",", "");
    str = str.replace("$", "");
    str = str.replace("#", "");
    return str;
}
function getBrowserWindowWidth() {
    var winW = 0;

    if (self.innerWidth) {
        winW = self.innerWidth;
    }
    else if (document.documentElement && document.documentElement.clientWidth){
        winW = document.documentElement.clientWidth;
    }
    else if (document.body){
        winW = document.body.clientWidth;
    }
    return winW;
}
var tt = 'tt';
function showImage()
{   
   var Left = (getBrowserWindowWidth()/2) - 75;
   if (IsBrowserIE()){
        var busyBox = document.getElementById("BusyBox1");
        busyBox.style.position="absolute";
        busyBox.style.visibility='visible';
        var objLeft = document.clientWidth / 2; //(document.body.clientWidth - busyBox.offsetWidth) / 2;
	    //var objTop = (document.body.clientHeight - this.IFrame.offsetHeight) / 2;
	    busyBox.style.top = 480;
	    busyBox.style.left = Left; //540; 
	    busyBox.style.width = 150;
	    busyBox.style.height = 37;
        var doc = this.GetIFrameDocument();
        doc.writeln("<body ondragstart='return false;' style='Margin: 0px; Background: 0'>");
	    doc.writeln("   <table style='vertical-align:top; height:30px;' cellpadding='0' cellspacing='0'>");
        doc.writeln(" <tr>");
        doc.writeln(" <td style='vertical-align:middle; width:150px; vertical-align:top;' align='left' colspan='3'>");
        doc.writeln("  <img src='Images/dot_ani.gif' alt='Processing' style='border:0;' id='waitImg'/>");
        doc.writeln("     </td>");
        doc.writeln("  </tr>");
        doc.writeln(" <tr>");
        doc.writeln("   <td style='color:#ad5110;font-family:Tahoma; font-size:11px; vertical-align:middle; align='left'>&nbsp;&nbsp;<b>Calculating...</b></td>");
        doc.writeln("  </tr>");
        doc.writeln("  </table>");
	    doc.writeln("</body>");
	    doc.close();
	    
    }
    else{ 
        var msg = document.getElementById("waitMsg");
        msg.style.position = "absolute";
        msg.style.top = 480 + "px";
        msg.style.left = Left + "px"; //540 + "px";
        msg.style.display = '';
        msg.style.visibility='visible';
//        msg.style.height="250px";
//        msg.style.width="400px";
   }
        
//   CacheImages();
//    showMyImage();
}
function IsBrowserIE()
{
	try
	{ return (window.navigator.userAgent.indexOf("MSIE ") > 0); }
	catch(x)
	{ return false; }
}
var tt = 0;
var timeout_id;
function showMyImage()
{
    //document.getElementById("waitMsg").style.visibility='visible';
    tt = (tt + 1)%4; 
    var control = document.getElementById("waitImg");
    control.src =  this.Images[tt].src;
    timeout_id=setTimeout (showMyImage(), 1250);
}
function StopAnimate()
{
	clearTimeout(timeout_id);
	timeout_id = null;
}
function hideImage(){
    var busyBox = document.getElementById("BusyBox1");
    busyBox.style.visibility='hidden';
    busyBox.src = "";
}

function CacheImages()
{
	// Instantiate the array to store the image references
	this.Images = new Array(this.ImageCount);
	
	// Load all the images to cache into the aniframes array
	for(var i = 0; i < 4; i++)
	{
		this.Images[i] = new Image();
		this.Images[i].src = "Images/gears_ani_" + i + ".gif";
	}
}

function GetIFrameDocument()
{
	var doc;
	var control = document.getElementById("BusyBox1");
	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 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 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;
   }    
}

