var globalX = 0 // mouse coords for external functions
var globalY = 0 // mouse coords for external functions
loggedIn = true; //if user is logged in or not.

var dtCh	= "-";
var minYear	= 1900;
var maxYear	= 2100;

function dmousemove(e) {
	if (bIE) e = event;
	var x = (bNS || is_nav6)? e.pageX : event.clientX+document.body.scrollLeft
	var y = (bNS || is_nav6)? e.pageY : event.clientY+document.body.scrollTop
	globalX = x
	globalY = y
	if (currLyr != '') {
		if (x > (currLyr.left + currLyr.width) || y < dMainMenu.top || y > (dMainMenu.top + dMainMenu.height)) {
			resetLyrs()
			currLyr = '';
		}
	}
}


function checkEventFilter()
{
	intStartDay		= '01';
	intEndDay		= 31;
	if(document.all['cyear'])
	{
		intYear		= document.all['cyear'].value;
	}
	else
	{
		intYear		= document.all['year'].value;
	}
	intMonth		= document.all['month'].value;
	intDay			= document.all['day'].value;
	intcMonth		= document.all['cmonth'].value;
	if (document.all['subjectarea']) strSubjectArea	= document.all['subjectarea'].value;

	if(document.all['cyear'].value == 0)
	{
		intEndYear = document.all['cyear'].options[1].value;
	}
	/*
	alert('intYear : ' + intYear);
	alert('intMonth : ' + intMonth);
	alert('intcMonth : ' + intcMonth);
	alert('intDay : ' + intDay);
	*/
	
	
	if(intDay.length == 1)
	{
		intDay = '0' + intDay;
	}
	
	if(intYear == 0)
	{
		intcMonth = 13;
	}
	
	if(intcMonth == 13)
	{
		if(intMonth.length == 1)
		{
			intMonth = '0' + intMonth;
		}
		if(intYear == 0)
		{
			strStartDate	= '1998' + '-01-' + intStartDay;
		}
		else
		{
			strStartDate	= intYear + '-01-' + intStartDay;
		}
		
		d = new Date();
		if(intYear == d.getFullYear())
		{
			strEndDate	= intYear + '-' + '12' + '-' + intDay;
		}
		else
		{
			if(intYear == 0)
			{
				//strEndDate	= d.getFullYear() + '-' + '12' + '-' + intEndDay;
				strEndDate	= intEndYear + '-' + '12' + '-' + intEndDay;
				intYear = d.getFullYear()
			}
			else
			{
				strEndDate	= intYear + '-' + '12' + '-' + intEndDay;
			}
		}
		if(!isDate(strEndDate))
		{
			I = 1;
			do
			{
				strEndDate	= intYear + '-' + 12 + '-' + (intEndDay - I);
				I++;
			}
			while(isDate(strEndDate) == false)
		}
	}
	
	if(intcMonth != 13)
	{
		if(intMonth.length == 1)
		{
			intMonth = '0' + intMonth;
		}
		strStartDate	= intYear + '-' + intcMonth + '-' + intStartDay;
		strEndDate		= intYear + '-' + intcMonth + '-' + intEndDay;

		if(!isDate(strEndDate))
		{
			I = 1;
			do
			{
				strEndDate	= intYear + '-' + intcMonth + '-' + (intEndDay - I);
				
				I++;
			}
			while(isDate(strEndDate) == false)
		}
	}

	document.all['startdate'].value			= strStartDate;
	document.all['enddate'].value			= strEndDate;
	
	//alert(strStartDate+' | '+strEndDate);
	//alert(strEndDate);
	
	makeChannelFilter()
}

