PositionX = 50;
PositionY = 50;
defaultWidth  = 1000;
defaultHeight = 750;
var AutoClose = false;

/*var isFF=(navigator.userAgent.indexOf("Firefox")!=-1)?1:0;*/

if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
	if (isNN){imgWin=window.open('about:blank','',optNN);}
	if (isIE){imgWin=window.open('about:blank','',optIE);}
	with (imgWin.document){
		writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
		writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
		writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
		writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(300,300);');
		writeln('width=300-(document.body.clientWidth-document.images[0].width);');
		writeln('height=300-(document.body.clientHeight-document.images[0].height);');
		writeln('window.resizeTo(width,height);}');writeln('if (isNN){');
		writeln('window.innerWidth=document.images["productimage"].width;');writeln('window.innerHeight=document.images["productimage"].height;}}');
		writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
		if (!AutoClose) writeln('</head><body style="overflow:scroll;" bgcolor=000000 scroll="yes" onload="reSizeToImage();doTitle();self.focus()">')
		else writeln('</head><body style="overflow:scroll;" bgcolor=000000 scroll="yes" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
		writeln('<a href=\'javascript:window.close()\'><img name="productimage" id="productimage" src='+imageURL+' style="display:block;" border="0"></a></body></html>');
		/* width:800px; height:auto; */
		close();
	}
}

function getHouse() {
	return document.getElementById("swf_house");
}
function playProduct(id) {
	getHouse().playProduct(id);
}
function playColor(id) {
	getHouse().playColor(id);
}

function toggle(id){
	if (document.getElementById){
		var el = document.getElementById(id);
		el.style.display = (el.style.display == 'none') ? 'block' : 'none';
	}
}

function centerPopup(windowHeight, windowWidth, windowName, windowUri) {
    var centerWidth = (window.screen.width - windowWidth) / 2;
    var centerHeight = (window.screen.height - windowHeight) / 2;
    newWindow = window.open(windowUri, windowName, 'resizable=0,width=' + windowWidth + ',height=' + windowHeight + ',left=' + centerWidth + ',top=' + centerHeight);
    newWindow.focus();
    return newWindow.name;
}

function showhide(id){
	if (document.getElementById(id)){
		obj = document.getElementById(id);
		if (obj.style.display == "none"){
			obj.style.display = "";
		}
		else {
			obj.style.display = "none";
		}
	}
	else {}
}

if(window.XMLHttpRequest){
	http = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
	http=new ActiveXObject("Msxml2.XMLHTTP");
   	if (! http){
       		http=new ActiveXObject("Microsoft.XMLHTTP");
   	}
}

function replaceDiv(link, where, what) {
	toggleLayer('commentForm');
	http.abort();
	http.open("GET", link + what, true);
	http.onreadystatechange=function() {
   		if(http.readyState == 4 && http.status == 200) {
			document.getElementById(where).innerHTML = http.responseText;
		}
	}
	http.send(null);
	toggleLayer('commentForm');
}



function AjaxInit() {
	var XMLHttpRequestObject = false;
	if (window.XMLHttpRequest) {XMLHttpRequestObject = new XMLHttpRequest();}
	else if (window.ActiveXObject) {ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");}
	else if (window.ActiveXObject) {XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");}
}

function getData(dataSource, divID) {
	var XMLHttpRequestObject = false;
	if (window.XMLHttpRequest) {XMLHttpRequestObject = new XMLHttpRequest();}
	else if (window.ActiveXObject) {XMLHttpRequestObject = new ActiveXObject("Msxml2.XMLHTTP");}
	else if (window.ActiveXObject) {XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");}

	if(XMLHttpRequestObject) {
		var obj = document.getElementById(divID);
		XMLHttpRequestObject.open("GET", dataSource);
		XMLHttpRequestObject.onreadystatechange = function() {
			if (XMLHttpRequestObject.readyState == 4 &&	XMLHttpRequestObject.status == 200) {
				obj.innerHTML = XMLHttpRequestObject.responseText;
			}
		}
		XMLHttpRequestObject.send(null);
	}
}

//ajaxget('selfid','catDropdowns.php?kind=','id','target');
function ajaxget(s_id, s_url, s_ret, show_id) {
	var url = s_url + s_ret;
	getData(url, show_id);
}