var publisher;
var highZ = 3;
var sTop=0, sLeft=0;
var path = "http://www.luxuryhomesnetwork.com/externalsearch/js"

function redirect(type) {
	if (type > 1) {
		var url = "http://www.luxuryhomesnetwork.com/externalsearch/default.asp?pg=search" + publisher
		//document.getElementById("search_popup_body").src = history.go(url);
		document.getElementById("search_popup_frame").src = url;
	}
	else if (type == 1 || type == -1) {
		document.getElementById("search_popup_body").src = history.go(type);
	}
	else {
		document.getElementById("search_popup_frame").src = "http://www.luxuryhomesnetwork.com";
	}
}

window.onload=function()
{
	sTop = this.scrollTop;
	if(typeof(publisher_id) != "undefined" && publisher_id)
		publisher = "&publisher=" + publisher_id;
	else
		publisher = "&publisher=0";
	var code="";
	code = code + "<div id='search_popup' style='position:absolute; overflow:hidden; visibility:hidden; width:700px; height:570px; margin:0; padding:0; cursor:default;'>";
	code = code + "<table width='100%' border='0' cellpadding='0' cellspacing='0'><tr><td>";
	code = code + "<div id='search_popup_bar' style='overflow:hidden; position:absolute; left:0px; top:0px; height:23px; cursor:default;'>";
	code = code + "<table width='100%' border='0' cellpadding='0' cellspacing='0' ><tr>";
	code = code + "	<td width='6' height='23' align='left' valign='center' style='background-image: url(" + path + "/images/okvir1_01.gif); background-repeat: no-repeat; background-position: right top;'>&nbsp;</td>";
//	code = code + "	<td width='120' height='23' align='left' valign='top'><img src='" + path + "/images/okvir1_02.gif' width='120' height='23'></td>";
	code = code + "	<td width='170' height='23' align='left' valign='top'><a href='http://www.luxuryhomesnetwork.com' target='_blank'><img src='" + path + "/images/okvir2_02.gif' width='170' height='23' style='cursor:pointer;cursor:hand;border:none;text-decoration:none;'></a></td>";
	code = code + "	<td height='23' colspan='4' align='center' valign='top' background='" + path + "/images/okvir1_03.gif' style='cursor:move;'>";
//code = code + "<div id='search_popup_bar' class='divbar'>";
	code = code + "		<table width='369' border='0' cellspacing='0' cellpadding='0'>";
	code = code + "			<tr>";
//	code = code + "				<td width='185' height='23' class='2'><img src='" + path + "/images/okvir1_05.gif' width='185' height='23'></td>";
//	code = code + "				<td width='184' height='23' class='2'><img src='" + path + "/images/okvir1_06.gif' width='184' height='23'></td>";
	code = code + "				<td width='190' height='23' style='background-image: url(" + path + "/images/okvir1_03.gif); background-repeat: repeat-x; background-position: left top;'><img src='" + path + "/images/okvir2_05.gif' width='190' height='23' style='cursor:move;'></td>";
	code = code + "			</tr>";
	code = code + "		</table>";
//code = code + "</div>";
	code = code + "	</td>";
	code = code + "	<td width='22' height='23' align='left' valign='top'><div id='search_popup_min' class='divbutton' style='position:absolute; overflow:hidden; cursor:default;'><img src='" + path + "/images/okvir1_08.gif' width='22' height='23'></div></td>";
	code = code + "	<td width='22' height='23' align='left' valign='top'><div id='search_popup_max' class='divbutton' style='position:absolute; overflow:hidden; cursor:default;'><img src='" + path + "/images/okvir1_09.gif' width='22' height='23'></div></td>";
	code = code + "	<td width='22' height='23' align='left' valign='top'><div id='search_popup_close' class='divbutton' style='position:absolute; overflow:hidden; cursor:default;'><img src='" + path + "/images/okvir1_10.gif' width='22' height='23'></div></td>";
	code = code + "	<td width='6' height='23' class='a3' style='background-image: url(" + path + "/images/okvir1_11.gif); background-repeat: no-repeat; background-position: left top;'>&nbsp;</td>";
	code = code + "	</tr></table>";
	code = code + "</div>";	//search_popup_bar
	code = code + "<div id='divpanel' class='divpanel' style='overflow: hidden; position:absolute; left:0px; top:23px; width: 100%; background:#FFFFFF;'>";
	code = code + "<table width='100%' border='0' cellpadding='0' cellspacing='0'><tr>";
	code = code + "	<td width='6' height='35' align='left' valign='top' class='a4' style='background-image: url(" + path + "/images/okvir1_12.gif); background-repeat: no-repeat; background-position: right top;'>&nbsp;</td>";
	code = code + "	<td colspan='8' align='left' valign='top'>";
	code = code + "		<table width='100%'  border='0' cellspacing='0' cellpadding='0'>";
	code = code + "			<tr align='left' valign='top'>";
	code = code + "				<td width='32' height='35'><img src='" + path + "/images/okvir1_13.gif' width='32' height='35' title='Back' style='cursor:pointer;cursor:hand;' onclick='redirect(-1);'></td>";
	code = code + "				<td width='31' height='35'><img src='" + path + "/images/okvir1_14.gif' width='31' height='35' title='Forward' style='cursor:pointer;cursor:hand;' onclick='redirect(1);'></td>";
	code = code + "				<td width='26' height='35'><img src='" + path + "/images/okvir1_15.gif' width='26' height='35' title='Home' style='cursor:pointer;cursor:hand;' onclick='redirect(100);'></td>";
//	code = code + "				<td width='31' height='35'><img src='" + path + "/images/okvir1_16.gif' width='31' height='35' title='Refresh' style='cursor:pointer;cursor:hand;' onclick='redirect(0);'></td>";
	code = code + "				<td width='100' height='35'><img src='" + path + "/images/okvir1_15a.gif' width='100' height='35' title='Home' style='cursor:pointer;cursor:hand;' onclick='redirect(100);'></td>";
	code = code + "				<td background='" + path + "/images/okvir1_17.gif'>&nbsp;</td>";
	code = code + "				<td width='22' height='35' class='a5' style='background-image: url(" + path + "/images/okvir1_20.gif); background-repeat: no-repeat; background-position: left top;'>&nbsp;</td>";
	code = code + "			</tr>";
	code = code + "		</table>";
	code = code + "	</td>";
	code = code + "	<td width='6' height='35' class='a6' style='background-image: url(" + path + "/images/okvir1_21.gif); background-repeat: no-repeat; background-position: left top;'>&nbsp;</td>";
	code = code + "</tr>";
	code = code + "<tr>";
	code = code + "	<td align='left' valign='top' class='a10' style='background-image: url(" + path + "/images/okvir1_22.gif); background-repeat: repeat-y; background-position: right top;'>&nbsp;</td>";
	code = code + "	<td colspan='8' align='center' valign='center' margin='10px'>";
	code = code + "		<div id='search_popup_body' align='center' class='divbody' style='width: 100%; margin-left: 5px; margin-right: 5px;'>";
	code = code + "			<iframe style='background:#FFFFFF;' id='search_popup_frame' frameborder='0' name='search_frame' scrolling='auto' allign='middle' height='100%' width='100%' src='http://www.luxuryhomesnetwork.com/externalsearch/default.asp?pg=search" + publisher + "'>&nbsp</iframe>";
	code = code + "		</div>";	//search_popup_body
	code = code + "	</td>";
	code = code + "	<td class='a11' style='background-image: url(" + path + "/images/okvir1_25.gif); background-repeat: repeat-y; background-position: left top;'>&nbsp;</td>";
	code = code + "</tr><tr>";
	code = code + "	<td width='6' height='15' align='left' valign='top' class='a7' style='background-image: url(" + path + "/images/okvir1_28.gif); background-repeat: no-repeat; background-position: right top;'>&nbsp;</td>";
	code = code + "	<td colspan='8' align='left' valign='top'>";
	code = code + "		<table width='100%'  border='0' cellspacing='0' cellpadding='0'><tr align='left' valign='top'>";
	code = code + "			<td width='32' height='15' class='a8' style='background-image: url(" + path + "/images/okvir1_29.gif); background-repeat: no-repeat; background-position: left top;'>&nbsp;</td>";
	code = code + "			<td class='a9' style='background-image: url(" + path + "/images/okvir1_31.gif); background-repeat: repeat-x; background-position: left top;'>&nbsp;</td>";
	code = code + "			<td width='22' height='15'><img src='" + path + "/images/okvir1_32.gif' width='22' height='15'></td>";
	code = code + "		</tr></table>";
	code = code + "	</td>";
	code = code + "	<td width='6' height='15' align='left' valign='top'><div id='search_popup_resize' class='divbutton' style='position:absolute; overflow:hidden; cursor:default;'><img src='" + path + "/images/okvir1_33.gif' width='6' height='15' style='cursor:nw-resize;'></div></td>";
	code = code + "</tr></table>";
	code = code + "</div>";	//divpanel
	code = code + "</td></tr></table>";
	code = code + "</div>";	//search_popup
	document.body.innerHTML = code + document.body.innerHTML;

}

