function toggle(div_id) {
	
	var displaywin = 0;
	var message_body = document.getElementById("messageBody");
	
	var el = document.getElementById(div_id);
	if ( el.style.display == 'none' ) {	
		el.style.display = 'block';
			if (div_id == 'popUpDiv') {
				
				//wait(1000);
				// survey_loader.asp
				message_body.innerHTML = "";
				message_body.innerHTML += " <IFRAME SRC='http://www.surveygizmo.com/s/76095/online-store' style='background-color:#f9c813' WIDTH=700 HEIGHT=800 scrolling='no' frameborder=0>"; 
				message_body.innerHTML += " </IFRAME>"; 
			}
		}
	else {
		el.style.display = 'none';
		}
}

function toggle_window(div_id) {
	
	var displaywin = 0;

	var el = document.getElementById(div_id);
	if ( el.style.display == 'none' ) {	
		el.style.display = 'block';
		}
	else {
		el.style.display = 'none';
		}
}

function blanket_size(popUpDivVar) {
	if (typeof window.innerWidth != 'undefined') {
		viewportheight = window.innerHeight;
	} else {
		viewportheight = document.documentElement.clientHeight;
	}
	if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) {
		blanket_height = viewportheight;
	} else {
		if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {
			blanket_height = document.body.parentNode.clientHeight;
		} else {
			blanket_height = document.body.parentNode.scrollHeight;
		}
	}
	var blanket = document.getElementById('blanket');
	blanket.style.height = blanket_height + 'px';
	var popUpDiv = document.getElementById(popUpDivVar);
	popUpDiv_height=blanket_height/2-150;//150 is half popup's height
	popUpDiv.style.top = popUpDiv_height + 'px';
}
function window_pos(popUpDivVar) {
	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerHeight;
	} else {
		viewportwidth = document.documentElement.clientHeight;
	}
	if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) {
		window_width = viewportwidth;
	} else {
		if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) {
			window_width = document.body.parentNode.clientWidth;
		} else {
			window_width = document.body.parentNode.scrollWidth;
		}
	}
	var popUpDiv = document.getElementById(popUpDivVar);
	window_width=window_width/2-350;//150 is half popup's width
	popUpDiv.style.left = window_width + 'px';
	popUpDiv.style.top = '0px';
	
	
	

}

var myRequest = getXMLHTTPRequest();
        
function responseAjax() {
	
	// we are only interested in readyState of 4,
	// i.e. "completed"
	if (myRequest.readyState == 4) {
		// if server HTTP response is "OK"
		if (myRequest.status == 200) {
			alert("The server said: " + myRequest.responseText);
			// myDiv1.innerHTML = myRequest.responseText;
			
		}
		else {
			// error message
			//myDiv1.innerHTML = "Error:" + myRequest.statusText;
		}
	}
}


function popup(windowname, state) {
	

	blanket_size(windowname);
	window_pos(windowname);
	toggle('blanket');
	toggle(windowname);		
	
	if (state == 0) {
		
		survey_state = 1;
		// wait(1000);
		
		// AJAX DOES NOT WORK REMOTELY WITH THIS SURVEY COMPANY
		// Build AJAX Package
  		// Build the URL of the server script we want to call
		// var url = "http://www.surveygizmo.com/s/76095/online-store";
		//var url = "http://dev.spaceboyinteractive.net/eatnpark/eshop/grabsurvey.asp";
		
		// ask our XMLHTTPRequest object to open a
		// server connection
		//myRequest.open("GET", url, true);
		// prepare a function responseAjax() to run when
		// the response has arrived.
		//myRequest.onreadystatechange = responseAjax;
		// and finallys end the request
		//myRequest.send(null);
		
		//var message_body = document.getElementById("messageBody");
		// message_body.innerHTML = "";
		//message_body.innerHTML = " <IFRAME SRC='http://www.surveygizmo.com/s/76095/online-store' style='background-color:#f9c813' WIDTH=700 HEIGHT=600 frameborder=0>"; 
		//message_body.innerHTML += " </IFRAME>"; 	
		
	}

}

function popup_window(windowname, state) {
	

	blanket_size(windowname);
	window_pos(windowname);
	toggle_window('blanket');
	toggle_window(windowname);		
	
}

function wait(msecs)
{
var start = new Date().getTime();
var cur = start
while(cur - start < msecs)
{
cur = new Date().getTime();
} 
} 
