

//eDIY AJAX script
var ajaxIsBusy = 0;
var orderState = "";
var userAgentButton = "";
var updateOrderStatus = 0;
//var updateOrderStatus = 0;
function ajaxOrderAlert() {
	alert("This item has been added to your cart.  When you have finished adding items, scroll to the top of the page and click Checkout >> to continue.");
}

function GoToSummary() {
	window.location='/content.asp?function=ordersummary';
}

function onLoad() {
	//loadOnlyFirst();

	onPageShow();
	
}

function UpdateProductPicture(src, value) {
	var v;
	v = value.split("_");
	//alert(value);

	try {
		if (parseInt(v[1]) > 0) {
			document.getElementById('PRDPIC'+v[2]).src= "/site/images/" + v[1] + ".jpg";
			//document.getElementById('PRDPIC'+v[2]).height="";
			//document.getElementById('PRDPIC'+v[2]).width="";
		}
	}
	catch(e) {}

	try {	
		if (parseInt(v[1]) > 0) {
			document.getElementById('PRDTHUMB'+v[2]).src= "/site/images/" + v[1] + "_thumb.jpg";
			//document.getElementById('PRDTHUMB'+v[2]).height="";
			//document.getElementById('PRDTHUMB'+v[2]).width="";
		}

	}
	catch(e) {}

}

function OnCreatedResale() {

}
function AddServicesPanel() {

}

var httpPV;

function OpenProductView(prdID, templateID) {
	httpPV = ajaxCreateRequestObject();
	try {
		document.getElementById("sb-product").outerHTML = "";
	} catch(e) {}
	
	httpPV.open('get', '/dynamic/content.asp?syscmd=ajaxcommand&cmd=Render&dispmode=frame&args=,viewprd,0&style=' + templateID + '&prd_id=' + prdID + '&rnd='+rnd(9999999));
   httpPV.onreadystatechange = ajaxPVResponse;
   httpPV.send(null);
}

function OpenPageView(pageID) {
	httpPV = ajaxCreateRequestObject();
	try {
		document.getElementById("sb-product").outerHTML = "";
	} catch(e) {}
	
	httpPV.open('get', '/dynamic/content.asp?syscmd=ajaxcommand&cmd=Render&dispmode=frame&args=,,'+pageID+'&rnd='+rnd(9999999));
   httpPV.onreadystatechange = ajaxPVResponse;
   httpPV.send(null);
}


function OpenProductFunction(funcName, prdID,  templateID) {
	httpPV = ajaxCreateRequestObject();
	try {
		document.getElementById("sb-product").outerHTML = "";
	} catch(e) {}
	
	
	var qty = document.getElementById("QTY" + prdID).value;
	var pmmID = 0;
	if (qty != "") {
		if (document.getElementById("PR" + prdID)) {
			var v = document.getElementById("PR" + prdID).value.split("_");
			pmmID = v[0];
		}
	}
	
	httpPV.open('get', '/dynamic/content.asp?dispmode=frame&function=' + funcName + '&style=' + templateID + '&prdid=' + prdID + '&pmmid='+ pmmID + '&qty='+qty+'&rnd='+rnd(9999999));
	httpPV.onreadystatechange = ajaxPVResponse;
	httpPV.send(null);
}
function OpenPicture(picUrl, lMaxWidth) {
	Shadowbox.open({
				  player:     'img',
				  content:    picUrl

			});
}

function ajaxPVResponse() {
	if(httpPV.readyState == 4){
		//var response = httpPV.responseText;
		try {
			Shadowbox.open({
				  player:     'html',
				  content:    '<div id="sb-product" style="text-align: left; background-color: #ffffff; height:340px;width:550px; padding: 10px; font: 10pt Verdana">' + httpPV.responseText + '</div><div style=" display:block; width:95%; text-align: right; padding: 10px; font: 11pt Arial"><a href="#" onClick="Shadowbox.close();">Close</a></div>',
				  height:     550,
				  width:      600
			});
		}
		catch (e) {
		}
	}
}

var httpEval;

function OpenScriptEval(sURL) {
	
	httpEval = ajaxCreateRequestObject();
	
	httpEval.open('get', sURL);
   httpEval.onreadystatechange = ajaxEvalResponse;
   httpEval.send(null);
}

function ajaxEvalResponse() {
	if(httpEval.readyState == 4){
		try {
			eval( httpEval.responseText );
		}
		catch (e) {
			alert ("Eval error: " + e.message);
		}
	}
}


function onPageShow() {
	var FORM_STATUSBOX = 168;
	try {
		if (updateOrderStatus)
		{
			if (updateOrderStatus == 1) {
				ajaxSendRequest("orderstatus","OrderStatus","0,2"); // no container div
			}
		}
	}
	catch (e){
		try {
			ajaxSendRequest("orderstatus","OrderStatus","0,2");
			
		}
		catch (e){
		}
		
	}
	
}

function edUpdateOrderStatus() {
	
}

