	
function PopWindow(a,width,height) {
	 window.open(a.href,a.target,"scrollbars=1,status=1,width="+width+",height="+height);
	 return false;
}


function XHConn() {
	this.monoReq = true;
	this.requesting = false;
	this.XMLHTTP = null;
 	this.Complete = false;
 	this.debug = false;
 	this.validContentType = '';
 	this.contentType = '';
 	this.content = null;
 	this.status = 0;
 	this.returnXML =false;
 	this.failureAlert = '';
 	this.oldBrowserAlert = '';
}


XHConn.prototype = {
	initConn: function() {
		this.Complete = false;
		this.requesting = true;
		this.status = 0;
		this.contentType = '';
		this.content = null;
		this.validContentType = this.validContentType.toLowerCase();
	}
	,initObj: function() {
		try { this.XMLHTTP = new ActiveXObject("Msxml2.XMLHTTP"); }
	 	catch(e) { 
			try { this.XMLHTTP = new ActiveXObject("Microsoft.XMLHTTP"); }
			catch(e) { 
				try { this.XMLHTTP = new XMLHttpRequest(); }
				catch(e) { this.XMLHTTP = null; }
			}
		}
		if(!this.XMLHTTP) {
			if(this.oldBrowserAlert) alert(this.oldBrowserAlert);
			return false;
		}	
		return true;
	}	
	,connect: function(sURL, sMethod, sVars, fnDone, fnFailure ) {
		if(this.monoReq && this.requesting) return false;
		if(!this.initObj()) return false;
		this.initConn();
		
		sMethod = sMethod.toUpperCase();
		try {
			if(sMethod == "GET") {
				this.XMLHTTP.open(sMethod, sURL+"?"+sVars, true);
				sVars = "";
			}
			else {
				this.XMLHTTP.open(sMethod, sURL, true);
				this.XMLHTTP.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
				this.XMLHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			}
			var self = this;
			this.XMLHTTP.onreadystatechange = function() {
				if(self.XMLHTTP.readyState == 4 && !self.Complete) {
		  			self.Complete = true;
		  			self.requesting = false;
		  			self.status = self.XMLHTTP.status;
		  			if(self.XMLHTTP.getResponseHeader("Content-Type")) self.contentType = self.XMLHTTP.getResponseHeader("Content-Type");
		  			if (self.returnXML) this.content= self.XMLHTTP.responseXML;
		  			else this.content = self.XMLHTTP.responseText;
		  			if (self.status==200 && (!self.validContentType || self.contentType==self.validContentType)) fnDone(this.content);
		  			else if(fnFailure) fnFailure(this.content)
		  			else self.failure();
		  			self.XMLHTTP = null;
				}
			};
			this.XMLHTTP.send(sVars);
		}
		catch(e) { failure(""); }
		return true;
	}
	,failure: function() {
		if(this.debug) alert(this.status + "\n" + this.content);
		else if(this.failureAlert) alert(this.failureAlert);
	}	
}

/////////////////////////////////////////////////////////

function mediaPlayer(params,ret) {
	if(params.showControls==null || params.showControls=='undefined') params.showControls =1;
	if(params.autoStart==null || params.autoStart=='undefined') params.autoStart =0;
	var str='<object id=mPlayer width="'+params.width+'" height="'+params.height+'" classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" type="application/x-oleobject">'+
			'<param name="URL" value="'+params.url+'">'+
			'<param name="enabled" value="true">'+
			'<param name="autoStart" value="'+params.autoStart+'">'+
			'<param name="showControls" value="'+params.showControls+'">'+
			'<EMBED id=mPlayer SRC="'+params.url+'"'+
					' ShowControls="'+params.showControls+'"'+
					' autostart="'+ params.autoStart+'"'+
					' width="'+params.width+'"'+
					' height="'+params.height+'"'+
					' TYPE="application/x-mplayer2"'+
					' pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"></EMBED>'+
			'</object>';
	if(ret) return str;
	else document.write(str);
}


function flashPlayer(params,ret) {
	if(params.id==null || params.id=='undefined') params.id='';
	if(params.thumb==null || params.thumb=='undefined') params.thumb='';
	if(params.autoStart==null || params.autoStart=='undefined') params.autoStart=false;
	if(params.autoStart==0) params.autoStart=false;
	else params.autoStart=true;
	//params.autoStart=false;

	var str='<object id="'+params.id+'" name="'+params.id+'" width="'+params.width+'" height="'+params.height+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0">'+
			'<param name="allowscriptaccess" value="always">'+
			'<param name="movie" value="'+params.playerUrl+'">'+
			'<param name="quality" value="high">'+
			'<param name="wmode" value="transparent">'+
			'<param name="FlashVars" value="backcolor=0x333333&frontcolor=0xFFFFFF&lightcolor=0xAAAAAA'+
									(params.id? '&enablejs=true&javascriptid='+ params.id : '') +
									'&overstretch=true'+
									'&usefullscreen=false'+
									'&image='+params.thumb+
									'&file='+params.url+
									'&width='+params.width+
									'&height='+params.height+
									'&displayheight='+params.height+
									'&autostart='+params.autoStart+'">'+
			'<embed id="'+params.id+'" name="'+params.id+'" allowscriptaccess="always"  src="'+params.playerUrl+'" width="'+params.width+'" height="'+params.height+'" '+
						'flashvars="backcolor=0x333333&frontcolor=0xFFFFFF&lightcolor=0xAAAAAA'+
									(params.id? '&enablejs=true&javascriptid='+ params.id : '')+
									'&overstretch=true'+
									'&usefullscreen=false'+
									'&image='+params.thumb+
									'&file='+params.url+
									'&width='+params.width+
									'&height='+params.height+
									'&displayheight='+params.height+
									'&autostart='+params.autoStart+'"'+
						' quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash">'+
			'</object>';
	if(ret) return str;
	else document.write(str);
}

function videoPlayer(params,ret) {
	var ext='';
	if (params.url.lastIndexOf(".") != -1) ext= params.url.slice( params.url.lastIndexOf(".") );
	if (ext.toLowerCase() == '.flv') return flashPlayer(params,ret);
	else return mediaPlayer(params,ret);
}
//////////////////////////////////////////////////////////////////////////
function MediaGallery() {
 this.titleID = "viewTitle";
 this.descID = "viewDesc";
 this.viewID = "viewMedia";
 this.mediaDir = '/media/products/large/';
 this.playerUrl = '/images/products/player.swf';
 this.imageTy = 0;
 this.videoWidth = 320;
 this.videoHeight = 240;
}
MediaGallery.prototype = {
	show: function(Me,autoStart) {
		var title = document.getElementById(this.titleID);
		var desc = document.getElementById(this.descID);
		var view = document.getElementById(this.viewID);
		if(autoStart=='undefined' || autoStart==null) autoStart=1;

		var viewX = view;
		if(view) {
			if ( parseInt(Me.getAttribute("type")) ==this.imageTy) {
				viewX.innerHTML = '<img src="'+ this.mediaDir + Me.getAttribute("media") +'">';
			}
			else {
				viewX.innerHTML =videoPlayer( {'width':this.videoWidth,
										'height': this.videoHeight,
										'playerUrl':this.playerUrl,
										'url':this.mediaDir + Me.getAttribute("media") ,
										'autoStart':autoStart } , true);
			}
		}
		title.innerHTML= Me.getAttribute("title");
		desc.innerHTML= Me.getAttribute("description");
		return false;
	}
}