//window.onscroll = start();

function start() {
//	this.scrollTop = window.pageYoffset;
	var top_pos = document.body.scrollTop;
	var search_popup = xGetElementById('search_popup');
	var search_popup_bar = xGetElementById('search_popup_bar');
	var rBtn = xGetElementById('search_popup_resize');
	var maxBtn = xGetElementById('search_popup_max');
	var minBtn = xGetElementById('search_popup_min');
	var cBtn = xGetElementById('search_popup_close');
	var pbody = xGetElementById('search_popup_body');
	
	MoveTo(search_popup, 150, top_pos);
	EnableDrag(search_popup_bar, InitDrag, Drag, null);
	EnableDrag(rBtn, InitResize, Resize, null);
	cBtn.onclick = closepopup;
	maxBtn.onclick = Maximize;
	minBtn.onclick = Minimize;
	drawpopup();
}

function evaluate() {
	sTop = document.body.scrollTop;
	sLeft = document.body.scrollLeft;
}

function positions() {
	msg = "scrolltop: " + document.body.scrollTop;
	msg += "\noffsetTop: " + document.body.offsetTop;
	msg += "\ndiv";
	msg += "scrolltop: " + xGetElementById("search_popup").scrollTop;
	msg += "\noffsetTop: " + xGetElementById("search_popup").offsetTop;
	alert(msg);
}

