/*
	Astrazeneca.at Javascript - shows bodymap image map
*/
function addMasterScript(){
	//this adds in the master root.js file which includes all basic JS functionality
	//this must be included in all local js files 
	//Do not copy code from the root.js file, use this function to import it instead
	if(document.getElementById){
		//browser supports getElementById - attempt to add js functionality
		//this is a site-specific js file so include the master
		//create a script element
		if(document.createElement){
			elScript=document.createElement('script');		
			if(elScript){
				//include master file
				elScript.src='/_mshost81109/system/styles/root/javascript/root.js';
				//elScript.src='../styles/root/javascript/root.js';
				elScript.type='text/javascript';
				//get a handle to this script file
				elHead=document.getElementsByTagName('head');
				if(elHead){
					//get script
					elExistingScript=document.getElementsByTagName('script');
					if(elExistingScript){
						//add into head before previous element
						elHead[0].insertBefore(elScript,elExistingScript[0]);
						//attachEvents function is called when the master file loads 
						//so global functionality is still enabled
					}
				}
				elScript=document.createElement('script');
				//elScript.src='../styles/root/javascript/calculator.js';
				elScript.src='/_mshost81109/system/styles/root/javascript/calculator.js';
				elScript.type='text/javascript';
				if(elHead){
					//get script
					elExistingScript=document.getElementsByTagName('script');
					if(elExistingScript){
						//add into head before previous element
						elHead[0].insertBefore(elScript,elExistingScript[0]);
					}
				}				
			}
		}
	}
}	


//call the above function
addMasterScript();

function fnSwitchpage(the_form){
 	//Get the selected link URL from the dropdown
  	var link_chosen;
  	link_chosen=the_form.selection.options[the_form.selection.selectedIndex].value;	
 	//Redirect to this URL
 	window.location=link_chosen;
 	return false;
}

function switchPageSelect()
{
	//Put the Redirect forms into an array
	var form_id=new Array;
	if (document.getElementById('frm_products')) {
	form_id[0]=document.getElementById('frm_products');
	}
	if (document.getElementById('frm_products_rh')) {
	form_id[1]=document.getElementById('frm_products_rh');
	}
	if (form_id.length > 0) {
	 	for (var i = 0; i < form_id.length; i++) { 
			form_id[i].onsubmit = function () {
			// On submit tell fnSwitchpage function which form to use
				return fnSwitchpage(this); 
			}
		}
	}
}

var toCall=new Array;	
toCall[0]=switchPageSelect;

