/*-Common Application Library-----*/

Browser = new BrowserObj();

function BrowserObj () {
/*
  	this.ie5 = (this.agent.indexOf("msie 5")>-1 && !this.op5 && !this.op6)
	this.ie4 = (this.agent.indexOf("msie")>-1 && document.all &&!this.op5 &&!this.op6 &&!this.ie5&&!this.ie6)

  	this.ie = (this.ie4 || this.ie5 || this.ie6)

	this.mac = (this.agent.indexOf("mac")>-1)
	this.ns6 = (this.agent.indexOf("gecko")>-1 || window.sidebar)
	this.ns4 = (!this.dom && document.layers)?1:0;
	this.bw = (this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.op5 || this.op6)
  	this.usedom = this.ns6
  	this.reuse = this.ie||this.usedom
  	this.px = this.dom&&!this.op5?"px":""

*/
	this.ver = navigator.appVersion
	this.agent = navigator.userAgent.toLowerCase()
	this.DOM = (document.getElementById ? true : false); 
	this.IE = (document.all) ? true : false;
	this.IE4 = ((document.all && !this.DOM) ? true : false);
	this.IE5 =  ((document.all && this.DOM) ? true : false);
  	this.IE55 = (this.IE5 && this.agent.indexOf("msie 5.5")>-1)
	this.NS4 = (document.layers ? true : false);
	this.NS6 = (!document.all && document.getElementById) ? true : false;
	this.NS6 = (navigator.vendor == ("Netscape6") || navigator.product == ("Gecko"));
	this.Dyn = (this.DOM || this.IE4 || this.NS4);
	this.Mac = (navigator.appVersion.indexOf("Mac")!=-1);
	this.Opera = (navigator.userAgent.indexOf("Opera")!=-1);
	this.OP5 = this.agent.indexOf("opera 5")>-1 && window.opera 
  	this.OP6 = this.agent.indexOf("opera 6")>-1 && window.opera 
	this.Konqueror = (navigator.userAgent.indexOf("Konqueror")!=-1);
	this.IE4M = this.IE4 && this.Mac;
	this.IE5M = this.IE && this.Mac;
	this.IE5W = this.IE && !this.Mac;
	this.IEpos = this.IE || (this.NS6 && parseInt(navigator.productSub)>=20010710);
	this.IECSS = (this.IE && document.compatMode) ? document.compatMode ==  "CSS1Compat" : false;
	this.IEDTD = (this.IE && document.doctype) ? document.doctype.name.indexOf(".dtd")!=-1 : this.IECSS;
	this.IEnoDTD = this.IE && !this.IEDTD;

  	this.IE6 = (this.agent.indexOf("msie 6")>-1 && !this.OP5 && !this.OP6)
}