function drawpopup() {
	var search_popup_body = xGetElementById('search_popup_body');
	var search_popup = xGetElementById('search_popup');
	search_popup_body.style.height = (parseInt(Height(search_popup)) - 73) + "px";
	search_popup_body.style.width = (parseInt(Width(search_popup)) - 22) + "px";
}

function showpopup() {
	start();
	var search_popup = xGetElementById('search_popup');
	Show(search_popup);
	placeIt("search_popup");
}

function closepopup() {
	var object = xGetElementById("search_popup");
	Hide(object);
}

function InitDrag(ele, mx, my) {
	ZIndex('search_popup', highZ++);
}

function Drag(ele, mdx, mdy) {
	MoveTo('search_popup', Left('search_popup') + mdx, Top('search_popup') + mdy);
	drawpopup();
}

function InitResize(ele, mx, my) {
	ZIndex('search_popup', highZ++);
}

function Resize(ele, mdx, mdy) {
	ResizeTo('search_popup', Width('search_popup') + mdx, Height('search_popup') + mdy);
	ResizeTo('search_popup_body', Width('search_popup_body') + mdx, Height('search_popup_body') + mdy);
	if (Width(xGetElementById('search_popup')) <= 570) {
		ResizeTo('search_popup', 570, Height('search_popup') + mdy);
		ResizeTo('search_popup_body', 558, Height('search_popup_body') + mdy);
	}
	if (Height(xGetElementById('search_popup')) <= 200) {
		ResizeTo('search_popup', Width('search_popup') + mdx, 200);
		ResizeTo('search_popup_body', Width('search_popup_body') + mdx, 127);
	}
	drawpopup();
}

function Maximize() {
	var search_popup = xGetElementById('search_popup');
	var search_popup_body = xGetElementById('search_popup_body');
	if (!(search_popup.maximized)) {
		search_popup.prevW = Width(search_popup);
		search_popup.prevH = Height(search_popup);
		search_popup.prevX = Left(search_popup);
		search_popup.prevY = Top(search_popup);
		MoveTo(search_popup, ScrollLeft(), ScrollTop());
		search_popup.maximized = true;
		ResizeTo(search_popup, GetClientWidth(), GetClientHeight());
		drawpopup();
	}
}

function Minimize() {
	var search_popup = xGetElementById('search_popup');
	var search_popup_body = xGetElementById('search_popup_body');
	if (search_popup.maximized) {
		search_popup.maximized = false;
		ResizeTo(search_popup, search_popup.prevW, search_popup.prevH);
		MoveTo(search_popup, search_popup.prevX, search_popup.prevY);
		drawpopup();
	}
}













function Background(element, color, image){
	if (!(element = xGetElementById(element)))
		return "";
	var background="";
	if (element.style){
		if (xStr(color)){
			element.style.backgroundColor = color;
		}
		if (xStr(image)){
			element.style.backgroundImage = (image!="") ? "url("+image+")" : null;
		}
		background = element.style.backgroundColor;
	}
	return background;
}

