﻿var surveyStatus = 0;

function loadSurvey(){

	if(surveyStatus==0){
		$("#backgroundSurveyPrompt").css({
			"opacity": "0.9"
		});
		
		getid("backgroundSurveyPrompt").innerHTML = '<table border="0" width="100%" height="100%"><tr><td width="100%" height="100%"><!-- --></td></tr></table>';
		SURVEY_set_size();
		$("#backgroundSurveyPrompt").fadeIn("slow");
		$("#SurveyPromptContact").fadeIn("slow");
		window.onresize = SURVEY_set_size;
		
		surveyStatus = 1;
	}
}

function disableSurvey(){
	if(surveyStatus==1){
		$("#backgroundSurveyPrompt").fadeOut("slow");
		$("#SurveyPromptContact").fadeOut("slow");
		
		
		surveyStatus = 0;
	}
}

function centerSurvey(){

	var windowWidth = document.body.clientWidth;
	var windowHeight = document.body.clientHeight;
	var surveyHeight = $("#SurveyPromptContact").height();
	var surveyWidth = $("#SurveyPromptContact").width();

	$("#SurveyPromptContact").css({
		"position": "absolute",
		"top": "30px",//windowHeight/2-popupHeight/2,
		"left": windowWidth/2-surveyWidth/2
	});
	
	$("#backgroundSurveyPrompt").css({
		"height": windowHeight
	});
	
}
function SURVEY_set_size(){
	var docSize = xDocSize();
	var w       = docSize.w;
	var h       = docSize.h;
	getid("backgroundSurveyPrompt").style.width  = w + "px";
	getid("backgroundSurveyPrompt").style.height = h + "px";
}

$(document).ready(function(){
	

/*	$("#survey_btn_1").click(function(){
		//disableSurvey();
		if(document.location.href.indexOf('?') == -1){
			document.location.href = document.location.href + "?p_s_a=t";
		}else{
			document.location.href = document.location.href + "&p_s_a=t";
		}
	});		/*
	$("#survey_btn_2").click(function(){
//		disableSurvey();
		if(document.location.href.indexOf('?') == -1){
			document.location.href = document.location.href + "?p_s_a=t";
		}else{
			document.location.href = document.location.href + "&p_s_a=t";
		}
	});		
	$("#survey_btn_3").click(function(){
	//	disableSurvey();
		if(document.location.href.indexOf('?') == -1){
			document.location.href = document.location.href + "?p_s_a=t";
		}else{
			document.location.href = document.location.href + "&p_s_a=t";
		}	
	});*/
});