var Webtrade = {
	ProfileEvent: function (custID,other,ptype,orientation, tplID) {
		//var url = "/content.asp?function=member&tplID=224&type="+ptype+"&id="+custID+"&TPLPreviewID="+tplID+"&TPLPreviewDir="+orientation;
		//window.location.href = url;
		
	}
}


function addEvent(element, type, handler)
{
	if (element.addEventListener)
		element.addEventListener(type, handler, false);
	else
	{
		if (!handler.$$guid) handler.$$guid = addEvent.guid++;
		if (!element.events) element.events = {};
		var handlers = element.events[type];
		if (!handlers)
		{
			handlers = element.events[type] = {};
			if (element['on' + type]) handlers[0] = element['on' + type];
			element['on' + type] = handleEvent;
		}
	
		handlers[handler.$$guid] = handler;
	}
}
addEvent.guid = 1;

function removeEvent(element, type, handler)
{
	if (element.removeEventListener)
		element.removeEventListener(type, handler, false);
	else if (element.events && element.events[type] && handler.$$guid)
		delete element.events[type][handler.$$guid];
}

function handleEvent(event)
{
	
	var returnValue = true;
	try {
		event = event || fixEvent(window.event);
		var handlers = this.events[event.type];
	
		for (var i in handlers)
		{
			if (!Object.prototype[i])
			{
				this.$$handler = handlers[i];
				if (this.$$handler(event) === false) returnValue = false;
			}
		}
	
		if (this.$$handler) this.$$handler = null;
	}
	catch (e) {
	}
	return returnValue;
}

function fixEvent(event)
{
	event.preventDefault = fixEvent.preventDefault;
	event.stopPropagation = fixEvent.stopPropagation;
	return event;
}
fixEvent.preventDefault = function()
{
	this.returnValue = false;
}
fixEvent.stopPropagation = function()
{
	this.cancelBubble = true;
}

if (!window.addEventListener)
{
	document.onreadystatechange = function()
	{
		if (window.onload && window.onload != handleEvent)
		{
			try {
				addEvent(window, 'load', window.onload);
				window.onload = handleEvent;
			}
			catch (e) {
			}
		}
	}
}

function flashCart() {
	//for (var i = 1; i <= 5; i++) {
	//	var c = document.getElementById("cart"+i);
	//	c.style.backgroundColor="#cccc66";
//	}
}

var inFade = 0;
var inDelay = 0;
var isOver = 0;
var fader = {
	flash: function(objID) {
		setTimeout("fader.fade('"+ objID + "','trans80YEL')",2200);
		setTimeout("fader.fade('"+ objID + "','trans80')",2400);
		setTimeout("fader.fade('"+ objID + "','trans80YEL')",2600);
		setTimeout("fader.fade('"+ objID + "','trans80'); ",2800);
	},
	
	fade: function(objName, cls) {
		document.getElementById(objName).className=cls;
	},
	
	fadeIn: function(objID) {
		isOver = 1;
		if ((inFade == 0) && (inDelay == 0)) {
			inFade = 1;
			setTimeout("fader.fade('"+ objID + "','trans85')",100);
			setTimeout("fader.fade('"+ objID + "','trans90')",150);
			setTimeout("fader.fade('"+ objID + "','trans95')",200);
			setTimeout("fader.fade('"+ objID + "','trans100'); inFade = 0;",300);
		}
	},
	
	fadeOut: function(objID) {
		if ((isOver == 1)  && (inDelay == 0)) {
			inDelay = 1;
			setTimeout("if(isOver == 0) {inDelay = 0;  fader.fadeOut('"+ objID + "'); } else {inDelay = 0; }",1000);
		} else {
			if ((inFade == 0) && (inDelay == 0)) {
				inFade = 1;
				setTimeout("fader.fade('"+ objID + "','trans95')",100);
				setTimeout("fader.fade('"+ objID + "','trans90')",150);
				setTimeout("fader.fade('"+ objID + "','trans85')",200);
				setTimeout("fader.fade('"+ objID + "','trans80'); inFade = 0;",300);
			}
		}
		isOver = 0;
	}
}


