
function loadComplete(){
	parseExternalLinks();
}


function popup(obj,w,h) {
	var url = (obj.getAttribute) ? obj.getAttribute('href') : obj.href;
	if (!url) return true;
	if(w && h){
		var args = 'width='+w+',height='+h+',resizable=yes';
	}
	else{
		var args = 'resizable=yes,hotkeys=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes';
	}
	pop = window.open(url,'',args);
	return (pop) ? false : true;
}	
	

function parseExternalLinks(){
	for(i=0; i<document.getElementsByTagName("a").length; i++){
		zwobj = document.getElementsByTagName("a")[i];
		if((zwobj.getAttribute) ? zwobj.getAttribute('rel') : zwobj.rel == "external"){
			zwobj.onclick = function(){
				return popup(this);	
			}
		}
		else if((zwobj.getAttribute) ? zwobj.getAttribute('target') : zwobj.target == "_blank"){
			zwobj.onclick = function(){
				return popup(this);
			}
			zwobj.target="";
		}
	}
}


function getNewHttpObject() {
    var objType = false;
    try {
        objType = new ActiveXObject('Msxml2.XMLHTTP');
    } catch(e) {
        try {
            objType = new ActiveXObject('Microsoft.XMLHTTP');
        } catch(e) {
            objType = new XMLHttpRequest();
        }
    }
    return objType;
}
function getsrc(url,elementContainer){
	document.getElementById(elementContainer).innerHTML = '<blink>Loading...<\/blink>';
	var theHttpRequest = getNewHttpObject();
	theHttpRequest.onreadystatechange = function() {processAXAH(elementContainer);};
	theHttpRequest.open("GET", url);
	theHttpRequest.send(false);
	function processAXAH(elementContainer){
	   if (theHttpRequest.readyState == 4) {
		   if (theHttpRequest.status == 200) {
			   document.getElementById(elementContainer).innerHTML = theHttpRequest.responseText;
		   } else {
			   document.getElementById(elementContainer).innerHTML="<p><span class='redtxt'>Error!<\/span> HTTP request return the following status message:&nbsp;" + theHttpRequest.statusText +"<\/p>";
		   }
	   }
	}			
}