function GetClientHeight() {
	var height;
	if (document.compatMode == "CSS1Compat" && !window.opera && document.documentElement && document.documentElement.clientHeight) {
		height = document.documentElement.clientHeight;
	}
	else if (document.body && document.body.clientHeight){
		height = document.body.clientHeight;
	}
	else if (Defined(window.innerWidth, window.innerHeight, document.width)){
		height = window.innerHeight;
		if (document.width > window.innerWidth)
			height -= 16;
	}
	return height;
}

function GetClientWidth(){
	var width;
	if (document.compatMode == "CSS1Compat" && !window.opera && document.documentElement && document.documentElement.clientWidth){
		width = document.documentElement.clientWidth;
	}
	else if (document.body && document.body.clientWidth) {
		width = document.body.clientWidth;
	}
	else if (Defined(window.innerWidth, window.innerHeight, document.height)) {
		width = window.innerWidth;
		if (document.height > window.innerHeight)
			width -= 16;
	}
	return width;
}

function Clip(e,t,r,b,l){
	if(!(e=xGetElementById(e)))
		return;
	if(e.style){
		if(xNum(l))
			e.style.clip='rect('+t+'px '+r+'px '+b+'px '+l+'px)';
		else
			e.style.clip='rect(0 '+parseInt(e.style.width)+'px '+parseInt(e.style.height)+'px 0)';
	}
}
function Color(e,s){
	if(!(e=xGetElementById(e)))
		return'';
	var c='';
	if(e.style&&Defined(e.style.color)){
		if(xStr(s))
			e.style.color=s;
		c=e.style.color;
	}
	return c;
}
function Defined(){
	for(var i=0;i<arguments.length;++i){
		if(typeof(arguments[i])=='undefined')
			return false;
	}
	return true;
}
function Display(e,s){
	if((e=xGetElementById(e))&&e.style&&Defined(e.style.display)){
		if(xStr(s)){
			try{
				e.style.display=s;
			}
			catch(ex){
				e.style.display='';
			}
		}
		return e.style.display;
	}
	return null;
}
function xGetComputedStyle(oEle,sProp,bInt){
	var s,p='undefined';
	var dv=document.defaultView;
	if(dv&&dv.getComputedStyle){
		s=dv.getComputedStyle(oEle,'');
		if(s)
			p=s.getPropertyValue(sProp);
	}
	else if(oEle.currentStyle){
		var i,c,a=sProp.split('-');
		sProp=a[0];
		for(i=1;i<a.length;++i){
			c=a[i].charAt(0);
			sProp+=a[i].replace(c,c.toUpperCase());
		}
		p=oEle.currentStyle[sProp];
	}
	else
		return null;
	return bInt?(parseInt(p)||0):p;
}
function xGetElementById(e){
	if(typeof(e)=='string'){
		if(document.getElementById)
			e=document.getElementById(e);
		else if(document.all)
			e=document.all[e];
		else
			e=null;
	}
	return e;
}
function xGetElementsByTagName(t,p){
	var list=null;
	t=t||'*';
	p=p||document;
	if(typeof p.getElementsByTagName!='undefined'){
		list=p.getElementsByTagName(t);
		if(t=='*'&&(!list||!list.length))
			list=p.all;
	}
	else{
		if(t=='*')
			list=p.all;
		else if(p.all&&p.all.tags)
			list=p.all.tags(t);
	}
	return list||new Array();
}
function HasPoint(e,x,y,t,r,b,l){
	if(!xNum(t)){
		t=r=b=l=0;
	}
	else if(!xNum(r)){
		r=b=l=t;
	}
	else if(!xNum(b)){
		l=r;b=t;
	}
	var eX=PageX(e),eY=PageY(e);
	return(x>=eX+l&&x<=eX+Width(e)-r&&y>=eY+t&&y<=eY+Height(e)-b);
}
function Height(e,h){
	if(!(e=xGetElementById(e)))
		return 0;
	if(xNum(h)){
		if(h<0)
			h=0;
		else
			h=Math.round(h);
	}
	else h=-1;
	var css=Defined(e.style);
	if(e==document||e.tagName.toLowerCase()=='html'||e.tagName.toLowerCase()=='body'){
		h=GetClientHeight();
	}
	else if(css&&Defined(e.offsetHeight)&&xStr(e.style.height)){
		if(h>=0){
			var pt=0,pb=0,bt=0,bb=0;
			if(document.compatMode=='CSS1Compat'){
				var gcs=xGetComputedStyle;
				pt=gcs(e,'padding-top',1);
				if(pt!==null){
					pb=gcs(e,'padding-bottom',1);
					bt=gcs(e,'border-top-width',1);
					bb=gcs(e,'border-bottom-width',1);
				}
				else if(Defined(e.offsetHeight,e.style.height)){
					e.style.height=h+'px';
					pt=e.offsetHeight-h;
				}
			}
			h-=(pt+pb+bt+bb);
			if(isNaN(h)||h<0)
				return;
			else
				e.style.height=h+'px';
		}
		h=e.offsetHeight;
	}
	else if(css&&Defined(e.style.pixelHeight)){
		if(h>=0)e.style.pixelHeight=h;
		h=e.style.pixelHeight;
	}
	return h;
}
function Hide(e){
	return Visibility(e,0);
}
function Left(e,iX){
	if(!(e=xGetElementById(e)))
		return 0;
	var css=Defined(e.style);
	if(css&&xStr(e.style.left)){
		if(xNum(iX))
			e.style.left=iX+'px';
		else{
			iX=parseInt(e.style.left);
			if(isNaN(iX))
				iX=xGetComputedStyle(e,'left',1);
			if(isNaN(iX))
				iX=0;
		}
	}
	else if(css&&Defined(e.style.pixelLeft)){
		if(xNum(iX))
			e.style.pixelLeft=iX;
		else iX=e.style.pixelLeft;
	}
	return iX;
}