function setDivText(obj,text) {
        obj.innerHTML = text;
}
function findObj(n, d) {
        var p,i,x;
        if(!d) d = document;
        return d.getElementById(n);
}
function getStyle(o) {
        return o.style;
}
function findStyle(id) {
        var o = findObj(id);
        o = getStyle(o);
        return o;
}
function Global_ImageSwapper_setCaption(text){
        if (text == ""){
                Global_ImageSwapper_showCaption(false);
        }
        else{
                Global_ImageSwapper_showCaption(true);
        }
        return '<span class="ImageSwapperCaption">'+text+'</span>';
}
function Global_ImageSwapper_showCaption(state){
        var o = findStyle("Global_ImageSwapper_ImageCaption");
        if (state){
                o.visibility = "visible";
        }
        else{
                o.visibility = "hidden";
        }
}
function Global_ImageSwapper_GetImage(num) {
        if(arguments[1] != null && arguments[2] != null){
                return '<img name="LargeImage" src="' + Global_ImageSwapper_imageArray[num] + '" height="' + arguments[2] + '" width="' + arguments[1] + '" border="0" align="top">';
        }
        return '<img name="LargeImage" src="' + Global_ImageSwapper_imageArray[num] + '" height="134" width="261" border="0" align="top">';
}
function Global_ImageSwapper_MouseDown(num){
        Global_ImageSwapper_FlashOff();
        if (curImage != num){
                if (Global_ImageSwapper_LargeImage.filters.length > 0) Global_ImageSwapper_LargeImage.filters[0].Apply();
                curImage = num;
                var p = findObj('Global_ImageSwapper_LargeImage');
                setDivText(p,Global_ImageSwapper_GetImage(num, arguments[1], arguments[2]));
                var o = findObj('Global_ImageSwapper_ImageCaption');
                setDivText(o,Global_ImageSwapper_setCaption(Global_ImageSwapper_textArray[num]));
                if (Global_ImageSwapper_LargeImage.filters.length > 0) Global_ImageSwapper_LargeImage.filters[0].Play();
        }
}
/*----------------------------------------------------------------------------------*/
		var imageMacNum = 0;
		var blnWithText = true;
		function ChangeImageMac(){
			document.images['LargeImage'].src = Global_ImageSwapper_imageArray[imageMacNum]; 
			curImage = imageMacNum;
			blnWithText = true;
		}
		function GalleryClick(num){
			if (Browser.NS4 && Browser.Mac){
				imageMacNum = num;	
				setTimeout("ChangeImageMac()",350);
				return;
			}
			if (Browser.Opera){
				imageMacNum = num;	
				blnWithText = false;
				setTimeout("ChangeImageMac()",350);
				return;
			}
			if (Browser.NS4){
				if (curImage != num){
					var imgTemp = new Image();
					imgTemp.src = Global_ImageSwapper_imageArray[num];

					
					curImage = num;
					document.images['LargeImage'].src = imgTemp.src; 
				}
			}
			else if (Browser.IE){
				if (GalleryLayer.filters.length > 0) GalleryLayer.filters[0].Apply();
				var objLargeImg = findObj("Gallery_Large");
				var objCaption = findObj("Caption");
				setDivText(objLargeImg,Global_ImageSwapper_GetImage(num, arguments[1], arguments[2]));
				setDivText(objCaption,Global_ImageSwapper_textArray[num]);
				if (GalleryLayer.filters.length > 0) GalleryLayer.filters[0].Play();
			}
			else if (Browser.NS6 || Browser.DOM){
				if (curImage != num){
					document.images['LargeImage'].src = Global_ImageSwapper_imageArray[num]; 
					curImage = num;
					if (Browser.NS6){
						var objDiv = document.getElementById('GalleryText');
						objDiv.innerHTML = Global_ImageSwapper_textArray[num];
					}
				}
			}
		}
/*----------------------------------------------------------------------------------*/
function Global_ImageSwapper_FlashOn(){
        var o, url, ob;
        o = findObj("Global_ImageSwapper_Loading");
        setDivText(o,"Loading RealSync...");
        o = getStyle(o);
        o.backgroundColor = "#FFFFFF";
        o.color = "#000000";
        Global_ImageSwapper_showCaption(false);
        o = findStyle("Global_ImageSwapper_LargeImage");
        o.top = -9999;
        o = findObj("FlashLayer");
        if (!Global_ImageSwapper_FlashLoaded){
                url = o.innerHTML;
                if (url != ""){
                        o.innerHTML = o.innerHTML;
                        Global_ImageSwapper_FlashLoaded = true;
                }
                else{
                        ob = findObj("Global_ImageSwapper_Loading");
                        setDivText(ob,"");
                        ob = getStyle(ob);
                        ob.backgroundColor = "transparent";
                }
        }
        o = getStyle(o);
        o.top = 0;
				if(NCPHFlashPlayer___flash__1){
					NCPHFlashPlayer___flash__1.play();
				}
}
function Global_ImageSwapper_FlashOff(){
        var o;
        o = findStyle("Global_ImageSwapper_Loading");
        o.backgroundColor = "transparent";
        o.color = "#FFFFFF";
        o = findStyle("Global_ImageSwapper_LargeImage");
        o.top = 0;
        o.visibility = "visible";

        if (findObj("FlashLayer") != null ){
                o = findStyle("FlashLayer");
                o.top = -9999;
        }
        o = findObj("Global_ImageSwapper_Loading");
        setDivText(o,"Loading Image...");
}