function DrMenu(menuid){
	var self = this;
	this.menuid = menuid;
	this.active_items = new Array();  	this.html_menu = document.getElementById(this.menuid);  	this.menu_event = "over"; 	this.show_parent_active = true; 	this.linkOut = true;  	this.needIeSelectBoxBugFix = ((navigator.appVersion.indexOf("MSIE 5") != -1 || navigator.appVersion.indexOf("MSIE 6") != -1) && navigator.userAgent.indexOf("Opera")==-1); 	this.init = function(){
		this.html_menu.obref = this;  		this.html_menu.innerHTML = this.html_menu.innerHTML.replace(/<UL([^>]*)>/gi, '<div$1>').replace(/<\/UL>/gi, "</div>").replace(/<LI([^>]*)>/gi, '<span$1>').replace(/<\/LI>/gi, "</span>");  		for(i=0; i<this.html_menu.getElementsByTagName("a").length; i++){  			if(this.menu_event=="over" && this.html_menu.getElementsByTagName("a")[i].parentNode.getElementsByTagName("div").length>0){  				this.html_menu.getElementsByTagName("a")[i].onmouseover = this.itemOver;
				this.html_menu.getElementsByTagName("a")[i].onmouseout = this.itemOut;
				this.html_menu.getElementsByTagName("a")[i].className += " nextlevel";
				this.html_menu.getElementsByTagName("a")[i].parentNode.getElementsByTagName("div")[0].onmouseover = this.drOver;
				this.html_menu.getElementsByTagName("a")[i].parentNode.getElementsByTagName("div")[0].onmouseout = this.drOut;
				this.html_menu.getElementsByTagName("a")[i].parentNode.getElementsByTagName("div")[0].style.display = "block";  				this.setClassWidth(this.html_menu.getElementsByTagName("a")[i].parentNode.getElementsByTagName("div")[0]);  			}
			else if(this.menu_event=="over" && this.linkOut){  				this.html_menu.getElementsByTagName("a")[i].onmouseover = this.lwsmItemOver;
			}
			else if(this.menu_event=="click" && this.html_menu.getElementsByTagName("a")[i].parentNode.getElementsByTagName("div").length>0){
				this.html_menu.getElementsByTagName("a")[i].onclick = this.itemOver;
				this.html_menu.getElementsByTagName("a")[i].parentNode.getElementsByTagName("div")[0].style.display = "block";  				this.setClassWidth(this.html_menu.getElementsByTagName("a")[i].parentNode.getElementsByTagName("div")[0]);  			}
		}
		for(i=this.html_menu.getElementsByTagName("a").length-1; i>=0; i--){
			if(this.html_menu.getElementsByTagName("a")[i].parentNode.getElementsByTagName("div").length>0){
				this.html_menu.getElementsByTagName("a")[i].parentNode.getElementsByTagName("div")[0].style.display = "none";
				this.html_menu.getElementsByTagName("a")[i].parentNode.getElementsByTagName("div")[0].style.width = this.html_menu.getElementsByTagName("a")[i].parentNode.getElementsByTagName("div")[0].zw_width
			}
		}
	}
	this.lwsmItemOver = function(){
		for(i=0; i<this.parentNode.parentNode.getElementsByTagName("div").length; i++){
			if(this.parentNode.parentNode.getElementsByTagName("div")[i].style.display == "block"){
				self.itemOutTime(this.parentNode.parentNode.getElementsByTagName("div")[i].parentNode.getElementsByTagName("a")[0]);
			}
		}
	}
	this.itemOver = function(){
		zw = true;
		for(i=0; i<this.parentNode.getElementsByTagName("div").length; i++){
			if(this.parentNode.getElementsByTagName("div")[i].style.display == "block"){
				zw=false;
				break;
			}
		}
		if(zw){		
			for(i=0; i<	self.active_items.length; i++){
				self.itemOutTime(self.active_items[i]);
			}
			old_items = self.active_items;
			self.active_items = new Array();
			for(zw=this;zw; zw=zw.parentNode.parentNode.parentNode.getElementsByTagName("a")[0]){
				if(!zw.parentNode.getElementsByTagName("div")[0]){
					zw=false;
					break;
				}
				zw.parentNode.getElementsByTagName("div")[0].style.display = "block";
				self.active_items[self.active_items.length] = zw;
				if(!zw.parentNode.parentNode.parentNode.getElementsByTagName("a")[0]){
					zw=false;
					break;
				}
			}
		}
		this.parentNode.getElementsByTagName("div")[0].style.display = "block";
		if(self.show_parent_active){
			this.className = this.className + " hover";
		}
		if(old_items){
			for(i=0; i<old_items.length; i++){
				zw=false;
				for(j=0; j<self.active_items.length; j++){
					if(old_items[i].parentNode.innerHTML == self.active_items[j].parentNode.innerHTML){
						zw=true;
						break;
					}
				}
				if(!zw){
					self.itemOutTime(old_items[i]);
				}
			}
			old_items = false;
		}
		if(this.timeout){
			clearTimeout(this.timeout);
		}
	}
	this.drOver = function(){
		this.parentNode.getElementsByTagName("a")[0].onmouseover();
	}
	this.drOut = function(){
		this.parentNode.getElementsByTagName("a")[0].onmouseout();
	}
	this.itemOut = function(){
		this.timeout = setTimeout(function(a,b) { return function() { b.itemOutTime(a); } } (this,self), 300);
	}
	this.itemOutTime = function(object){
		object.parentNode.getElementsByTagName("div")[0].style.display = "none";
		object.className = object.className.replace(/hover/g, "");
	}
	this.setClassWidth = function(object){
		maxwidth = 0;
		for(j=0; j<object.childNodes.length; j++){
			if(object.childNodes[j].getElementsByTagName){
				if(object.childNodes[j].getElementsByTagName("a")[0].offsetWidth>maxwidth){
					maxwidth = object.childNodes[j].getElementsByTagName("a")[0].offsetWidth;
				}
			}
		}
		for(j=0; j<object.childNodes.length; j++){
			if(object.childNodes[j].getElementsByTagName){
				object.childNodes[j].getElementsByTagName("a")[0].style.width = (maxwidth - getCurrentStyle(object.childNodes[j].getElementsByTagName("a")[0], 'padding-left').replace(/px/, "") - getCurrentStyle(object.childNodes[j].getElementsByTagName("a")[0], 'padding-right').replace(/px/, "")) + "px";
				if(navigator.appVersion.indexOf("MSIE 5.5") != -1 || navigator.appVersion.indexOf("MSIE 5.0") != -1){
					object.childNodes[j].getElementsByTagName("a")[0].style.width = maxwidth;
				}
				if(object.childNodes[j].getElementsByTagName("div").length>0){
					object.childNodes[j].getElementsByTagName("div")[0].style.left = maxwidth + "px";
				}
			}
		}
		object.zw_width = maxwidth + "px";
		if(self.needIeSelectBoxBugFix){  			zw_iframe = document.createElement("iframe");
			object.insertBefore(zw_iframe, object.firstChild);
			zw_iframe.style.position = "absolute";
			zw_iframe.style.filter = 'alpha(opacity=0)';
			zw_iframe.style.left = (getCurrentStyle(object, "border-left-width").replace(/px/g, "")*(-1)) + (getCurrentStyle(object, "padding-left").replace(/px/g, "")*(-1)) + "px";
			zw_iframe.style.top = (getCurrentStyle(object, "border-top-width").replace(/px/g, "")*(-1)) + (getCurrentStyle(object, "padding-top").replace(/px/g, "")*(-1)) + "px";
			zw_iframe.style.width = (object.zw_width.replace(/px/g, "")*1) + (getCurrentStyle(object, "border-left-width").replace(/px/g, "")*1) + (getCurrentStyle(object, "border-right-width").replace(/px/g, "")*1) + (getCurrentStyle(object, "padding-left").replace(/px/g, "")*1) + (getCurrentStyle(object, "padding-right").replace(/px/g, "")*1) + "px";
			zw_iframe.style.height = (object.offsetHeight*1) + (getCurrentStyle(object, "border-top-width").replace(/px/g, "")*1) + (getCurrentStyle(object, "border-bottom-width").replace(/px/g, "")*1) + (getCurrentStyle(object, "padding-top").replace(/px/g, "")*1) + (getCurrentStyle(object, "padding-bottom").replace(/px/g, "")*1) + "px";
		}
	}
}