function MoveTo(e,x,y){
	Left(e,x);
	Top(e,y);
}
function xNum(){
	for(var i=0;i<arguments.length;++i){
		if(isNaN(arguments[i])||typeof(arguments[i])!='number')
			return false;
	}
	return true;
}
function OffsetLeft(e){
	if(!(e=xGetElementById(e)))
		return 0;
	if(Defined(e.offsetLeft))
		return e.offsetLeft;
	else
		return 0;
}
function OffsetTop(e){
	if(!(e=xGetElementById(e)))
		return 0;
	if(Defined(e.offsetTop))
		return e.offsetTop;
	else
		return 0;
}
function Opacity(e,o){
	var set=Defined(o);
	if(!(e=xGetElementById(e)))
		return 2;
	if(xStr(e.style.opacity)){
		if(set)
			e.style.opacity=o+'';
		else
			o=parseFloat(e.style.opacity);
	}
	else if(xStr(e.style.filter)){
		if(set)
			e.style.filter='alpha(opacity='+(100*o)+')';
		else if(e.filters&&e.filters.alpha){
			o=e.filters.alpha.opacity/100;
		}
	}
	else if(xStr(e.style.MozOpacity)){
		if(set)
			e.style.MozOpacity=o+'';
		else
			o=parseFloat(e.style.MozOpacity);
	}
	else if(xStr(e.style.KhtmlOpacity)){
		if(set)
			e.style.KhtmlOpacity=o+'';
		else
			o=parseFloat(e.style.KhtmlOpacity);
	}
	return isNaN(o)?1:o;
}
function PageX(e){
	var x=0;
	e=xGetElementById(e);
	while(e){
		if(Defined(e.offsetLeft))
			x+=e.offsetLeft;
		e=Defined(e.offsetParent)?e.offsetParent:null;
	}
	return x;
}
function PageY(e){
	var y=0;
	e=xGetElementById(e);
	while(e){
		if(Defined(e.offsetTop))
			y+=e.offsetTop;
		e=Defined(e.offsetParent)?e.offsetParent:null;
	}
	return y;
}
function Parent(e,bNode){
	if(!(e=xGetElementById(e)))
		return null;
	var p=null;
	if(!bNode&&Defined(e.offsetParent))
		p=e.offsetParent;
	else if(Defined(e.parentNode))
		p=e.parentNode;
	else if(Defined(e.parentElement))
		p=e.parentElement;
	return p;
}
function ResizeTo(e,w,h){
	Width(e,w);
	Height(e,h);
}
function ScrollLeft(e,bWin){
	var offset=0;
	if(!Defined(e)||bWin||e==document||e.tagName.toLowerCase()=='html'||e.tagName.toLowerCase()=='body'){
		var w=window;
		if(bWin&&e)
			w=e;
		if(w.document.documentElement&&w.document.documentElement.scrollLeft)
			offset=w.document.documentElement.scrollLeft;
		else if(w.document.body&&Defined(w.document.body.scrollLeft))
			offset=w.document.body.scrollLeft;
	}
	else{
		e=xGetElementById(e);
		if(e&&xNum(e.scrollLeft))
			offset=e.scrollLeft;
	}
	return offset;
}
function ScrollTop(e,bWin){
	var offset=0;
	if(!Defined(e)||bWin||e==document||e.tagName.toLowerCase()=='html'||e.tagName.toLowerCase()=='body'){
		var w=window;if(bWin&&e)w=e;
		if(w.document.documentElement&&w.document.documentElement.scrollTop)
			offset=w.document.documentElement.scrollTop;
		else if(w.document.body&&Defined(w.document.body.scrollTop))
			offset=w.document.body.scrollTop;
	}
	else{
		e=xGetElementById(e);
		if(e&&xNum(e.scrollTop))
			offset=e.scrollTop;
	}
	return offset;
}
function Show(e){
	return Visibility(e,1);
}
function xStr(s){
	for(var i=0;i<arguments.length;++i){
		if(typeof(arguments[i])!='string')
			return false;
	}
	return true;
}
function Top(e,iY){
	if(!(e=xGetElementById(e)))
		return 0;
	var css=Defined(e.style);
	if(css&&xStr(e.style.top)){
		if(xNum(iY))
			e.style.top=iY+'px';
		else{
			iY=parseInt(e.style.top);
			if(isNaN(iY))
				iY=xGetComputedStyle(e,'top',1);
			if(isNaN(iY))
				iY=0;
		}
	}
	else if(css&&Defined(e.style.pixelTop)){
		if(xNum(iY))
			e.style.pixelTop=iY;
		else
			iY=e.style.pixelTop;
	}
	return iY;
}
/*function Top(e,iY){
	if(!(e=xGetElementById(e)))
		return 0;
	var css=Defined(e.style);
	if(css&&xStr(e.style.top)){
		if(xNum(iY)) {
			iY += document.body.scrollTop;
			xGetElementById("search_popup").scrollTop=0;
			e.style.top=iY+'px';
		}
		else{
			iY=parseInt(e.style.top);
			if(isNaN(iY))
				iY=xGetComputedStyle(e,'top',1);
			if(isNaN(iY))
				iY=0;
			iY += document.body.scrollTop;
			xGetElementById("search_popup").scrollTop=0;
			e.style.top=iY+'px';
		}
	}
	else if(css&&Defined(e.style.pixelTop)){
		if(xNum(iY)) {
			iY += document.body.scrollTop;
			xGetElementById("search_popup").scrollTop=0;
			e.style.pixelTop=iY;
		}
		else
			iY=e.style.pixelTop;
	}
	return iY;
}*/
var xOp7Up,xOp6Dn,xIE4Up,xIE4,xIE5,xNN4,xUA=navigator.userAgent.toLowerCase();
if(window.opera){
	var i=xUA.indexOf('opera');
	if(i!=-1){
		var v=parseInt(xUA.charAt(i+6));
		xOp7Up=v>=7;
		xOp6Dn=v<7;
	}
}
else if(navigator.vendor!='KDE'&&document.all&&xUA.indexOf('msie')!=-1){
	xIE4Up=parseFloat(navigator.appVersion)>=4;
	xIE4=xUA.indexOf('msie 4')!=-1;
	xIE5=xUA.indexOf('msie 5')!=-1;
}
else if(document.layers){
	xNN4=true;
}
xMac=xUA.indexOf('mac')!=-1;
function Visibility(e,bShow){
	if(!(e=xGetElementById(e)))
		return null;
	if(e.style&&Defined(e.style.visibility)){
		if(Defined(bShow))
			e.style.visibility=bShow?'visible':'hidden';
		return e.style.visibility;
	}
	return null;
}
function Width(e,w){
	if(!(e=xGetElementById(e)))
		return 0;
	if(xNum(w)){
		if(w<0)
			w=0;
		else
			w=Math.round(w);
	}
	else w=-1;
	var css=Defined(e.style);
	if(e==document||e.tagName.toLowerCase()=='html'||e.tagName.toLowerCase()=='body'){
		w=GetClientWidth();
	}
	else if(css&&Defined(e.offsetWidth)&&xStr(e.style.width)){
		if(w>=0){
			var pl=0,pr=0,bl=0,br=0;
			if(document.compatMode=='CSS1Compat'){
				var gcs=xGetComputedStyle;
				pl=gcs(e,'padding-left',1);
				if(pl!==null){
					pr=gcs(e,'padding-right',1);
					bl=gcs(e,'border-left-width',1);
					br=gcs(e,'border-right-width',1);
				}
				else if(Defined(e.offsetWidth,e.style.width)){
					e.style.width=w+'px';
					pl=e.offsetWidth-w;
				}
			}
			w-=(pl+pr+bl+br);
			if(isNaN(w)||w<0)
				return;
			else
				e.style.width=w+'px';
		}
		w=e.offsetWidth;
	}
	else if(css&&Defined(e.style.pixelWidth)){
		if(w>=0)
			e.style.pixelWidth=w;
		w=e.style.pixelWidth;
	}
	return w;
}
function ZIndex(e,uZ){
	if(!(e=xGetElementById(e)))
		return 0;
	if(e.style&&Defined(e.style.zIndex)){
		if(xNum(uZ))
			e.style.zIndex=uZ;
		uZ=parseInt(e.style.zIndex);
	}
	return uZ;
}
function DisableDrag(id,last){
	if(!window._xDrgMgr)
		return;
	var ele=xGetElementById(id);
	ele.xDraggable=false;
	ele.xODS=null;
	ele.xOD=null;
	ele.xODE=null;
	RemoveEventListener(ele,'mousedown',_xOMD,false);
	if(_xDrgMgr.mm&&last){
		_xDrgMgr.mm=false;
		RemoveEventListener(document,'mousemove',_xOMM,false);
	}
}
function DisableDrop(id){
	if(!window._xDrgMgr)
		return;
	var e=xGetElementById(id);
	if(e&&e.xODp){
		e.xODp=null;
		for(i=0;i<_xDrgMgr.drops.length;++i){
			if(e==_xDrgMgr.drops[i]){
				_xDrgMgr.drops.splice(i,1);
			}
		}
	}
}
var _xDrgMgr={ele:null,mm:false};
function EnableDrag(id,fS,fD,fE,x1,y1,x2,y2){
	var el=xGetElementById(id);
	if(el){
		el.xDraggable=true;
		el.xODS=fS;
		el.xOD=fD;
		el.xODE=fE;
		el.xREC=null;
		if(Defined(x1,y1,x2,y2)){
			el.xREC={x1:x1,y1:y1,x2:x2,y2:y2};
		}
		AddEventListener(el,'mousedown',_xOMD,false);
		if(!_xDrgMgr.mm){
			_xDrgMgr.mm=true;
			AddEventListener(document,'mousemove',_xOMM,false);
		}
	}
}

