/* Browser check */
IS_DOM = (document.getElementById) ? true : false;
IS_IE = (document.all) ? true : false;
IS_IE50 = (navigator.userAgent.indexOf("IE 5.0") != -1);
IS_Mac = (navigator.appVersion.indexOf("Mac") != -1);
IS_IE5Mac = IS_IE && IS_Mac && IS_DOM;

/* Rollover Functions */
// image swapper
function changeImages() 
{
  if (IS_DOM) {
    for (var i = 0; i < changeImages.arguments.length; i += 2) { 
  		document.getElementById(changeImages.arguments[i]).src = eval(changeImages.arguments[i + 1] + ".src"); 
	}
  }
}

/* Image preloads */
aConstants = new Array();
aConstants = ["search","contact","careers","sitemap","extranet","proposal"];
for (i = 0; i < aConstants.length; i++) {
	eval("C"+i+"on = new Image();"); eval("C"+i+"off = new Image();");
	eval("C"+(i)+"on.src = \"" + sFolderLevel + "images/btns/cnst-"+aConstants[i]+"-r.gif\";");
	eval("C"+(i)+"off.src = \"" + sFolderLevel + "images/btns/cnst-"+aConstants[i]+"-0.gif\";");
}

function popPort(file) {
  windowAttributes = "top=52,left=72,width=710,height=481"
  window.open(file,"portfolioWindow",windowAttributes)
}
function popWin(file) {
  windowAttributes = "top=52,left=72,width=320,height=450"
  window.open(file,"Leadership",windowAttributes)
}

function openPortfolioForm(sSelectName)
{
	oForm = document.forms["ourWorkPortfolio"];
	oSelector = oForm.elements[sSelectName];
	sURL = oSelector.options[oSelector.selectedIndex].value;
	
	if (sURL != "") {
        //var w = screen.availWidth;
        //var h = screen.availHeight;
		//newwin = window.open(sURL,"main_win","scrollbars=0,resizable=no,location=no,menubar=no,status=no,left=0,top=0");
		//newwin.resizeTo(w,h);
		//newwin.focus();
	    window.location = sURL;
	}
}

function cancelButton() {
	window.history.go(-1);
}

function OpenWindow(sPath, iHeight, iWidth ) {
	var winName = "newWind" + Math.round(Math.random() * 9999999);
	window.open(sPath, winName, 'height=' + iHeight + ',width=' + iWidth + ',scrollbars,resizable,top=20,left=20')
}

function OpenCaseStudy(sPath, iHeight, iWidth ) {
	var winName = "newWind" + Math.round(Math.random() * 9999999);
	window.open(sPath, winName, 'height=' + iHeight + ',width=' + iWidth + ',scrollbars,resizable=no,top=20,left=20')
}

function handleNewsLink(sURL)
{
	if (sURL.indexOf("http") != -1) {
		OpenWindow(sURL, 750, 550);
	} else {
		window.location = sURL;
	}
}

function openPortfolio(file_path) {
    var w = screen.availWidth;
    var h = screen.availHeight;
	//newwin = window.open(file_path,"main_win","scrollbars=0,resizable=no,location=no,menubar=no,status=no,left=0,top=0");
	//newwin.resizeTo(w,h);
	//newwin.focus();
	window.location = file_path;
}

function openAccessibility(file_path) {
	newwin = window.open(file_path,"main_win","width=600,height=500,scrollbars=yes,resizable=yes,status=yes,left=25,top=25");
	newwin.focus();
}

// Services - Content Developmjent DHTML
function changeDisplayState(sBoxId,sLinkId)
{
	if (document.getElementById) {
		oBox = document.getElementById(sBoxId);
		oLink = document.getElementById(sLinkId);
		if (oBox.style.display == "block"){
			oBox.style.display = "none";
			oLink.className = "off";
		}
		else {
			oBox.style.display = "block";
			oLink.className = "on";
		}
	}
}

var aryRejectionMessages = new Array();