function checkFilter()
{
	intStartDay		= '01';
	intEndDay		= 31;
	if(document.all['cyear'])
	{
		intYear		= document.all['cyear'].value;
	}
	else
	{
		intYear		= document.all['year'].value;
	}
	intMonth		= document.all['month'].value;
	intDay			= document.all['day'].value;
	intcMonth		= document.all['cmonth'].value;
	if (document.all['subjectarea']) strSubjectArea	= document.all['subjectarea'].value;
	
	/*
	alert('intYear : ' + intYear);
	alert('intMonth : ' + intMonth);
	alert('intcMonth : ' + intcMonth);
	alert('intDay : ' + intDay);
	*/
	
	
	if(intDay.length == 1)
	{
		intDay = '0' + intDay;
	}
	
	if(intYear == 0)
	{
		intcMonth = 13;
	}
	
	if(intcMonth == 13)
	{
		if(intMonth.length == 1)
		{
			intMonth = '0' + intMonth;
		}
		if(intYear == 0)
		{
			strStartDate	= '1998' + '-01-' + intStartDay;
		}
		else
		{
			strStartDate	= intYear + '-01-' + intStartDay;
		}
		
		d = new Date();
		if(intYear == d.getFullYear())
		{
			strEndDate	= intYear + '-' + intMonth + '-' + intDay;
		}
		else
		{
			if(intYear == 0)
			{
				strEndDate	= d.getFullYear() + '-' + intMonth + '-' + intEndDay;
				intYear = d.getFullYear()
			}
			else
			{
				strEndDate	= intYear + '-' + intMonth + '-' + intEndDay;
			}
		}
		if(!isDate(strEndDate))
		{
			I = 1;
			do
			{
				strEndDate	= intYear + '-' + 12 + '-' + (intEndDay - I);
				I++;
			}
			while(isDate(strEndDate) == false)
		}
		
	}
	
	if(intcMonth != 13)
	{
		if(intMonth.length == 1)
		{
			intMonth = '0' + intMonth;
		}
		strStartDate	= intYear + '-' + intcMonth + '-' + intStartDay;
		strEndDate		= intYear + '-' + intcMonth + '-' + intEndDay;

		if(!isDate(strEndDate))
		{
			I = 1;
			do
			{
				strEndDate	= intYear + '-' + intcMonth + '-' + (intEndDay - I);
				
				I++;
			}
			while(isDate(strEndDate) == false)
		}
	}

	document.all['startdate'].value			= strStartDate;
	document.all['enddate'].value			= strEndDate;
	
	//alert(strStartDate+' | '+strEndDate);
	//alert(strEndDate);
	
	makeChannelFilter()
}

function makeChannelFilter()
{
	if(document.all['Audience'])
	{
		strAudience	= document.all['Audience'].value;
	}
	else
	{
		strAudience = '';
	}
	
	if(document.all['Product'])
	{
		strProduct	= document.all['Product'].value;
	}
	else
	{
		strProduct = '';
	}
	
	if(strAudience == 0)
	{
		strAudience = '';
	}
	if(strProduct == 0)
	{
		strProduct = '';
	}
	
	if(strAudience.length > 1 && strProduct.length > 1)
	{
		strAudience = strAudience + ',';
	}
	if(strProduct.length > 1)
	{
		strProduct = strProduct + '';
	}
	
	strFilterchannels = strAudience + strProduct;
	document.all['filterchannels'].value	= strFilterchannels;
	
	document.forms[0].submit();
}

function showQuestionnaire(url)
{
	if (url != '')
	{
		window.open(url,'qwin','width=378,height=281,scrollbars=1')
	}
}


function init()
{
	// instansiate interesting layers.
	// added for taCV launch
	//dMenu[1] = new samLyr ('dMenu1','')
	//dMainMenu = new samLyr ('lLeftCol','')
	/*
	if (bNS)
	{
		if (document.layers['dFloater']) aFloaters[1] = new samLyr('dFloater','')
		if (document.layers['dFloater2']) aFloaters[2] = new samLyr('dFloater2','')
		if (document.layers['dFloater3']) aFloaters[3] = new samLyr('dFloater3','')
	}
	else if (is_ie4)
	{
		if (document.all['dFloater']) aFloaters[1] = new samLyr('dFloater','')
		if (document.all['dFloater2']) aFloaters[2] = new samLyr('dFloater2','')
		if (document.all['dFloater3']) aFloaters[3] = new samLyr('dFloater3','')
	}
	else
	{
		if (document.getElementById("dFloater")) aFloaters[1] = new samLyr('dFloater','')
		if (document.getElementById("dFloater2")) aFloaters[2] = new samLyr('dFloater2','')
		if (document.getElementById("dFloater3")) aFloaters[3] = new samLyr('dFloater3','')				
	}
	*/
	// capture events
	/*
	if (bNS) {
		document.captureEvents (Event.MOUSEMOVE);
		document.captureEvents (Event.MOUSEUP);	
	}
	document.onmouseup = dmouseup;
	document.onmousemove = dmousemove;
	*/
	// change event of links in case user is not logged in

	/*
	if (!loggedIn) {
		removeLnk(); 
	}
	*/
}

