function submitNewsletter()
{
	var root = document.newsletter;
	var name = root.name;
	var email = root.email;
	if (name.value == '')
	{
		alert('Please insert your name');
		name.select();
		return false;
	}	
	if (email.value == '')
	{
		alert('Please insert your mail Address');
		email.select();
		return false;
	}
	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	var flag2 = email.value.match(pattern);
	if(!flag2)
	{
		alert("Please enter a valid E-mail address");
		email.select();
		return false;
	}
	return true;
}
function change_back_bg(menu_name)
{
	var descriptions = document.getElementById(menu_name);
	descriptions.style.backgroundColor = "#6B1B41";
}
function change_front_bg(menu_name)
{
	var descriptions = document.getElementById(menu_name);
	descriptions.style.backgroundColor = "#B5336F";
}
function display_submenu()
{
	var sub_menu_object = document.getElementById('about_us_div');
	sub_menu_object.style.visibility = "visible";
}
function hide_submenu()
{
	var sub_menu_object = document.getElementById('about_us_div');
	sub_menu_object.style.visibility = "hidden";
}
/////////////POP IMAGE////////////
function popImage(imageURL,imageTitle){
	defaultWidth  = 500;
	defaultHeight = 500;
	//alert(imageURL+imageTitle);
	var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left=100,top=100';
	var optIE='scrollbars=no,width=150,height=100,left=100,top=100';

	var AutoClose = true;

	if (parseInt(navigator.appVersion.charAt(0))>=4){
		var isNN=(navigator.appName=="Netscape")?1:0;
		var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
		var optNN='scrollbars=yes,width='+defaultWidth+',height='+defaultHeight+',left=100,top=100';
		var optIE='scrollbars=yes,width=150,height=100,left=100,top=100';

		//if (isNN){imgWin=window.open('about:blank','',optNN);}
		if (isNN){imgWin=window.open('about:blank','',optNN);}
		if (isIE){imgWin=window.open('about:blank','',optIE);}
		with (imgWin.document){
			writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
			writeln('<sc'+'ript>');
			writeln('var isNN,isIE;');
			writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
			writeln('isNN=(navigator.appName=="Netscape")?1:0;');
			writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
			writeln('function reSizeToImage(){');
			writeln('if (isIE){');
			writeln('window.resizeTo(100,100);');
			writeln('width=100-(document.body.clientWidth-document.images[0].width);');
			writeln('height=100-(document.body.clientHeight-document.images[0].height);');
			writeln('window.resizeTo(width,height);}');
			writeln('if (isNN){');
			writeln('window.innerWidth=document.images["Image"].width;');
			writeln('window.innerHeight=document.images["Image"].height;}}');
			writeln('function doTitle(){document.title="'+imageTitle+'";}');
			writeln('</sc'+'ript>');
			if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
			else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
			writeln('<img name="Image" src="'+imageURL+'" style="display:block"></body></html>');
			close();
		}
}
////////////////////////////////
function submenu(div_id,status){
	
	if(status =='on'){
		document.getElementById(div_id).style.visibility ='visible';
	}
	if(status =='off'){
//		window.setTimeout("hide('"+div_id+"')",1000);
		hide(div_id);
	}
}
function hide(div_id){
	document.getElementById(div_id).style.visibility ='hidden';
}
///////////contact us //////////
function validateContact(){
	root = document.contact;

	if(root.name.value==''){
		alert('Please enter your name.');
		root.name.focus();
		return false;
	}
	if(root.email.value==''){
		alert('Please enter your email address.');
		root.email.focus();
		return false;
	}
	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	flag=root.email.value.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		root.email.select();
		return false;
	}


	if(root.message.value==''){
		alert('Please enter a message.');
		root.message.focus();
		return false;
	}
	return true;
}

function clearContactForm(){
	var root=document.contactus;
	if(confirm('Are you sure you want to clear all the form ?')){
		root.name.value='';
		root.email.value='';
		root.subject.value='';
		root.message.value='';
		return false;
	}return false;

}
///////////////////////////////
function validateSearchForm(){
	
	var keyword = document.search_form.search;
	if(keyword.value==''){
		alert("Please enter a keyword.");
		keyword.focus();
		return false;
	}
	if(keyword.value.length <3){
		alert("Please enter a keyword greater than 3 characters.");
		keyword.select();
		return false;
	}
	return true;
}
function clearJoinusForm(){
	var response = confirm("Are you sure you want to clear the form");
	if(response){
		var formElements = document.joinus.elements;
		
		for(i=0;i<formElements.length;i++){
			if(formElements[i].name=='reset' || formElements[i].name=='submit'){
				continue;
			}
			formElements[i].value="";
		}
	}
}