var pflash = null;
var search_zindex = 3;

function openPopupWindow(value) {
	var posx = dd.getWndW()/2-195+dd.getScrollX();
	var posy = dd.getWndH()/2-160+dd.getScrollY();
	var h, title;
	
	switch(value) {
		case "whatisctindex": h = 254; title='What is CTindex'; break;
		case "howtouse": h = 274; title='How to use'; break;
		case "getlisted": h = 384; title='Get Listed'; break;
		case "contactus": h = 360; title='Contact Us'; break;
	}
	writeFlash(document.getElementById("content"), "/ctindex/popup/"+ value + ".swf", h);	
	dd.elements.popup_window.show();
	dd.elements.popup_window.moveTo(posx, posy);	
	dd.elements.content.resizeTo(391, h+3);
	dd.elements.window_title.write(title);
}

function writeFlash(obj, myurl, h) {
	if(pflash != null) obj.removeChild(pflash);
	pflash = document.createElement("embed");
	
	pflash.src = myurl;
	pflash.width = 385;
	pflash.height = h;
	obj.appendChild(pflash);
}

function closePopupWindow(){
	obj = document.getElementById("content");
	if(pflash != null){ 
		obj.removeChild(pflash);
		pflash = null;
	}
	dd.elements.popup_window.hide(true);
}

function bringForward() {
	if(search_zindex == 9) return;
	document.getElementById("searchBrowse").style.zIndex = 9;
	document.getElementById('iehide').style.zIndex = 7;
	search_zindex = 9;
}

function sendBackward() {
	if(search_zindex == 3) return;
	document.getElementById("searchBrowse").style.zIndex = 3;
	document.getElementById('iehide').style.zIndex = 2;
	search_zindex = 3;
}

function isOldIE(){
	var browsername = navigator.appVersion;
	var pattern = /MSIE\s\d\.\d/gi;
	var result = browsername.match(pattern);
	if(result){
		return parseFloat(result.toString().substr(5));
	} else return 7;
}