/*   search box script  */

	NS4 = (document.layers) ? true : false;
	
	function fDoSearch(){
		var tmpString = document.frmSearch.target.value;
		if (tmpString.length < 1){
			alert('The search criteria should consist of minimum 2 characters.');
			}
		else{	
			fSubmitForm();
			}
		}
	
	function fSubmitForm(){
		document.frmSearch.submit();
	}
	
	
	function fCheckEnter(){
		var code = 0;
	
		if (NS4)
			code = event.which;
		else
			code = event.keyCode;
		if (code==13)
		    fDoSearch();
			
		}



/*
Version: 1.1
Date: Oct 16 2003
Author : Pascal Vermeulen - pascal@thecyberfactory.be
Purpose : Display warning if the user has clicked on an external link. User can choose to stay or continue.

Copyright ©2003-2004 The Cyber Factory
*/


//if (document.layers) {
//	document.captureEvents(Event.CLICK);
	//document.onclick;
//	}
document.onclick = function (evt) {
	//alert('global routine');
	var target = document.all ? event.srcElement : evt.target;
	if (target.href) {
		if (target.href.indexOf('http') >= 0) {
			//alert("target.href.indexOf('jnj.com') = " + target.href.indexOf('jnj.com'))
			if(!fIsCorpSite(target.href)){
				return confirm(fBuildAlert(target.href));
			}
		}
		else if (target.href.indexOf('mailto') >= 0){
			if(fIsCorpMail(target.href)){
				return confirm(fBuildEmailAlert());
			}
		}
	}
}
		

function fDHTMLMenuClick(strUrl, strTarget){
	//alert('menu click');
	//alert(strUrl + ' - ' + strTarget);
	if(!fIsCorpSite(strUrl)){
		var return_value = confirm(fBuildAlert(strUrl));
		if(return_value == true){
			window.open(strUrl,strTarget);
		}
		else{
			return false;
		}
	}
	else{
		window.open(strUrl, strTarget);
	}
}

function fBuildEmailAlert(){
	//return 'Door dit e-mailbericht te versturen stemt u ermee in dat de informatie die u erin verstrekt gebruikt wordt in overeenstemming met het privacybeleid van onze site.';
	return 'By submitting the information in this e-mail message, you agree that the information you provide will be governed by our site\'s privacy policy.';

}


function fBuildAlert(strUrl){
	//return 'U verlaat deze site. \n\nDe link hieronder bevat de informatie die u gevraagd hebt. \nDe informatie staat op een andere website.\n\nU kunt op de link klikken om de volledige informatie te bekijken.\n\nDeze link brengt u naar een website waarop ons privacybeleid niet van toepassing is.\nU bent geheel zelf verantwoordelijk voor uw interactie met die website.\n\nKlik op OK om naar ' + strUrl + ' te gaan\nof klik op ANNULEREN om op deze site te blijven.';
	return 'You are leaving this site. \n\nThe link below contains the information you have requested,\nwhich is on another Website.\n\nYou may click on the link to access the complete information you need.\n\nThis link will take you to a site to which this privacy policy does\nnot apply. You are solely responsible for your interaction \nwith that Website.\n\nClick OK to continue to ' + strUrl + '\nor click CANCEL to stay on the current site.'
}


function fIsCorpMail(strMailto){
	var arrMailAddr = new Array;
	var checkOK = false;
	arrMailAddr[0] = "info@janbe.jnj.com";

	for(count=0;count<=arrMailAddr.length-1;count++){
		if(strMailto.indexOf(arrMailAddr[count]) >= 0){
			//found corporate e-mail
			checkOK = true;
		}
	}
	return checkOK;
}


function fIsCorpSite(strUrl){
	var arrSites = new Array;
	var checkOK = false;
	arrSites[0] = "janssenpharmaceutica.be";
	arrSites[1] = "janssenpharmaceutica-be.staging.be.jnj.com";
	arrSites[2] = "192.168.1.162"; // TCF dev server
	arrSites[3] = "localhost"; //dev server
	arrSites[4] = "wjanbebe106386"; //dev server
	arrSites[5] = "www.thecyberfactory.be"; //dev server

	for(count=0;count<=arrSites.length-1;count++){
		if(strUrl.indexOf(arrSites[count]) >= 0){
			//found link to corporate or development server
			checkOK = true;
		}
	}
	return checkOK;
}