function loadRejectionMessages() {

	aryRejectionMessages[0] = "";
	aryRejectionMessages[1] = "Dear Applicant,\n\nThank you for taking the time to speak with us. We have reviewed your resume and unfortunately we do not feel you would be the best fit for this position at this time.\n\nAs PixelMEDIA expands, we are continually reviewing submitted applications for possible candidates. We encourage you to submit an updated resume at any time as your qualifications evolve.\n\nThank you.\nPixelMEDIA, Inc.\nGayle L. Henderson\nDirector of Human Resources\n";
	aryRejectionMessages[2] = "Dear Applicant,\n\nThank you for your interest in employment at PixelMEDIA, Inc. We have reviewed your resume and unfortunately your qualifications do not meet the current job requirements. We will contact you in the future if any of your qualifications meet the requirements of new positions as they become available.\n\nAs PixelMEDIA expands, we are continually reviewing submitted applications for possible candidates. We encourage you to submit an updated resume at any time as your qualifications evolve.\n\nThank you.\nPixelMEDIA, Inc.\nGayle L. Henderson\nDirector of Human Resources\n";
	aryRejectionMessages[3]= "Dear Applicant,\n\nThank you for your interest in employment at PixelMEDIA, Inc. We have reviewed your resume and though we are thoroughly impressed with your qualifications, unfortunately there are no positions left available for which you are applying.\n\nAs PixelMEDIA expands, we are continually reviewing submitted applications for possible candidates. We encourage you to submit an updated resume as both your work experience and qualifications evolve, as we would like to be able to contact you in the future if any new positions become available.\n\nThank you,\nPixelMEDIA, Inc.\nGayle L. Henderson\nDirector of Human Resources\n";
	aryRejectionMessages[4] = "Dear Applicant,\n\nThank you for taking the time to come in and meet with us. We have reviewed your resume and unfortunately your qualifications do not meet the current job requirements. We will contact you in the future if any of your qualifications meet the requirements of new positions as they become available.\n\nAs PixelMEDIA expands, we are continually reviewing submitted applications for possible candidates. We encourage you to submit an updated resume at any time as your qualifications evolve.\n\nThank you.\nPixelMEDIA, Inc.\nGayle L. Henderson\nDirector of Human Resources\n";
	aryRejectionMessages[5] = "Dear Applicant,\n\nThank you for your interest in employment at PixelMEDIA, Inc. We have reviewed your resume and though we are impressed with your qualifications, unfortunately we do not feel you would be the best fit for this position at this time.\n\nAs PixelMEDIA expands, we are continually reviewing submitted applications for possible candidates. We encourage you to submit an updated resume as both your work experience and qualifications evolve, as we would like to be able to contact you in the future if any new positions become available.\n\nThank you,\nPixelMEDIA, Inc.\nGayle L. Henderson\nDirector of Human Resources\n";
	aryRejectionMessages[6] = "";

}

function switchRejectionMessages() {
	objStatusBox = document.getElementById("app_status");
	objReasonsBox = document.getElementById("rejection_reason");
	objEmailMessage = document.getElementById("email_message");

	if (objStatusBox.value == "Rejected") {
		objEmailMessage.value = aryRejectionMessages[objReasonsBox.selectedIndex];
	} else {
		objReasonsBox.selectedIndex = 0;
	}
}

function clearComments() {
	objStatusBox = document.getElementById("app_status");
	objReasonsBox = document.getElementById("rejectionReason");
	objCommentsBox = document.getElementById("comments");
	objEmailMessage = document.getElementById("emailMessage");
	objReasonsBox.style.display = "none";
	objEmailMessage.style.display = "none";

	if (objStatusBox.value == "Rejected") {
		objCommentsBox.value = "";
		document.getElementById("rejection_reason").selectedIndex = 0;

		objReasonsBox.style.display = "block";
		objEmailMessage.style.display = "block";
	}
}

function clearPublishAddressForm() {

	theForm = document.forms.thisForm;
	shadedColor = "#CFCFCF";
	regularColor = "#FFFFFF";

	if (theForm.useBillingAddress_for_published.checked == true) {
	theForm.published_address_1.value = "";
	theForm.published_address_2.value = "";
	theForm.published_city.value = "";
	theForm.published_state.value = "";
	theForm.published_zip.value = "";
	
	theForm.published_address_1.style.backgroundColor = shadedColor;
	theForm.published_address_2.style.backgroundColor = shadedColor;
	theForm.published_city.style.backgroundColor = shadedColor;
	theForm.published_state.style.backgroundColor = shadedColor;
	theForm.published_zip.style.backgroundColor = shadedColor;
	}
	
	if (theForm.useBillingAddress_for_published.checked == false) {
	theForm.published_address_1.style.backgroundColor = regularColor;
	theForm.published_address_2.style.backgroundColor = regularColor;
	theForm.published_city.style.backgroundColor = regularColor;
	theForm.published_state.style.backgroundColor = regularColor;
	theForm.published_zip.style.backgroundColor = regularColor;
	}

}