function _xOMD(e){
	var ev=new Event(e);
	if(ev.button!=0)
		return;
	var t=ev.target;
	while(t&&!t.xDraggable){
		t=Parent(t);
	}
	if(t){
		xPreventDefault(e);
		t.xDPX=ev.pageX;
		t.xDPY=ev.pageY;
		_xDrgMgr.ele=t;
		AddEventListener(document,'mouseup',_xOMU,false);
		if(t.xODS){
			t.xODS(t,ev.pageX,ev.pageY);
		}
	}
}

function _xOMM(e){
	var ev=new Event(e);
	if(_xDrgMgr.ele){
		xPreventDefault(e);
		var b=true,el=_xDrgMgr.ele;
		var dx=ev.pageX-el.xDPX;
		var dy=ev.pageY-el.xDPY;
		el.xDPX=ev.pageX;
		el.xDPY=ev.pageY;
		if(el.xREC){
			var r=el.xREC,x=PageX(el)+dx,y=PageY(el)+dy;
			var b=(x>=r.x1&&x+Width(el)<=r.x2&&y>=r.y1&&y+Height(el)<=r.y2);
		}
		if(el.xOD){
			el.xOD(el,dx,dy,b);
		}
		else if(b){
			MoveTo(el,Left(el)+dx,Top(el)+dy);
		}
	}
}