function ajaxProcessOrderSubmit(prdID, absqty) {
	//window.scrollTo(0,0);						
	try {
		document.getElementById('bottomstatusbar').style.display='block';
		fader.flash('bottomstatusbar');
	}
	catch (e) {
	}
	
	var ordStr = "";
		
	if (prdID > 0) {
		var inputs = document.getElementsByTagName("select")
		var qty = document.getElementById("QTY" + prdID).value;
		
		var dynPrice = 0;
		if (document.getElementById("prdprice")) 
			if (parseInt(document.getElementById("prdprice").value) > 0) {
				dynPrice = document.getElementById("prdprice").value;
			}
		
		var pmmID = 0;
		if (qty != "") {
			if (document.getElementById("PR" + prdID)) {
				var v = document.getElementById("PR" + prdID).value.split("_");

				pmmID = v[0];
				if (pmmID == 0) {
					return (false); // out of stock
				}
			}
			flashCart();
			
			for (var i = 0; i <= inputs.length; i++) {
				if (inputs[i]) {
					if (inputs[i].id.substring(0,3) == "OPT") {
						var ord = inputs[i].id.split("-");
						//OPT171310-1
						if (ord.length > 0) {
							ordStr += inputs[i].value+" ";
						}
					}
					if (inputs[i].name.substring(0,3) == "TXT") {
						if (inputs[i].value.length > 0) {
							ordStr += "Text: " + inputs[i].value+" ";
						}
					}
					
					
					
				}
			}	
			try {
				var txt = document.getElementsByName("TXT" + prdID);
				if (txt[0]) {
					ordStr += "Text: " + txt[0].value +" ";
				}
			
		
				Shadowbox.close();
			} catch (e) {}
			if (absqty)
				ajaxSendRequest("orderstatus","AddOrderLineItem",prdID+","+pmmID+",-"+qty+","+ordStr+",0,"+dynPrice+",");
			else
				ajaxSendRequest("orderstatus","AddOrderLineItem",prdID+","+pmmID+","+qty+","+ordStr+",0,"+dynPrice+",");
		}
	} else {
		var inputs = document.getElementsByTagName("input")

		for (var i = 0; i <= inputs.length; i++) {
			if (inputs[i]) {
				if (inputs[i].id.substring(0,4) == "ORD_") {
					var ord = inputs[i].id.split("_");
					
					//alert (inputs[i].id + ": " +ord.length + " val: " +inputs[i].value)
					if (ord.length == 3) {
						if (inputs[i].value > 0) {
							//alert ("ORDER: " + inputs[i].id + ": " +ord.length + " val: " +inputs[i].value)
							ordStr += ord[1]+"_"+ord[2]+"_"+inputs[i].value+"^";
						}
						inputs[i].value = "";
					}
				}
			}
		}
		//alert(ordStr);
		//ord[1]+","+ord[2]+","+inputs[i].value+"
		
		
		try {

			
			Shadowbox.close();
		} catch (e) {}

		
		if (ordStr != "") {
			flashCart();
			ajaxSendRequest("orderstatus","AddOrderLineItem","0,0,0,,0,0,,"+ordStr);
	
			//ajaxSendRequest("topbar","AddOrderLineItem","0,0,0,,0,0,,"+ordStr);
			}
			


	
	}
	
				
}

// re-run the last AJAX call
function ajaxGoBack() {
	var LastCmd;
	http.open('get', LastCmd);
   http.onreadystatechange = ajaxHandleResponse;
   http.send(null);
}

// Direct AJAX functions

function ajaxCreateRequestObject() {
     var ro;
     var browser = navigator.appName;
     if(browser == "Microsoft Internet Explorer"){
          ro = new ActiveXObject("Microsoft.XMLHTTP");
     }else{
          ro = new XMLHttpRequest();
     }
     return ro;
}

var http = ajaxCreateRequestObject();

function rnd(max) {
	var rndnum = max * Math.random();
	rndnum = Math.ceil(rndnum);
	return rndnum;
}

function InitResale() {
	http.open('get', '/resale/json.aspx&rnd='+rnd(9999999));
   http.send(null);
}
	

function ajaxSendRequest(sid,cmd,args) {
  // document.body.style.cursor = "wait";
   
   if (cmd != 'order')
   	LastCmd = 'content.asp?syscmd=ajaxcommand&sid='+sid+'&cmd='+cmd+'&args='+URL.encode(args);
   	
	//if (typeof(wtPageID) != 'undefined')
	//	http.open('get', '/dynamic/content.asp?syscmd=ajaxcommand&sid='+sid+'&cmd='+cmd+'&args='+args+'&nocontext=1&pageID='+wtPageID+'&rnd='+rnd(9999999));
//	else
	
	http.open('get', '/dynamic/content.asp?syscmd=ajaxcommand&sid='+sid+'&cmd='+cmd+'&args='+URL.encode(args)+'&nocontext=1&rnd='+rnd(9999999));
   http.onreadystatechange = ajaxHandleResponse;
   ajaxIsBusy = 1;
   http.send(null);
}

function ajaxHandleResponse() {
	if(http.readyState == 4){
		var response = http.responseText;
		var update = new Array();
		
		//document.body.style.cursor = "default";
		if(response.indexOf('' != -1)) {
			update = response.split('|');
			try {
				//if (update[0] == "tipclick_div") {
				//	tipclick.show (update[1], tipclickobj, tipclickevent);
				//} else {
					if (document.getElementById(update[0]))
						document.getElementById(update[0]).innerHTML = update[1];
				//}
			}
			catch (e) {
			}
			ajaxIsBusy = 0;
			if (update[0] == "orderstatus") {
				orderState = update[1];
				ajaxSendRequest("sbcontent","StatusBar","");
			}
				
		}
		
	}
}

function ediyOpenWindow(sURL, lWidth, lHeight) {
	var thewindow = window.open(sURL,'thewindow','location=no,status=no,height='+lWidth+',width='+lHeight+',scrollbars=no,resizable=no'); 
	return false;
}

function orderStatusInit() {
	ajaxSendRequest("orderstatus","OrderStatus","999,1");
}

function bookmarkPage(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}
var numtimes = 0;

