//////////////////////////////////////////////////////////////////////////////////////////////////
function on_load()
//////////////////////////////////////////////////////////////////////////////////////////////////
{
if(has_survey=="N") 
{
	document.getElementById("row_survey_link").style.display = "none";
	divPanelHeight				= 165;
}

var obj_divSpacer_top, obj_divTitle, obj_divPanel;
var screenWidth 				= getClientWidth();
var screenHeight 				= getClientHeight();
var divSpacer_top_height 			= ((screenHeight - divTitleHeight - divPanelHeight) / 2) * .75;
var divPanel_left				= (screenWidth / 2) - (960 / 2);

if(divSpacer_top_height<0) divSpacer_top_height = 0;

obj_divSpacer_top				= document.getElementById("divSpacer_top");
obj_divTitle					= document.getElementById("divTitle");
obj_divPanel					= document.getElementById("divPanel");

obj_divSpacer_top.style.height 			= divSpacer_top_height + "px";
obj_divSpacer_top.style.left 			= divPanel_left + "px";
obj_divTitle.style.left 			= divPanel_left + "px";
obj_divPanel.style.left 			= divPanel_left + "px";
obj_divTitle.style.height 			= divTitleHeight + "px";
obj_divPanel.style.height 			= divPanelHeight + "px";

//	load logo

var navbar_image_width				= "";
var navbar_image_dims				= "";	
var navbar_login_image				= document.getElementById("navbar_login_image"); 

var navbar_image_height 			= 200;
var vertical_adjustment				= navbar_image_height * .25;

navbar_image_height 				-= vertical_adjustment; 

var logo_src 					= "upload_file_image_show_get.asp?agencyid=" + myagencyid + "&width=";
logo_src 					+= navbar_image_width + "&dims=" + navbar_image_dims + "&filename=" + myagencylogo;
logo_src 					+= "&filetype=LOGO&align=right&link=" + myagencylink;
//alert(logo_src);
navbar_login_image.src				= logo_src;

$('.divPanel').corners("15px");

obj_divSpacer_top.style.visibility		= "";
obj_divTitle.style.visibility			= "";
obj_divPanel.style.visibility			= "";

if(is_valid_cid=="N") cid 			= "";
if(upload_complete=="Y") on_complete_post_upload();
if((survey_complete=="Y")&&(survey_updated_post_complete=="N")) on_complete_post_survey();
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
function on_tb_error(error_code)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
{
tb_remove();
if (error_code=="1001") strUrl 			=  "content/content_ajax_unknown_error.html?";
else if(error_code=="1002") strUrl 		=  "content/content_ajax_timeout_error.html?";
else if(error_code=="1003") strUrl 		=  "content/content_ajax_authentication_error.html?";
else strUrl 					=  "content/content_ajax_unknown_error.html?";
strUrl 						+= "datehack=" + new Date().getTime() + "&"; 
strUrl 						+= "height=200&width=350";
//alert(strUrl);
tb_show("Loading Error",strUrl);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
function show_spec()
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
{
//alert("function start: element_selected");

var strUrl;
var TBheight;
var TBwidth;
var TBtitle;

TBwidth 					= 960;
TBheight 					= getClientProperty("","height") * .7;

strUrl 						=  "job_description_show.asp?";
strUrl 						+= "jid=" + jid + "&";
strUrl 						+= "logid=" + logid + "&";
strUrl 						+= "datehack=" + new Date().getTime() + "&"; 
strUrl 						+= "height=" + TBheight + "&width=" + TBwidth;

TBtitle = "Job Description: " + jname;
tb_show(TBtitle,strUrl);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
function upload_details()
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
{
//alert("function start: element_selected");

var strUrl;
var TBheight;
var TBwidth;
var TBtitle;

TBwidth 					= 960;
TBheight 					= getClientProperty("","height") * .8; 
if(TBheight>340) TBheight 			= 340;

strUrl 						=  "candidate_upload2.asp?";
strUrl 						+= "jid=" + jid + "&";
strUrl 						+= "cid=" + cid + "&";
strUrl 						+= "logid=" + logid + "&";
strUrl 						+= "calling_page=apply&";
strUrl 						+= "datehack=" + new Date().getTime() + "&"; 
strUrl 						+= "height=" + TBheight + "&width=" + TBwidth;

TBtitle = "Upload your Details";
tb_show(TBtitle,strUrl);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
function upload_survey()
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
{
//alert("function start: element_selected");
if(upload_complete=="N")
{
alert("Please complete Step 1 first");
}
else
{
var strUrl;
var newJobWin;
var TBheight;
var TBwidth;
var TBtitle;

TBwidth 					= 960; 
TBheight 					= getClientProperty("","height") * .8; 

strUrl 						=  "job_evaluation_new.asp?";

strUrl 						+= "jid=" + jid + "&";
strUrl 						+= "cid=" + cid + "&";
strUrl 						+= "logid=" + logid + "&";
strUrl 						+= "calling_page=apply&";
strUrl 						+= "datehack=" + new Date().getTime() + "&"; 
strUrl 						+= "height=" + TBheight + "&width=" + TBwidth;

TBtitle = "Upload your Details";
tb_show(TBtitle,strUrl);
}
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
function complete_application()
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
{
//alert("function start: element_selected");

if(upload_complete=="N")
{
	alert("Please complete Step 1 first");
}
else if((has_survey=="Y")&&(survey_complete=="N"))
{
	alert("Please complete Step 2 first");
}
else
{
var strUrl;
var TBheight;
var TBwidth;
var TBtitle;

if(has_survey=="Y")
{
TBwidth 					= 960;
TBheight 					= getClientProperty("","height") * .7;
strUrl 						=  "job_evaluation_show_summary.asp?";
strUrl 						+= "jid=" + jid + "&";
strUrl 						+= "cid=" + cid + "&";
strUrl 						+= "logid=" + logid + "&";
strUrl 						+= "datehack=" + new Date().getTime() + "&"; 
strUrl 						+= "height=" + TBheight + "&width=" + TBwidth;
}
else
{
TBwidth 					= 450;
TBheight 					= 300;
strUrl 						=  "apply_complete.asp?";
strUrl 						+= "jid=" + jid + "&";
strUrl 						+= "cid=" + cid + "&";
strUrl 						+= "logid=" + logid + "&";
strUrl 						+= "datehack=" + new Date().getTime() + "&"; 
strUrl 						+= "height=" + TBheight + "&width=" + TBwidth;
}

//TBtitle = "";
//tb_show(TBtitle,strUrl);

strUrl 						=  "apply_confirmation.asp?";
strUrl 						+= "jid=" + jid + "&";
strUrl 						+= "cid=" + cid + "&";
strUrl 						+= "logid=" + logid + "&";
strUrl						+= "calling_page=APPLY" + "&";
strUrl 						+= "datehack=" + new Date().getTime();

document.location = strUrl;
}
}

$(document).ready(function(){
    on_load();
});

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
function on_mouseover_link(me)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
{
me.style.color = "#669900";
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
function on_mouseout_link(me)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
{
me.style.color = "#666666";
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
function on_complete_post_upload()
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
{
document.getElementById("upload_lnk_status").src="images/apply-48_wht.png";
document.getElementById("survey_lnk").src="images/Document-Gant-Chart-icon_wht.png";
upload_complete = "Y";
if(has_survey=="N") document.getElementById("div_button").className="clear_btn clear_btn_submit";
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
function on_complete_post_survey()
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
{
document.getElementById("survey_lnk_status").src="images/apply-48_wht.png";
document.getElementById("survey_lnk").src="images/Document-Gant-Chart-icon_wht.png";
survey_complete	= "Y";
document.getElementById("div_button").className = "clear_btn clear_btn_submit";
}

//////////////////////////////////////////////////////////////////////////////////////////////////
function goto_link()
//////////////////////////////////////////////////////////////////////////////////////////////////
{
var str_url			= myagencylink;
if(myagencylink!="")
{
	if(myagencylink.substr(0,7)!="http://") str_url = "http://" + myagencylink;
	var new_width		= screen.availWidth;
	var new_height		= screen.availHeight;
	var parameters		= "resizable=yes,scrollbars=yes,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes";
	window.open(str_url,"mywindow","width=" + new_width + ",height=" + new_height + "," + parameters)
}
}