function loginerror(strError) {
	if (strError != '') {
		alert (strError)
	}
}

// Functions connected to the login procedure :::

function doLogin(o) {
	var par = (bNS)? document.layers['lLoginLyr'].document.forms['loginFrm']:document.forms['loginFrm'];
	
	if (par.username.value != '' && par.password.value != '') {
		par.submit();
	}
	else {
		alert ('Please enter your username and/or password.')
	}

}

function checkLogOut(val){
	if(val=='1') alert('Your log in session has expired. This is a safety precaution.\n\nPlease use your username and password and log in again.')
}

function removeLnk() {
		for (i = 0; i < document.links.length; i++) {
		
			if (document.links[i].pathname == '/Registration.asp' || document.links[i].pathname == '/registration.asp' || document.links[i].pathname == '/Forgetlogin.asp' || document.links[i].name == 'outsideLogin' || document.links[i].pathname == '/' || document.links[i].pathname == '/outsideLog.asp' || document.links[i].pathname == '/azredirect.asp' || document.links[i].pathname == 'bookmark()\;') {

			}
			else {
				document.links[i].onclick = remLnk;
			}
		}
		if (bNS) {
				var lyrs = new Array();
				
				lyrs[0] = 'lCenterCol'
				lyrs[1] = 'lRightCol'
				lyrs[2] = 'lLeftCol'
				lyrs[3] = 'lTop'
				if (document.location.pathname != '/registration.asp') {
					lyrs[4] = 'lRegistration'
				}
				
				for (i = 0; i < lyrs.length; i++) {
					var cLyr = document.layers[lyrs[i]]
					for (j = 0; j < cLyr.document.links.length; j++) {
						if (cLyr.document.links[j].pathname != '' && cLyr.document.links[j].search != '?did=63') {
							cLyr.document.links[j].onclick = remLnk;
						}
					}
				}
				//if (bNS) alert (document.links.length)
				//alert (document.links[i].pathname)
			}		
}

function remLnk() {
	alert ('Please log in first.')
	return false;
	event.returnValue = false;
}

function doLoginCheck(userId,noUser) {
	if (userId != '') {
		loggedIn = true;
	}
	else {
		loggedIn = false;
	}
}	


function getKeyUp () {
	if (!loggedIn && !is_ie4) {
		par = (bNS) ? document.layers['lLoginLyr'].document.forms['loginFrm']:document.forms['loginFrm']
	
		sName1 = 'username'
		sName2 = 'password'
		if (bNS) {
			window.onkeyup = eKeyUp;
			window.captureEvents (Event.KEYUP);
		}
		else {
			par.elements[sName1].onkeyup = eKeyUp;
			par.elements[sName2].onkeyup = eKeyUp;
		}
	}
}

function eKeyUp (e) {
	par = (bNS) ? document.layers['lLoginLyr'].document.forms['loginFrm']:document.forms['loginFrm']

	if (!bNS) e = window.event;
	key = (bNS)? e.which: e.keyCode;
	srcElm = (bNS)? e.target: e.srcElement;
	elmOk = (srcElm.name == sName1 || srcElm.name == sName2);
	charOk = (key == 13);
	valOk = (par.elements[sName1].value != '' && par.elements[sName2].value != '');
	if (elmOk && charOk && valOk) {
		par.submit ();
	}
	else {
		if (!valOk && charOk) alert ('Please enter your username and/or password.')
	}
}

function checkSearch(){
	//if (document.forms['searchForm'].elements['strWord'].value.length < 4)
	if(document.forms['searchForm'].elements['strWord'].value.length < 4)
	{	
		alert ('Search phrase must be more than 3 characters.');
		return false;
	}
	else
	{
		//document.forms['searchForm'].submit();
	}
}


//check the Textarea value length
function charsleft(elm) {
	var charLength = document.forms['frm'].elements[elm].value.length;
	var sum = 2000 - charLength;
	if (sum < 0) {
		document.forms['frm'].elements[elm].value = document.forms['frm'].elements[elm].value.substr(0, 2000);
		alert ('Your message has reached maximum permitted length. If you wish to continue please use your e-mail software addressing your message to press.office@astrazeneca.com.')
	}
}