function _xOMU(e){
	if(_xDrgMgr.ele){
		xPreventDefault(e);
		RemoveEventListener(document,'mouseup',_xOMU,false);
		if(_xDrgMgr.ele.xODE){
			var ev=new Event(e);
			_xDrgMgr.ele.xODE(_xDrgMgr.ele,ev.pageX,ev.pageY);
		}
		_xDrgMgr.ele=null;
	}
}

function EnableDrop(id,fD){
	var e=xGetElementById(id);
	if(e){
		e.xODp=fD;
		if(!_xDrgMgr.drops){
			_xDrgMgr.drops=new Array();
		}
		_xDrgMgr.drops[_xDrgMgr.drops.length]=e;
		if(!_xDrgMgr.omu){
			_xDrgMgr.omu=_xOMU;
			_xOMU=_xOMU2;
		}
	}
}

function _xOMU2(e){
	var i,z,hz=0,he=null;
	e=new Event(e);
	for(i=0;i<_xDrgMgr.drops.length;++i){
		if(HasPoint(_xDrgMgr.drops[i],e.pageX,e.pageY)){
			z=ZIndex(_xDrgMgr.drops[i])||0;
			if(z>=hz){
				hz=z;
				he=_xDrgMgr.drops[i];
			}
		}
	}
	var ele=_xDrgMgr.ele;
	_xDrgMgr.omu(e);
	if(he&&he.xODp){
		he.xODp(ele,e.pageX,e.pageY);
	}
}