function findInPage(str) { 
	var NS4 = (document.layers); 
	var win = window; 
	//var n = 0; 
	var IE4 = (document.all); 
	var txt, i, found; 
	
	if (str == "") return false; 
	if (NS4) { 
		if (!win.find(str)) while(win.find(str, false, true)) 
			numtimes++; 
		else 
			numtimes++; 
			
		if (numtimes == 0) 
			alert("Could not find "+str+"."); 
	} 
	if (IE4) { 
		txt = win.document.body.createTextRange(); 
		for (i = 0; i <= numtimes && (found = txt.findText(str)) != false; i++) { 
			txt.moveStart("character", 1); txt.moveEnd("textedit"); 
		} 
		if (found) { 
			txt.moveStart("character", -1); 
			txt.findText(str); 
			txt.select(); 
			txt.scrollIntoView(); 
			numtimes++; 
		} else { 
			if (numtimes > 0) { 
				numtimes = 0; findInPage(str); 
			} else 
				alert("Could not find "+str+"."); 
		} 
	} 
	return false; 
}


var tipclick = {
        vertical_offset : '-3px',
        horizontal_offset : '-3px',
        delay_disappear : 500,
        delay_appear : 500,
		  
		  load : function(pageID,obj,e) {
				this.show("Please Wait, Loading...", obj, e);
				//tipclickobj = obj;
				//tipclickevent = e;
				
				ajaxSendRequest("tipclick_div","Panel",pageID);
			},
			

        show : function(content, obj, e) {
                if (window.event) { 
                        event.cancelBubble=true;
                } else if (e.stopPropagation) {
                        e.stopPropagation();
                }
                this._do_hide();
                var tooltip = document.getElementById("tipclick_div");
                tooltip.innerHTML = content;
                if ((e.type == "click") || e.type == "mouseover") {
                        var self = this;
                        this._show_handler = setTimeout(function() {self._do_show();}, this.delay_appear);
                } //else if (e.type=="click") {   && tooltip.style.visibility == 'hidden'
                   //     tooltip.style.visibility = 'hidden';
               // }
                tooltip.x = this._get_pos_offset(obj, true);
                tooltip.y = this._get_pos_offset(obj, false);
                tooltip.style.left = tooltip.x - this._clear_browser_edge(obj, true) + "px";
                tooltip.style.top = tooltip.y - this._clear_browser_edge(obj, false) + obj.offsetHeight + "px";
                return true;
        },

        hide : function() {
                this._must_hide = true;
                var self = this;
                this._hide_handler = setTimeout(function() { self._do_hide(); }, this.delay_disappear);
                return true;
        },
        
        //---Private
        _show_handler : null,
        _hide_handler : null,
        _must_hide : true,

        _clear_tip : function() {
                if (typeof this._hide_handler != "undefined" || this._hide_handler !== null) {
                        clearTimeout(this._hide_handler);
                        delete(this._hide_handler);
                }
                if (typeof this._show_handler != "undefined" || this._show_handler !== null) {
                        clearTimeout(this._show_handler);
                        delete(this._show_handler);
                }
        },
        
        _get_pos_offset : function(what, is_left) {
                var total_offset = (is_left) ? what.offsetLeft : what.offsetTop;
                var parentEl = what.offsetParent;
                while (parentEl !== null) {
                        total_offset = (is_left) ? total_offset + parentEl.offsetLeft : total_offset + parentEl.offsetTop;
                        parentEl = parentEl.offsetParent;
                }
                return total_offset;
        },
        
        _clear_browser_edge : function(obj, is_horizontal) {
                var tooltip = document.getElementById("tipclick_div");
                var edge_offset = (is_horizontal) ? parseInt(this.horizontal_offset, 10)*-1 : parseInt(this.vertical_offset, 10)*-1;
                var is_ie = document.all && !window.opera;
                var window_edge, content_measure;
                if (is_ie) {
                        var ie_body = this._ie_body();
                }
                if (is_horizontal) {
                        window_edge = is_ie ? ie_body.scrollLeft + ie_body.clientWidth-15 : window.pageXOffset+window.innerWidth-15;
                        content_measure = tooltip.offsetWidth;
                        if (window_edge - tooltip.x < content_measure) {
                                edge_offset= content_measure - obj.offsetWidth;
                        }
                } else {
                        window_edge = is_ie ? ie_body.scrollTop + ie_body.clientHeight-15 : window.pageYOffset+window.innerHeight-18;
                        content_measure= tooltip.offsetHeight;
                        if (window_edge - tooltip.y < content_measure) {
                                edge_offset = content_measure + obj.offsetHeight;
                        }
                }
                return edge_offset;
        },
        
        _ie_body : function() {
                return (document.compatMode && document.compatMode!="BackCompat") ? document.documentElement : document.body;
         },
         
        _do_show : function() {
                document.getElementById("tipclick_div").style.visibility="visible";
        },
        
        _do_hide : function() {
                if (this._must_hide) {
                        document.getElementById("tipclick_div").style.visibility="hidden";
                }
                this._clear_tip();
        },
        
        _continue : function() {
                this._must_hide = false;
        },
        
        _stop : function() {
                this._must_hide = true;
                this.hide();
        }
};