function checkThenGo() {
	
	sError = ''
	//Control the email field
	sFrm = (bNS)? document.layers['lCenterCol'].document.forms['frm'] : document.forms['frm']

/*	if (sFrm.elements['consent'].checked == false) {
		sError = sError  + 'You must consent to sending you information.\n'
	}
*/
	sControlField = sFrm.elements['lastname'].value
	if (sControlField == '') {
		sError = sError  + 'You have to write your First name.\n'
	}
	
	sControlField = sFrm.elements['firstname'].value
	if (sControlField == '') {
		sError = sError  + 'You have to write your Last name.\n'
	}
	
	sControlField = sFrm.elements['phone'].value
	if (sControlField == '') {
		sError = sError  + 'You have to write your Phone number.\n'
	}
/*
	sControlField = sFrm.elements['country'].value
	if (sControlField == '') {
		sError = sError  + 'You have to write your Country.\n'
	}
	

	sControlField = sFrm.elements['profession'].value
	if (sControlField == '') {
		sError = sError  + 'You have to select your profession..\n'
	}			
*/
	sControlField = sFrm.elements['email'].value
	if (sControlField == '') {
		sError = sError  + 'You have to write your E-mail.\n'
	}	
	
	sControlField = sFrm.elements['Message'].value
	if (sControlField == '') {
		sError = sError  + 'You have to write a Message.\n'
	}
	
	if (!isEmailAddress(sFrm.elements['email'].value)) {
		sError = sError  + 'The E-mail Address you have entered is not valid.\n'
	}
			
	// If there is an error the form should not be submited
	if (sError == '') {
		sFrm.submit()
	}
	else {
		alert (sError)
	 }
}


function isEmailAddress (sEmail) {
	var testReg = /(^\w+((-\w+)|(\.\w+))*)\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.([\w\.]{2,6})$/
	return testReg.test(sEmail)
}

function checkForgotPass() {
	sFrm = (bNS)? document.layers['lCenterCol'].document.forms['frm'] : document.forms['frm']
	sFrm.submit();
}


// Monthselect for event area
function doEvMonthSelect(num) {
	thisDate = new Date()
	if (num == '') num = (thisDate.getMonth() + 1)
	par = (bNS)? document.layers['lRegistration'].document : document
	par.images['ev'+num].src = 'imgs/ev/ev'+num+'on.gif'
}

// Opens a window for pictures in media library
function openPic(img) {
	picWin = window.open('/picView.asp?img='+img,'picWin','width=100,height=100,resizable=1')
}

// Printing functions

function prePrint(aid) {
	printLyr = window.open ('index.asp?did=1462&clientid=14&aid='+aid,'printLyr','width=420,height=500,scrolling=1,scrollbars=yes')
}

function doPrint() {
	dButLyr = new samLyr ('printBut','')
	dPrintLyr = new samLyr('printLyr','')
	dButLyr.hide()
	dPrintLyr.moveTo (0,30)
	window.print();
	window.close();
}

// functions for the sitemap

function smOver(pos,name) {
	if (dSmOverLyr) {
		dSmOverLyr.moveTo(globalX+5,globalY+5)
		dSmOverLyr.lyrwrite('<font size="1" face="verdana"><strong>'+name+'</strong><br>'+pos+'</font>')
		dSmOverLyr.show()
	}
}

function smOut() {
	if (dSmOverLyr) dSmOverLyr.hide()
}

// Opens a window for slideshow
function openSlide(number) {
	slideWin = window.open('/redirectUrl.asp?ext=0&url=viewslide.asp?slideid='+number,'slideWin','width=100,height=100,resizable=1')
}

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(pos1+1,pos2)
	var strDay=dtStr.substring(pos2+1)
	var strYear=dtStr.substring(0,pos1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		/*alert("The date format should be : yyyy-mm-dd")*/
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		/*alert("Please enter a valid month")*/
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		/*alert("Please enter a valid day")*/
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		/*alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)*/
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		/*alert("Please enter a valid date")*/
		return false
	}
return true
}

// REGISTRATION SCRIPTS

function isEmailAddress (sEmail) {
	var testReg = /(^\w+((-\w+)|(\.\w+))*)\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.(\w{2,4})$/
	return testReg.test(sEmail)
}
		
