
window.name = "WinMain"; //used instead of .opener property for popups to open URLs in the main window

function popup(theURL,theWindowName,theWidth,theHeight) {
	window.open(theURL, theWindowName,"width="+theWidth+",height="+theHeight+",scrollbars=no");
	//put 'window.self.focus' in html header of popup page
	//instead of win.focus(); here to avoid an error in Internet Explorer
}

function OpenPopupWindow(winurl, winname, winfeatures) {
	newwin = window.open(winurl,winname,winfeatures);
}


function PopupPrintWindow(url){
var pwin=window.open(url,"printwin","height=700,width=790,resizable=yes,scrollbars=yes,menubar=yes,status=yes");
 if (navigator.appName.substring(0,8)=="Netscape")
   pwin.location=url
 pwin.focus();
}


function redirectTo(page) {
    window.location.href = page;
}

////<summary>
////<created>07/02/07 PJB
////hides form objects, including table rows and can modify checked and disabled states
////usage: pass in multiple comma seperated parameters in groups of 4
////<param>'item to change'</param>
////<param>'"show" or "hide", this will show or hide the item'</param>
////<param>true or false to set disabled</param>
////<param>'' or 'checked' to set checked to true</param>
////and repeat as necessary
////</summary>
function modifyForm() {
    var i, v, d, o, args = modifyForm.arguments;
    for (i = 0; i < (args.length); i += 4)
        if ((o = document.getElementById(args[i])) != null) {
        v = args[i + 1];
        obj = o;
        if (obj.style) {
            obj = obj.style;
            v = (v == 'show') ? 'visible' : (v = 'hide') ? 'hidden' : v;
            d = (v == 'visible') ? '' : (v = 'hidden') ? 'none' : d;
        }
        obj.display = d; obj.visibility = v; obj.disabled = args[i + 2]; o.checked = args[i + 3];
    }
}



function CheckAdsExist(selector) {

    var addisplay = false;
    var object = $(selector);
    object.find(".bannerads").each(function() {

        var obj = $(this);

        if (obj.find("object").length > 0 || obj.find("embed").length > 0 ||
            obj.find("iframe").length > 0) {
            obj.addClass("show_advert");
            addisplay = true;
        }
        else {
            var imageList = obj.find("img");

            if (imageList.length > 0) {
                var img = imageList.get(0);
                if (img != null) {

                    if (img.src == "http://iad.anm.co.uk/house/1x1.gif" ||
                             img.src == "http://iad.anm.co.uk/anmdefaultad.gif" || img.height < 3) {

                        this.style.display = "none";

                    }
                    else {
                        obj.addClass("show_advert");
                        addisplay = true;

                    }

                }
            }

        }
    });

    if (addisplay != false) {
       if (object.hasClass("hideAds")) { object.removeClass("hideAds"); }
        else {
            object.find(".hideAds").removeClass("hideAds");
        }
        object.addClass("showAdContainer");
   }

   return addisplay;

}

function BannerAdsExist(noOfAds, objId) {
    CheckAdsExist('#groupads');
}


function ClickToReveal(obj,AgentId) {
   // $.ajax({ type: "POST", url: "svc/UserNotesService.asmx/SaveUserNote", data: "{'AgentId': '" + UserAccountId + "'}", contentType: "application/json; charset=utf-8", dataType: "json" });
    obj.className = "show clickToReveal";

}

function GetPageScroll() {
    var xScroll, yScroll;
    if (self.pageYOffset) {
        yScroll = self.pageYOffset;
        xScroll = self.pageXOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
        yScroll = document.documentElement.scrollTop;
        xScroll = document.documentElement.scrollLeft;
    } else if (document.body) {// all other Explorers
        yScroll = document.body.scrollTop;
        xScroll = document.body.scrollLeft;
    }
    
    return new Array(xScroll, yScroll)
}

var OverrideCheckAds;
OverrideCheckAds = CheckAdsExist;