var URL = {
 	getParam: function (param) {
	    param = param.replace(/[\[]/, '\\\[').replace(/[\]]/, '\\\]');
	
	    var regexS  = '[\\?&]' + param + '=([^&#]*)',
	        regex   = new RegExp(regexS),
	        results = regex.exec(window.location.href);
	
	    if (results === null) {
	        return '';
	    } else {
	        return results[1];
	    }
	},

    // public method for url encoding
    encode : function (string) {
        return escape(this._utf8_encode(string));
    },

    // public method for url decoding
    decode : function (string) {
        return this._utf8_decode(unescape(string));
    },

    // private method for UTF-8 encoding
    _utf8_encode : function (string) {
        string = string.replace(/\r\n/g,"\n");
        var utftext = "";

        for (var n = 0; n < string.length; n++) {

            var c = string.charCodeAt(n);

            if (c < 128) {
                utftext += String.fromCharCode(c);
            }
            else if((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            }
            else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }

        }

        return utftext;
    },

    // private method for UTF-8 decoding
    _utf8_decode : function (utftext) {
        var string = "";
        var i = 0;
        var c = c1 = c2 = 0;

        while ( i < utftext.length ) {

            c = utftext.charCodeAt(i);

            if (c < 128) {
                string += String.fromCharCode(c);
                i++;
            }
            else if((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i+1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            }
            else {
                c2 = utftext.charCodeAt(i+1);
                c3 = utftext.charCodeAt(i+2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }

        }

        return string;
    }

} 


if(typeof com=="undefined"){var com=new Object();}
if(typeof com.deconcept=="undefined"){com.deconcept=new Object();}
if(typeof com.deconcept.util=="undefined"){com.deconcept.util=new Object();}
if(typeof com.deconcept.FlashObjectUtil=="undefined"){com.deconcept.FlashObjectUtil=new Object();}
com.deconcept.FlashObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){
if(!document.createElement||!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=com.deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
this.useExpressInstall=_7;
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new com.deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=com.deconcept.FlashObjectUtil.getPlayerVersion(this.getAttribute("version"),_7);
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
this.addParam("wmode","transparent");

var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}
};
com.deconcept.FlashObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},createParamTag:function(n,v){
var p=document.createElement("param");
p.setAttribute("name",n);
p.setAttribute("value",v);
return p;
},getVariablePairs:function(){
var _19=new Array();
var key;
var _1b=this.getVariables();
for(key in _1b){_19.push(key+"="+_1b[key]);}
return _19;
},getFlashHTML:function(){
var _1c="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","PlugIn");
}
_1c="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_1c+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1d=this.getParams();
for(var key in _1d){_1c+=[key]+"=\""+_1d[key]+"\" ";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_1c+="flashvars=\""+_1f+"\"";}
_1c+="/>";
}else{
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
_1c="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_1c+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
var _20=this.getParams();
for(var key in _20){_1c+="<param name=\""+key+"\" value=\""+_20[key]+"\" />";}
var _22=this.getVariablePairs().join("&");
if(_22.length>0){_1c+="<param name=\"flashvars\" value=\""+_22+"\" />";
}_1c+="</object>";}
return _1c;
},write:function(_23){
if(this.useExpressInstall){
var _24=new com.deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_24)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);}
}else{this.setAttribute("doExpressInstall",false);}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _23=="string")?document.getElementById(_23):_23;
n.innerHTML=this.getFlashHTML();
}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}}};
com.deconcept.FlashObjectUtil.getPlayerVersion=function(_26,_27){
var _28=new com.deconcept.PlayerVersion(0,0,0);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_28=new com.deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{
try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
for(var i=3;axo!=null;i++){
axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
_28=new com.deconcept.PlayerVersion([i,0,0]);}}
catch(e){}
if(_26&&_28.major>_26.major){return _28;}
if(!_26||((_26.minor!=0||_26.rev!=0)&&_28.major==_26.major)||_28.major!=6||_27){
try{
_28=new com.deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
}catch(e){}}}
return _28;
};
com.deconcept.PlayerVersion=function(_2c){
this.major=parseInt(_2c[0])||0;
this.minor=parseInt(_2c[1])||0;
this.rev=parseInt(_2c[2])||0;
};
com.deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){return false;}
if(this.major>fv.major){return true;}
if(this.minor<fv.minor){return false;}
if(this.minor>fv.minor){return true;}
if(this.rev<fv.rev){return false;}
return true;
};
com.deconcept.util={getRequestParameter:function(_2e){
var q=document.location.search||document.location.hash;
if(q){var _30=q.indexOf(_2e+"=");
var _31=(q.indexOf("&",_30)>-1)?q.indexOf("&",_30):q.length;
if(q.length>1&&_30>-1){
return q.substring(q.indexOf("=",_30)+1,_31);}}return "";
},removeChildren:function(n){
while(n.hasChildNodes()){
n.removeChild(n.firstChild);}}};
if(Array.prototype.push==null){
Array.prototype.push=function(_33){
this[this.length]=_33;
return this.length;};}
var getQueryParamValue=com.deconcept.util.getRequestParameter;
var FlashObject=com.deconcept.FlashObject;