function validateReg (o) {
	if (bNS) o = document.layers['lRegistration'].document.forms['form1']
	sError = ''
	var pattern = /[\W]/;
	/* if (pattern.test(o.elements['strUsername'].value)) {
		document.getElementById("strUsernameError").innerHTML = 'Invalid characters in username. Use only allowed characters. [A-Z], [0-9] and [_] (underscore).'
		sError = 'true';
	}
	else document.getElementById("strUsernameError").innerHTML = ''*/

	if (o.elements['strPassword'].value == '') {
		document.getElementById("strPasswordError").innerHTML = 'Please enter a password.'
		sError = 'true';
	}
	else {
		if (o.elements['strPassword'].value != o.elements['strCheckPassword'].value) {
			document.getElementById("strPasswordError").innerHTML = 'The provided password does not match the data entered in the verify password field.'
			sError = 'true';
		}
		else {
			if (pattern.test(o.elements['strPassword'].value)) {
				document.getElementById("strPasswordError").innerHTML = 'Invalid characters in password. Use only allowed characters. [A-Z], [0-9] and [_] (underscore).'
				sError = 'true';
			}
			else document.getElementById("strPasswordError").innerHTML = ''		
		}
	}
	
	if (o.elements['strFirstname'].value == '') {	
		document.getElementById("strFirstnameError").innerHTML = 'Please enter your first name.'
		sError = 'true';
	}
	else document.getElementById("strFirstnameError").innerHTML = ''	
	if (o.elements['strLastname'].value == ''){
		document.getElementById("strLastnameError").innerHTML = 'Please enter your family name.'
		sError = 'true';
	}
	else document.getElementById("strLastnameError").innerHTML = ''	
/* 	if (o.elements['strPublisherFreelancer'].value == '') {
		document.getElementById("strPublisherFreelancerError").innerHTML = 'Please enter Publication or Freelance.'
		sError = 'true';
	}
	else document.getElementById("strPublisherFreelancerError").innerHTML = ''	
	*/
	
	if (!isEmailAddress (o.elements['strEmail'].value)) {
		document.getElementById("strEmailError").innerHTML = 'Please enter a valid e-mail address.';
		sError = 'true';
	}
	else document.getElementById("strEmailError").innerHTML = ''		
	
	if (o.elements['intCountryId'].options[o.intCountryId.selectedIndex].value == '0') {
		document.getElementById("intCountryIdError").innerHTML = 'Please choose your country of residence.'	
		sError = 'true';
	}
	else document.getElementById("intCountryIdError").innerHTML = ''
	
	if (o.elements['strTitle'].options[o.strTitle.selectedIndex].value == '0') {
		document.getElementById("strTitleError").innerHTML = 'Please choose your title.'	
		sError = 'true';
	}
	else document.getElementById("strTitleError").innerHTML = ''	
	
	if (o.elements['intProfession'].options[o.intProfession.selectedIndex].value == '0') {
		document.getElementById("intProfessionError").innerHTML = 'Please choose your profession.'	
		sError = 'true';
	}
	else document.getElementById("intProfessionError").innerHTML = ''		
		
	/* if (o.elements['intLanguageId'].options[o.intLanguageId.selectedIndex].value == '') {
		document.getElementById("intLanguageIdError").innerHTML = 'Please choose your language.'	
		sError = 'true';
	}
	else document.getElementById("strAreaOfInterestError").innerHTML = ''
	*/
	/* if (!isChecked(o.elements['strAreaOfInterest'])) {
		document.getElementById("strAreaOfInterestError").innerHTML = 'Please choose your area.'
		sError = 'true';
	}
	else document.getElementById("intLanguageIdError").innerHTML = ''	
	*/
	
	if (sError == '') o.submit ();
	else {
		//alert (sError);
		document.getElementById("strGeneralError").innerHTML = '<br>Please review the registration form and complete with any missing information.'
		scrollTo(0,0)
	}
}

function isChecked(strField)
{
	if (!strField.length)
	{ 
		return strField.checked;
	}
	for(var i = 0; i < strField.length; i++)
	{
		if(strField[i].checked)
		{
			return true;
		}
	}
	return false;
}

function doEmailFieldToggle(obj) {
	if (obj.checked) {
		document.getElementById("emailRow").style.display = 'block';
		document.getElementById("emailFormatRow").style.display = 'block';
	}
	else {
		document.getElementById("emailRow").style.display = 'none';
		document.getElementById("emailFormatRow").style.display = 'none';	
	}
}

