
function UpdateTitle(ttl)
{
	document.title = ttl;
}


function validate_web_user(frm)
	{
	var strErr = '';
	frm_add_web_user.frm_LOGIN.value=frm_add_web_user.frm_LOGIN.value.replace(/^\s+/,'').replace(/\s+$/,'');
	frm_add_web_user.frm_PassWord.value=frm_add_web_user.frm_PassWord.value.replace(/^\s+/,'').replace(/\s+$/,'');
	
    if (frm_add_web_user.frm_LOGIN.value.indexOf(' ') > -1) 
		strErr += 'Login Name must not contain Space(s)\n';
	if (frm_add_web_user.frm_LOGIN.value=='')
		strErr += 'Empty login name not allowed\n';

	if (frm_add_web_user.frm_PassWord.value=='')
		strErr += 'Empty password not allowed\n';
	if (frm_add_web_user.frm_PassWord.value!=frm_add_web_user.frm_con_PassWord.value)
		strErr += 'Password and Confirm Password are not same\n';
	
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if ( ! (filter.test(frm_add_web_user.frm_Email.value))) 
		  strErr += 'Email not correct\n';

	if (frm_add_web_user.frm_Email.value!=frm_add_web_user.frm_Con_Email.value)
		strErr += 'Email and Confirm Email are not same\n';
		
	if (frm_add_web_user.frm_terms_contitions.checked == false)
	{
		strErr += 'You must agree to the PBS Terms and Conditions.\n';
	}
	if(strErr != '')
	{
		alert(strErr);
		return false;
	}
	
	return true;
	}



function validate_author_new(frm)
	{
	var strErr = '';
	frm_add_author.frm_LOGIN.value=frm_add_author.frm_LOGIN.value.replace(/^\s+/,'').replace(/\s+$/,'');
	frm_add_author.frm_PassWord.value=frm_add_author.frm_PassWord.value.replace(/^\s+/,'').replace(/\s+$/,'');
	
    if (frm_add_author.frm_LOGIN.value.indexOf(' ') > -1) 
		strErr += 'Login Name must not contain Space(s)\n';

	if (frm_add_author.frm_LOGIN.value=='')
		strErr += 'You must enter a User Name!\n';

	if (frm_add_author.frm_PassWord.value=='')
		strErr += 'Empty password not allowed\n';

	if (frm_add_author.frm_PassWord.value!=frm_add_author.frm_con_PassWord.value)
		strErr += 'Password and Confirm Password are not same\n';
	
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if ( ! (filter.test(frm_add_author.frm_Email.value))) 
		  strErr += 'Email not correct\n';

	if (frm_add_author.frm_Email.value!=frm_add_author.frm_Con_Email.value)
		strErr += 'Email and Confirm Email are not same\n';

	if (frm_add_author.firstname.value=='')
		strErr += 'You must enter a First Name!\n';

	if (frm_add_author.lastname.value=='')
		strErr += 'You must enter a Last Name!\n';

	if (frm_add_author.address1.value=='')
		strErr += 'You must enter aa Address!\n';

	if (frm_add_author.city.value=='')
		strErr += 'You must enter a City!\n';

	if (frm_add_author.state.value=='')
		strErr += 'You must enter a State!\n';

	if (frm_add_author.country.value=='')
		strErr += 'You must enter a Country!\n';

		
	if (frm_add_author.frm_terms_contitions.checked == false)
		strErr += 'You must agree to the PBS Terms and Conditions.\n';

	if(strErr != '')
	{
		alert(strErr);
		return false;
	}
	
	return true;
	}



function validate_author_agreement(frm)
	{
	var strErr = '';
		
	if (register.accept_terms.value=='')
	{
		strErr += 'You must make a selection.\n';
	}
	if(strErr != '')
	{
		alert(strErr);
		return false;
	}
	
	return true;
	}


function validate_pswrd(frm)
	{
	var strErr = '';
	
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if ( ! (filter.test(form_forgot_pswrd.frm_Email.value))) 
		  strErr += 'Email not correct\n';

	if(strErr != '')
	{
		alert(strErr);
		return false;
	}
	
	return true;
	}