function getCurrentStyle(obj, prop){  	if(obj.currentStyle){
		if(obj.currentStyle.getAttribute(prop.replace(/\-/g, ""))){
			return obj.currentStyle.getAttribute(prop.replace(/\-/g, ""));
		}
		return "";
	}
	else if(document.defaultView && document.defaultView.getComputedStyle){
		if(document.defaultView.getComputedStyle(obj,"").getPropertyValue(prop)){
			return document.defaultView.getComputedStyle(obj,"").getPropertyValue(prop);
		}
		return "";
	}
	else if(window.getComputedStyle){
		if(window.getComputedStyle(obj,"").getPropertyValue(prop)){
			return window.getComputedStyle(obj,"").getPropertyValue(prop);
		}
		return "";
	}
	else{
		if(obj.style.getAttribute(prop.replace(/\-/g, ""))){
			return obj.style.getAttribute(prop.replace(/\-/g, ""));
		}
		return "";
	}
}


pspopupcount = 0;
zindexcount = 1000;
function psPopup(width, height, src, title){
	pspopupcount++;
	mypopup = document.createElement("div");
	mypopup.id = "pspopup_" + pspopupcount;
	mypopup = document.body.appendChild(mypopup);
	mypopup.appendChild(document.createElement("div"));
	mypopup.appendChild(document.createElement("div"));
	mypopup.getElementsByTagName("div")[0].appendChild(document.createElement("a"));
	mypopup.getElementsByTagName("div")[0].appendChild(document.createTextNode(title));
	mypopup.className = "pspopup";
	mypopup.getElementsByTagName("div")[0].className = "pspopup_title";
	mypopup.getElementsByTagName("div")[1].className = "pspopup_content";
	mypopup.getElementsByTagName("div")[1].id = "pspopupc_" + pspopupcount;
	mypopup.getElementsByTagName("div")[0].getElementsByTagName("a")[0].className = "pspopup_close";
	mypopup.getElementsByTagName("div")[0].getElementsByTagName("a")[0].href = 'javascript:void(0);';
	mypopup.getElementsByTagName("div")[0].getElementsByTagName("a")[0].onclick = function(){
		psPopupClose(this.parentNode.parentNode);
	}
	if(width!=""){
		mypopup.style.width = width;
	}
	else{
			}
	if(height!=""){
		mypopup.style.height = height;
	}
	mypopup.style.left = "200px";
	mypopup.style.top = "150px";
	mypopup.style.zIndex = zindexcount;
	zindexcount++;
	mypopup.getElementsByTagName("div")[0].onmousedown = function(e){
		psPopupDrag(this.parentNode, e);
	}
	if(src.search(/\.jpg$/)!=-1 || src.search(/\.bmp$/)!=-1 || src.search(/\.jpeg$/)!=-1 || src.search(/\.gif$/)!=-1 || src.search(/\.png$/)!=-1){
		mypopup.getElementsByTagName("div")[1].innerHTML = '<img src="' + src + '" />';
	}
	else{
		getsrc(src, mypopup.getElementsByTagName("div")[1].id);
	}
}