var ma=new Array();
var mx=new Array();
var my=new Array();
var mc=new Array();
var mpos=new Array();
var mal=0;
var main=0;
var menuw=200;
var psrc=0;
var pname="";
var al="";
var gd=0;
var gx,gy;
var d=document;
var NS7=(!d.all&&d.getElementById);
var NS4=(!d.getElementById);
var IE5=(!NS4&&!NS7&&(navigator.userAgent.indexOf('MSIE 5.0')!=-1||navigator.userAgent.indexOf('MSIE 5.2')!=-1));
var IE5p5=(!NS4&&!NS7&&navigator.userAgent.indexOf('MSIE 5.5')!=-1);
var NS6=(NS7&&navigator.userAgent.indexOf('Netscape6')!=-1);
var SAF=navigator.userAgent.indexOf('Safari')!=-1;
p=navigator.userAgent.indexOf('Opera');
if(p>-1)
{
    p=navigator.userAgent.charAt(p+6);
    if(p>6)NS7=1;
    else NS4=1;
}
var ifr=(!NS7&&!NS4&&!IE5&&!IE5p5);
var quirk=(d.compatMode&&d.compatMode=="BackCompat")||IE5||IE5p5;
function startMainMenu(file,h,w,dir,space,align)
{
    if(w>0)menuw=w;
    main=dir;
    if(main==1||main==2)d.write("<table border=\"0\" cellspacing=\""+space+"\" cellpadding=\"0\">");
    if(file!="")
    {
        al="";
        if(align==1)al=" align=\"right\"";
        if(align==2)al=" align=\"center\"";
        if(main==1||main==2)d.write("<tr><td"+al+">");
        d.write("<img src=\""+file+"\" border=\"0\"");
        if(h>0)d.write(" height=\""+h+"\"");
        if(w>0)d.write(" width=\""+w+"\"");
        d.write(" />");
        if(main==1||main==2)d.write("</td>");
        if(main==1)d.write("</tr>");
        if(main==3)d.write("<br />");
    }
}
function endMainMenu(file,h,w)
{
    if(file!="")
    {
        if(main==1)d.write("<tr>");
        if(main==1||main==2)d.write("<td"+al+">");
        d.write("<img src=\""+file+"\" border=\"0\"");
        if(h>0)d.write(" height=\""+h+"\"");
        if(w>0)d.write(" width=\""+w+"\"");
        d.write(" />");
        if(main==1||main==2)d.write("</td></tr>");
    }
    if(main==1||main==2)d.write("</table>");
    main=0;
}
function mainMenuItem(name,ext,h,w,url,tar,alt,dir,state,s)
{
    if(NS4&&main==0)return;
    var isgraphic=(alt!="") && (h>0) && (w>0); //ext.charAt(0)==".";
    if(main==1)d.write("<tr>");
    if(main==1||main==2)d.write("<td"+al+">");
    d.write("<a ");
    if(url!=""||!isgraphic)
    {
        if(typeof(clx)!="undefined")
        {
            url="?"+clx;
            tar="";
            alt="Click to edit";
        }
        d.write("href=\""+url+"\" ");
    }
    if(tar!="")d.write("target=\""+tar+"\" ");
    d.write("onmouseout=\"");
    if(dir>0)d.write("tidyMenu(event);");
    d.write("\" onmouseover=\"");
    if(dir>0)d.write("openMenu(event, '"+name+"',"+dir+","+bc+","+fc+");");
    if(state>1&&isgraphic)
    {
        d[name+"_over"]=new Image();
        d[name+"_over"].src="/images/Template/Buttons/"+alt+"_hi.gif";
        d.write("setGraphic(event, '/images/Template/Buttons/"+alt+"_hi.gif');");
    }
    d.write("return false;\"");
    if(!isgraphic)d.write(" class=\""+s+"\" style=\"width:"+(w>0?w:menuw)+"px\"");
    d.write(">");
    if(isgraphic)
    {
        d.write("<img src=\"/images/Template/Buttons/"+alt+"_def.gif\" border=\"0\"");
        if(h>0)d.write(" height=\""+h+"\"");
        if(w>0)d.write(" width=\""+w+"\"");
       // if(alt!="")d.write(" alt=\""+alt+"\"");
        d.write(" />");
    }
    else
    {
    		//alt="arrow";
			if ((main != 0) && (alt != "") && (alt != ext))
				//d.write("<table class=\""+s+"\" border=\"0\" width=\"100%\"><tr><td width=\"10%\" class=\""+s+"\"><img border=\"0\" src=\"/images/Template/Buttons/" + alt + "_def.gif\"></td><td width=\"90%\" class=\""+s+"\">"+ext+"</td></tr></table>");
				d.write("<img border=\"0\" src=\"/images/Template/Buttons/" + alt + "_def.gif\" align=\"left\">"+ext+"");
			//	d.write("<img border=\"0\" src=\"/images/Template/Buttons/" + alt + "_def.gif\" align=\"left\">");
				//d.write("<img border=\"0\" src=\"images/arrow.gif\" align=\"left\">"+ext+"");
			else
				d.write(""+ext+"");
			
    }
    d.write("</a>");
    if(main==1||main==2)d.write("</td>");
    if(main==1)d.write("</tr>");
    if(main==3)d.write("<br />");
}
function startSubmenu(name,style,sw)
{
    var depth=name.split("_").length+1000;
    if(NS4)return;
    if(sw>0)menuw=sw;
    d.write("<div id=\""+name+"\" class=\""+style+"\" style=\"z-index:"+depth+";width:"+(menuw+(NS7?bd+5:bd+5))+"px\">");
}
function endSubmenu(name)
{
    if(NS4)return;
    d.write("</div>");
    if(!NS7)d.getElementById(name).onmouseout=tidyMenu;
}
function submenuItem(text,url,tar,s)
{
    if(NS4)return;
    if(text.charAt(0)=='<')d.write(text);
    else if(text=="---")d.write("<div class=\""+s+"\" style=\"width:"+menuw+"px\"><center><img src=\""+loc+"---.gif\" height=\"8\" width=\""+(menuw-6-(2*bd))+"\" border=0/></center></div>");
    else
    {
        d.write("<a ");
        if(url!="")d.write("href=\""+url+"\" ");
        if(tar!="")d.write("target=\""+tar+"\" ");
        d.write("class=\""+s+"\" style=\"width:"+menuw+"px\">"+text+"</a>");
    }
}
function setGraphic(event,name)
{
    if(NS4)return;
    psrc=(NS7)?event.target:event.srcElement;
    pname=psrc.src;
    if(NS7)event.target.src=name;
    else event.srcElement.src=name;
}
function openMenu(event,id,pos,bc,fc)
{
    if(NS4)return;
    var el,x,y,dx,dy;
    var bwidth;
    if(gd==0||mal==0)
    {
        var p=d.getElementById(id);
        gx=0;
        gy=0;
        while(p&&p.offsetParent)
        {
            p=p.offsetParent;
            gx+=p.offsetLeft;
            gy+=p.offsetTop;
        }
        if(p)gd=1;
    }
    if(mal>0)
    {
        el=d.getElementById(ma[mal-1]);
        if(mx[mal-1]!=el.offsetLeft||my[mal-1]!=el.offsetTop)
        {
            el.style.left=mx[mal-1]+"px";
            el.style.top=my[mal-1]+"px";
        }
        tidyMenu(event);
    }
    if(mal>1)pos=mpos[mal-1];
    if(NS7)
    {
        bwidth=window.innerWidth;
        var p=event.target;
        if(p.nodeName!="A"&&p.nodeName!="IMG"&&p.parentNode.nodeName=="A")p=p.parentNode;
        dx=p.offsetWidth;
        dy=p.offsetHeight;
        if(mal==0)
        {
            x=p.x;
            y=p.y;
            if(typeof(p.x)=="undefined"||(!NS6&&!SAF))
            {
                x=p.offsetLeft;
                y=p.offsetTop;
                while(!NS6&&p.parentNode.nodeName!="BODY")
                {
                    p=p.parentNode;
                    if(p.nodeName=="TD"||p.nodeName=="TABLE")
                    {
                        x+=p.offsetLeft;
                        y+=p.offsetTop;
                    }
                }
            }
        }
        else
        {
            el=d.getElementById(ma[mal-1]);
            x=el.offsetLeft;
            y=el.offsetTop+p.offsetTop;
        }
        if(pos!=3)x-=bd;
        if(pos==3&&mal>0)x+=bd;
    }
    else
    {
        bwidth=document.body.clientWidth;
        x=event.clientX-event.offsetX-d.body.clientLeft-gx;
        y=event.clientY-event.offsetY-d.body.clientTop-gy;
        dx=event.srcElement.offsetWidth;
        dy=event.srcElement.offsetHeight;
        if(!quirk)
        {
            x+=d.documentElement.scrollLeft-2;
            y+=d.documentElement.scrollTop-2;
        }
        else
        {
            x+=d.body.scrollLeft;
            y+=d.body.scrollTop;
        }
        if(mal>0)
        {
            y-=bd;
            if(pos!=3)x-=2*bd;
        }
    }
    el=d.getElementById(id);
    if(el&&el.style.visibility!="visible")
    {
        if(pos==1)
        {
            x+=dx;
            el.style.left=x-el.offsetWidth+"px";
            el.style.top=y+"px";
            nspeed=el.offsetWidth/frames;
            if(x+gx+el.offsetWidth>bwidth)
            {
                x-=dx;
                pos=3;
            }
        }
        else if(pos==2)
        {
            y+=dy;
            el.style.left=x+"px";
            el.style.top=y-el.offsetHeight+"px";
            nspeed=el.offsetHeight/frames;
        }
        if(pos==3)
        {
            x-=el.offsetWidth;
            el.style.left=x+el.offsetWidth+"px";
            el.style.top=y+"px";
            nspeed=el.offsetWidth/frames;
            if(x+gx<0)
            {
                x+=el.offsetWidth;
                pos=1;
                x+=dx;
                el.style.left=x-el.offsetWidth+"px";
                el.style.top=y+"px";
                nspeed=el.offsetWidth/frames;
            }
        }
        mx[mal]=x;
        my[mal]=y;
        if(NS7||IE5||frames==0)
        {
            el.style.left=x+"px";
            el.style.top=y+"px";
        }
        if(!IE5)clipMenu(mal,el);
        el.style.visibility="visible";
        ma[mal]=id;
        mpos[mal]=pos;
        if(NS7)
        {
            var p=event.target;
            if(p.nodeName!="A"&&p.parentNode.nodeName=="A")p=p.parentNode;
            mc[mal]=p.style;
            if(!NS6&&mal>0)
            {
                mc[mal].backgroundColor="#"+bc.toString(16);
                mc[mal].color="#"+fc.toString(16);
            }
            el.onmouseout=tidyMenu;
        }
        else
        {
            mc[mal]=event.srcElement.style;
            if(mal>0)
            {
                mc[mal].backgroundColor=bc;
                mc[mal].color=fc;
            }
        }
        mal++;
    }
    if(ifr&&el&&frames==0&&(typeof(tr)=="undefined"||tr==""))
    {
        var p=d.getElementById(id+"i");
        if(p)
        {
            p.style.top=y+"px";
            p.style.left=x+"px";
            p.style.width=el.style.width;
            p.style.height=el.offsetHeight+"px";
            p.style.display="block";
        }
        else
        {
            ifr="<iframe id=\""+id+"i\" style=\"position:absolute;left:"+x+"px;width:"+el.style.width+";height:"+el.offsetHeight+"px;top:"+y+"px;z-index:998;display:block;\" scrolling=\"no\" frameborder=\"0\"></iframe>";
            el.insertAdjacentHTML('beforeBegin',ifr);
        }
    }
}
function overMenu(x,y)
{
    x-=gx;
    y-=gy;
    for(i=mal-1;i>=0;i--)
    {
        var el=d.getElementById(ma[i]);
        if(el.offsetLeft+el.offsetWidth>x&&el.offsetLeft<=x&&el.offsetTop+el.offsetHeight>y&&el.offsetTop<=y)
        {
            return ma[i];
        }
    }
    return "";
}
function tidyMenu(e)
{
    if(NS4)return;
    if(NS7)
    {
        t=overMenu(e.pageX,e.pageY);
        if(t!=""&&(e.target.firstChild==e.relatedTarget||e.target==e.relatedTarget.firstChild))return;
    }
    else
    {
        var x=event.clientX-d.body.clientLeft;
        var y=event.clientY-d.body.clientTop;
        if(!quirk)
        {
            x+=d.documentElement.scrollLeft-2;
            y+=d.documentElement.scrollTop-2;
        }
        else
        {
            x+=d.body.scrollLeft;
            y+=d.body.scrollTop;
        }
        t=overMenu(x,y);
    }
    om=0;
    for(i=0;i<mal;i++)
    {
        var mail=ma[i].length;
        if(mail>t.length||t.substring(0,mail)!=ma[i])
        {
            var el=d.getElementById(ma[i]);
            el.style.visibility="hidden";
            mc[i].backgroundColor="";
            mc[i].color="";
            if(ifr)
            {
                var p=d.getElementById(ma[i]+"i");
                if(p)p.style.display="none";
            }
        }
        else
        {
            ma[om]=ma[i];
            mx[om]=mx[i];
            my[om]=my[i];
            om++;
        }
    }
    mal=om;
    if(mal==0&&psrc)psrc.src=pname;
}
function animate()
{
    for(i=0;i<mal;i++)
    {
        var el=d.getElementById(ma[i]);
        if(el.style.visibility=="visible")
        {
            if(el.offsetLeft<mx[i])el.style.left=Math.min(el.offsetLeft+nspeed,mx[i])+"px";
            if(el.offsetLeft>mx[i])el.style.left=Math.max(el.offsetLeft-nspeed,mx[i])+"px";
            if(el.offsetTop<my[i])el.style.top=Math.min(el.offsetTop+nspeed,my[i])+"px";
            clipMenu(i,el);
        }
    }
    if(mal!=0||frames!=0)setTimeout("animate()",50);
}
function clipMenu(i,el)
{
    if(el.offsetLeft>mx[i])el.style.clip="rect("+(my[i]-el.offsetTop)+"px "+(el.offsetWidth+(mx[i]-el.offsetLeft))+"px "+el.offsetHeight+"px "+0+"px)";
    else el.style.clip="rect("+(my[i]-el.offsetTop)+"px "+el.offsetWidth+"px "+el.offsetHeight+"px "+(mx[i]-el.offsetLeft)+"px)";
}

function openChatWindow()   { window.open('http://www.ediy.co.nz/chat/default.asp?SiteName=Gun+City&SiteID=1094', '', 'toolbar=no,width=500,height=400,resizable=1'); } 