function validate_login_user(frm)
	{	
	var strErr = '';
	form_main_login.frm_LOGIN.value=form_main_login.frm_LOGIN.value.replace(/^\s+/,'').replace(/\s+$/,'');
	form_main_login.frm_PassWord.value=form_main_login.frm_PassWord.value.replace(/^\s+/,'').replace(/\s+$/,'');
	
    if (form_main_login.frm_LOGIN.value.indexOf(' ') > -1) 
		strErr += 'Login Name must not contain Space(s)\n';
	if (form_main_login.frm_LOGIN.value=='')
		strErr += 'Empty login name not allowed\n';

	if (form_main_login.frm_PassWord.value=='')
		strErr += 'Empty Password not allowed\n';
	
	if(strErr != '')
	{
		alert(strErr);
		return false;
	}
	
	return true;
	}


function validate_book_info(book_info)
	{	
	var strErr = '';
	book_info.title.value=book_info.title.value.replace(/^\s+/,'').replace(/\s+$/,'');
	alert(book_info.title.value);
	return false;
	}


	function draw_button(image , href , onclick ){
		var html = "";
			
			html += "<a href=\"" + href + "\" "
			html += "onclick=\"" + onclick + "\">"
			html += "<img src=\"images/buttons/button_" + image + ".gif\" border=\"0\" >"
			html += "</a>";

		document.write(html);
	}

	function draw_box ( width , part , title ) {
		if ( part == 1 ) {
			
			var html = "";
			html += "<p class=\"title\">" + title + "</p>"
			html += "<table align=center cellpadding=0 cellspacing=0 width=\""+ width + "\">"
			html += "	<tr>"
			html += "		<td height=1 colspan=3 bgcolor=#9DBEE6><img src=\"images/dot.gif\"></td>"
			html += "	</tr>"
			html += "	<tr>"
			html += "		<td width=1 bgcolor=#9DBEE6><img src=\"images/dot.gif\"></td>"
			html += "		<td bgcolor=#E9EDF2>"
			


			document.write (html);
		} else {
			var html = "";				
			html += "		</td>"
			html += "		<td width=1 bgcolor=#9DBEE6><img src=\"images/dot.gif\"></td>"
			html += "	</tr>"
			html += "	<tr>"
			html += "		<td height=1 width=1 bgcolor=#9DBEE6><img src=\"images/dot.gif\"></td>"
			html += "		<td colspan=2 height=1 bgcolor=#9DBEE6><img src=\"images/dot.gif\"></td>"
			html += "	</tr>"
			html += "</table>"

			document.write (html);
		}
	}

	function draw_tab_sep() {
		document.write("<td width=1><img src=\"images/b_modulesep.gif\"></td>");
	}

	function draw_target_tab (title, link , target) {
		if (link != "") {
			var html = "";
			html += "<td width=92 background=\"images/b_module2.gif\" valign=middle align=center>"
			html += "	<a target=\"" + target + "\" href=\""+ link + "\" class=\"module_menu\">"+ title +"</a>"
			html += "</td>"
			html += "<td width=1><img src=\"images/b_modulesep.gif\"></td>"

			document.write(html);

		} else {

			var html = "";
			html += "<td width=92 background=\"images/b_module.gif\" valign=middle align=center class=\"module_menu\">"
			html += title
			html += "</td>"
			html += "<td width=1><img src=\"images/b_modulesep.gif\"></td>"

			document.write(html);
		}
		//draw_tab_sep() 
	}

	function draw_tab ( title, link ) {
		draw_target_tab ( title, link , "");
	}




function zoom(id) {
	var str;

	if (id == "1")  {
		i++;
		document.body.style.zoom=1+i/10;
	}
	if (id == "2") {
		i--;
		document.body.style.zoom=1+i/10;
	}
	if (id == "3") {
	document.body.style.zoom=1;
	i=1;
	}
}



function add2favorite()        
{                
	if(window.external)               
	{                        
		window.external.AddFavorite(location.href,'GITM -- Gulf in the Media')              
	} 
	else              
	{                        
		alert("Your browser does not support this feature.  If you are using Netscape Navigator --\n" +"Click \"Bookmarks\" and then \"Add Bookmark\"  or type \"Ctrl+D\" to add this site to your favorites."); 
	}        
}