function psPopupClose(object){
	object.parentNode.removeChild(object);
}
function psPopupDrag(object, e){
	akt_object = object;
	object.style.zIndex = zindexcount;
	zindexcount++;
	object.firstx = getMousePos(e)[0];
	object.firsty = getMousePos(e)[1];
	object.firstpx = object.style.left.replace(/(.*)px/, "$1")*1;
	object.firstpy = object.style.top.replace(/(.*)px/, "$1")*1;
}
function psPopupDragIng(e){
	if(akt_object){
		if(akt_object.firstx){
			akt_object.style.left = akt_object.firstpx - (akt_object.firstx-getMousePos(e)[0]) + "px";
			akt_object.style.top = akt_object.firstpy - (akt_object.firsty-getMousePos(e)[1]) + "px";
			if(akt_object.style.left.replace(/(.*)px/, "$1")*1<0){
				akt_object.style.left="0px";
			}
			if(akt_object.style.top.replace(/(.*)px/, "$1")*1<0){
				akt_object.style.top="0px";
			}
		}
	}
}
function psPopupDrop(object){
	akt_object = false;
	object.firstx = false;
	object.firsty = false;
}
function getMousePos(e) {
	if (document.all) {
		mousex=event.x + document.documentElement.scrollLeft; 
		mousey=event.y + document.documentElement.scrollTop;
	}
	else {mousex=e.pageX; mousey=e.pageY;}
	return new Array(mousex, mousey);
}
document.onmousemove = function(e){
	psPopupDragIng(e);
}
document.onmouseup = function(e){
	akt_object = false;
}
akt_object=false;


function startSlideShow(object, path, imgarr){
	object.imgarr = imgarr;
	object.path = path;
	object.aktpic = Math.floor(Math.random()*imgarr.length);
	setTimeout('runSlideShow("' + object.id + '")', 5000);
}
function runSlideShow(objectid){
	object = document.getElementById(objectid);
	if (document.all){
		object.style.filter='blendTrans(duration='+'1,5'+')';
		object.filters.blendTrans.Apply();   
	}
	zw = Math.floor(Math.random()*object.imgarr.length);
	while(zw==object.aktpic && object.imgarr.length>1){
		zw = Math.floor(Math.random()*object.imgarr.length);
	}
	object.aktpic=zw;
	object.src = object.path + object.imgarr[object.aktpic];
	if (document.all){
		object.filters.blendTrans.Play();
	}
	setTimeout('runSlideShow("' + objectid + '")', 5000);
}