/* Astrazeneca.nl Javascript */ function addFormValidation(){ //identify the form uses prototype var frm = $('frm_hcp'); //add a function to onsubmit event frm.onsubmit = function(){ return validateEOrderForm(); } } function validateEOrderForm(){ //check that the BIG number is exactly 11 digits long var re = /^\d{11}$/; var fieldValue=$('big_number').value; if(re.test(fieldValue)){ return true; }else{ //invalid BIG-number format alert('U moet een geldige BIG-Nummer invoeren (11 cijfers)'); return false; } } function moveForm(){ //uses prototype var page=$('itemid5730611'); //find the free text panel in the right hand panel which contains the form if(page){ var frm=$('frm_requestform'); if(frm){ $$('#links .free_text_panel').each(function(el){ //is el an ancestor of frm? if(frm.descendantOf(el)){ el.addClassName('content_segmentation_form'); } }); } } } function refreshPageOnce(){ //uses prototype //refresh the request form only once only if segmentation has been applied var page=$('itemid5730611'); if(page){ var href = location.href; var params = href.toQueryParams(); if(params.setSegmentation && !params.refreshed){ href+='&refreshed=true'; location.href=href; } } } 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_requestform')) { form_id[0]=document.getElementById('frm_requestform'); } 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]=addFormValidation; toCall[1]=moveForm; toCall[2]=switchPageSelect; toCall[3]=refreshPageOnce;