function AddEventListener(e,eT,eL,cap){
	if(!(e=xGetElementById(e)))
		return;
	eT=eT.toLowerCase();
	if(e.addEventListener)
		e.addEventListener(eT,eL,cap||false);
	else if(e.attachEvent)
		e.attachEvent('on'+eT,eL);
	else
		e['on'+eT]=eL;
}
function Event(evt){
	var e=evt||window.event;
	if(!e)
		return;
	if(e.type)
		this.type=e.type;
	if(e.target)
		this.target=e.target;
	else if(e.srcElement)
		this.target=e.srcElement;
	if(e.relatedTarget)
		this.relatedTarget=e.relatedTarget;
	else if(e.type=='mouseover'&&e.fromElement)
		this.relatedTarget=e.fromElement;
	else if(e.type=='mouseout')
		this.relatedTarget=e.toElement;
	if(Defined(e.pageX,e.pageY)){
		this.pageX=e.pageX;
		this.pageY=e.pageY;
	}
	else if(Defined(e.clientX,e.clientY)){
		this.pageX=e.clientX+ScrollLeft();
		this.pageY=e.clientY+ScrollTop();
	}
	if(Defined(e.offsetX,e.offsetY)){
		this.offsetX=e.offsetX;
		this.offsetY=e.offsetY;
	}
	else if(Defined(e.layerX,e.layerY)){
		this.offsetX=e.layerX;
		this.offsetY=e.layerY;
	}
	else{
		this.offsetX=this.pageX-PageX(this.target);
		this.offsetY=this.pageY-PageY(this.target);
	}
	this.keyCode=e.keyCode||e.which||0;
	this.shiftKey=e.shiftKey;
	this.ctrlKey=e.ctrlKey;
	this.altKey=e.altKey;
	this.button=3;
	if(e.type.indexOf('click')!=-1){
		this.button=0;
	}
	else if(e.type.indexOf('mouse')!=-1){
		/*@cc_on@if(@_jscript_version)
		if(e.button==1)
			this.button=0;
		else if(e.button==4)
			this.button=1;
		else if(e.button==2)
			this.button=2;
		@else @*/
			this.button=e.button;
		/*@end @*/
	}
}

function xPreventDefault(e){
	if(e&&e.preventDefault)
		e.preventDefault();
	else if(window.event)
		window.event.returnValue=false;
}
function RemoveEventListener(e,eT,eL,cap){
	if(!(e=xGetElementById(e)))
		return;
	eT=eT.toLowerCase();
	if(e.removeEventListener)
		e.removeEventListener(eT,eL,cap||false);
	else if(e.detachEvent)
		e.detachEvent('on'+eT,eL);
	else
		e['on'+eT]=null;
}
function xStopPropagation(evt){
	if(evt&&evt.stopPropagation)
		evt.stopPropagation();
	else if(window.event)
		window.event.cancelBubble=true;
}



function placeIt(obj)
{
	
var w = 700, h = 570;


if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  w = window.innerWidth-16;
  h = window.innerHeight-16;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  w = document.body.offsetWidth-20;
  h = document.body.offsetHeight-20;
 }
}



var popW = 700, popH = 570;

var leftPos = (w-popW)/2, topPos = 50;



	obj = document.getElementById(obj);
	if (document.documentElement)
	{
		theLeft = document.documentElement.scrollLeft;
		theTop = document.documentElement.scrollTop;
	}
	else if (document.body)
	{
		theLeft = document.body.scrollLeft;
		theTop = document.body.scrollTop;
	}
	theLeft += leftPos;
	theTop += topPos;
	obj.style.left = theLeft + 'px' ;
	
	if (theTop>50) {
	obj.style.top = theTop + 'px' ;
	}
}