function doSwitch() {
	var frm = document.forms[1]
	frm.strUsernameRadio[5].checked = true
}

function doTransfer() {
	var frm = document.forms[1]
	if (frm.elements['strUsername'].value != '') {
		frm.strUsernameRadio[5].value = frm.elements['strUsername'].value
	}
	else {
		frm.strUsernameRadio[0].checked = true
	}
}

function doFocus () {
var frm = document.forms[1]
	frm.elements['strUsername'].focus()
}

function doSearchPage (num) {
	var frm = document.forms['listFrm']
	frm.action = 'search.asp?page='+num
	frm.submit();
}

// Advanced search submitted by Mouseclick
function doSearch() {
	pattern = /[%\']/;
	sFrm = (bNS)? document.layers['lRegistration'].document.forms['form1']: document.forms['form1']
	if (sFrm.elements['strWord'].value.length < 4) {
		alert ('Search phrase must be more than 3 characters.')	
	}
	else if (pattern.test(sFrm.elements['strWord'].value)) {
		alert ('The characters % and \' are not allowed.')
	}
	else {
		sFrm.submit()
	}
}

// Advanced search submitted by Return key
function asSubmit() {
	pattern = /[%\']/;
	sFrm = (bNS)? document.layers['lRegistration'].document.forms['form1']: document.forms['form1']
	if (sFrm.elements['strWord'].value.length < 4) {
		alert ('Search phrase must be more than 3 characters.')
		return false;
	}
	if (pattern.test(sFrm.elements['strWord'].value)) {
		alert ('The characters % and \' are not allowed.')
		return false;
	}
}

function bookmark(strSiteUrl, strSiteName)
{
	if (bNS) {
		alert ('You are using netscape. \n Please press ok to close this alert, and then CTRL+D to bookmark this site.')
	}
	else {
		window.external.AddFavorite(strSiteUrl, strSiteName);
	}
}

function bookmarkPage(strSiteName)
{
	if (bNS) {
		alert ('You are using netscape. \n Please press ok to close this alert, and then CTRL+D to bookmark this site.')
	}
	else {
		window.external.AddFavorite(window.location.href, window.document.title);
	}
}


function printPage()
{
	/*
	var aid = document.forms['pageinfo'].elements['aid'].value
	if (aid == '' || aid == 0)
	{
		window.print();
	}
	else
	{
		printWin = window.open('/index.asp?did=12771&aid='+ aid +'&clientid=14','printWin','width=400,height=500,resizable=yes,scrollbars=yes')
	}
	*/
	if(window.location.href.indexOf("?") > -1)
	{
		printWin = window.open(window.location.href + '&printfriendly=1','printWin');
	}
	else
	{
		printWin = window.open(window.location.href + '?printfriendly=1','printWin');
	}
}


function sendToFriend()
{
		mystring = window.location.href;
	mystring = mystring.replace(/&/ig,'&amp;');
	sendWin = window.open('index.asp?did=12773&ArticleLink='+escape(mystring),'sendWin','width=400,height=500,resizable=yes,scrollbars=yes')
}

// script for adding an event in outlook
function addEvent() {	
	document.getElementById('outlookForm').submit();
}

function openWindow(url)
{
	openWindowParam(url, 600, 400);
}
function openWindowParam(url, width, height, samewindow)
{
	window.open(url,samewindow ? 'popup' : '_blank','width=' + width + ',height=' + height + ',left=10,top=10,resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,status=yes,location=yes,directories=no');
}

function doDates()
{
	sFrm = (bNS)? document.layers['colcontent'].document.forms['congressCalendarForm']: document.forms['congressCalendarForm']
	var strValue;
	strValue = sFrm.elements['cyear'].value + '-' + sFrm.elements['cmonth'].value
	sFrm.elements['startswithdate'].value = strValue
	sFrm.submit()
}


function toggleImageFloat(intId)
{
	if(document.getElementById('ImageFloat'+intId))
	{
		if(document.getElementById('ImageFloat'+intId).style.display == 'block')
		{
			document.getElementById('ImageFloat'+intId).style.display = 'none';
		}
		else
		{
			document.getElementById('ImageFloat'+intId).style.display = 'block';
		}
	}
}