/*
	Copyright David Trewern Design         :: www.dtdesign.com ::
	Unauthorised modification / use is a criminal offence, and
	will be prosecuted to the fullest extent permitted by law.
	All Rights Reserved
*/

NAVarr = new Array("home", "aboutus", "products", "research", "mediacentre", "community", "careers", "contactus");
if (document.images) {
	for (var NAVitem in NAVarr) { 
		 for (var NAVicount=0; NAVicount < 2; NAVicount++) { 
				eval("b" + NAVarr[NAVitem] + NAVicount + " = new Image()");
				eval("b" + NAVarr[NAVitem] + NAVicount + ".src = 'assets/swap_" + NAVarr[NAVitem] + "_" + NAVicount + ".gif'");
		 } 
	} 
}

function BturnOn(imageName) {
	if (document.images) { document [imageName].src = eval("b" +imageName + "1.src");   }
}

function BturnOff(imageName) {
	if (document.images) { document [imageName].src = eval("b" + imageName + "0.src");   }
}

function imgPopup(path) {
	if (path) {
		window.open("utils_imagepopup.aspx?path=" + path, "popup", "width=400, height=300, toolbar=no, status=no, scrollbars=yes, resizable=yes");
	}
}

function vidPopup(path) {
	if (path) {
		window.open(path, "vidpopup", "width=450, height=420, toolbar=no, status=no, scrollbars=no, resizable=no");
	}
}
function launchPopup(path) {
	if (path) {
		window.open(path, "GSK", "width=800, height=600, toolbar=no, status=no, scrollbars=yes, resizable=yes");
	}
}

function ddRedirect(dd) {
	if (dd.options[dd.selectedIndex].value != "") self.location = dd.options[dd.selectedIndex].value;
}


function ddBrandsRedirect(dd) {
	if (dd.options[dd.selectedIndex].value != "0")
	     self.location = "products_consumer-healthcare-products_product-listing.aspx?view=" + dd.options[dd.selectedIndex].value;
}

function ddPrescriptionsRedirect(dd) {
	if (dd.options[dd.selectedIndex].value != "0")
	     self.location = "products_prescription-medicines_detail.aspx?view=" + dd.options[dd.selectedIndex].value;
}

function ddClinicalTrialsRedirect(dd) {
	if (dd.options[dd.selectedIndex].value != "0")
	     self.location = "research-development_clinical-trials_current_detail.aspx?view=" + dd.options[dd.selectedIndex].value;
}

function ddVacccinesRedirect(dd) {
	if (dd.options[dd.selectedIndex].value != "0")
	     self.location = "products_vaccines_detail.aspx?view=" + dd.options[dd.selectedIndex].value;
}


function ddConditionsRedirect(dd) {
	if (dd.options[dd.selectedIndex].value != "0")
	     self.location = "products_conditions_detail.aspx?view=" + dd.options[dd.selectedIndex].value;
}


function CareersApply_Toggle(CoverLetterorResume, FileOrText) {

	var f = document.getElementById("Div_" + CoverLetterorResume + "_File");
	var t = document.getElementById("Div_" + CoverLetterorResume + "_Text");
	
	if (FileOrText == "File") {
		f.style.display = "block";
		t.style.display = "none";
	}
	else {
		f.style.display = "none";
		t.style.display = "block";
	}

}

function CareersApply_TalentPool(state) {
	var t = document.getElementById("Div_TalentPool");
	
	if (state) {
		t.style.display = "block";
	}
	else {
		t.style.display = "none";
	}
}


function CareersApply_AddResumeAnchor() {
	var f = document.forms[1];
	
	if (f.action.indexOf("#resume") == -1) {
		f.action += "#resume";
	}
}

function restricttextarea(obj, characterlength)
{
	var maxlength = characterlength;

	if (obj.value.length > maxlength)
	{
		obj.value = obj.value.substring(0, maxlength);
	}
	else
	{
		document.getElementById("Comment").innerHTML = maxlength - obj.value.length;
	}
}



//<!-- Original:  Ronnie T. Moore -->
//<!-- Web Site:  The JavaScript Source -->

//<!-- Dynamic 'fix' by: Nannette Thacker -->
//<!-- Web Site: http://www.shiningstar.net -->

//<!-- This script and many more are available free online at -->
//<!-- The JavaScript Source!! http://javascript.internet.com -->

//<!-- Begin

function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}

// End -->
