
var visible = true;

var width_var = 45;

function showpopup(type) {
	if (type == "response") {
		document.getElementById("response").display = "block";	
	}
	else if (type == "feedback") {
		document.getElementById("feedback").display = "block";	
	}
	
	if (visible) {
		visible = false;
		document.getElementById("dl").style.display = "none";
		document.getElementById(type).style.display = "block";
		document.getElementById("popup_list").style.zIndex = "1004";
	}
	
	if (width_var < 315) {
		width_var += 5;
		
		document.getElementById("feedback_popup").style.width = width_var + 'px';
		document.getElementById("feedback_popup").style.backgroundPosition = '' + (-360 + width_var) + 'px -320px';
		
document.getElementById("popup_list").style.left = '' + (-380 + width_var) + 'px';
				
		window.setTimeout("showpopup();", 10);
	}
}

function closepopup() {
	document.getElementById("feedback_popup").style.display = "none";
}

function showthankyou() {
	document.getElementById("feedback").innerHTML = "<div class=\"inner_text\"> \
        	Thank you, your help is greatly appreciated. \
          <br /> \
        	</div> \
      		<div class=\"close\" onclick=\"closepopup();\">Close</div>";
}

function sendemail(type) {
	var xmlhttp;
	
	if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp = new XMLHttpRequest();
	}
	else {// code for IE6, IE5
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			
		}
	}

	var email_body = "";
	if (type == "positive")
		email_body = "positive_feedback";
	else if (type == "negative")
		email_body = document.getElementById("popup_data").value;
	
	var location_body = document.location;
	
	xmlhttp.open("GET","sendemail.php?body_val=" + email_body + "&location_val=" + location_body, true);
	xmlhttp.send();
}

</script>

