function validateForm(form)
{
	var inputs=form.getElementsByTagName('input');
	for(var i=0;i<inputs.length;i++)
	{
		var input=inputs[i];
		if(input.type=="hidden" || input.type=="submit") continue;
		if(input.value=="") 
		{
			alert('Please fill the form completely and submit again');
			input.focus();
			return false;
		}
	}

        if (form.Email.value != "")
        {
            if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(form.Email.value))
            {
                return true;
            }
            else
            {
                alert("Please use a valid email address.");
                form.Email.focus();
                return false;
            } 
        }

	var textareas=form.getElementsByTagName('textarea');
	for(var i=0;i<textareas.length;i++)
	{
		if(textareas[i].value=="") 
		{
			alert('Please fill the form completely and submit again');
			textareas[i].focus();
			return false;
		}
	}
	return true;
}
function isRes800()
{
	if(screen.width==800) return true;
	else return false;
}
function isFF()
{
	var browser = navigator.appName;
	var version = navigator.appVersion;
	if (browser.indexOf("Internet Explorer") == -1 ) return true;
	else return false;
}
function toggle(which,total)
{
	if(which==1) var id="one";
	if(which==2) var id="two";
	if(which==3) var id="three";
	if(which==4) var id="four";
	if(which==5) var id="five";
	var clicked=document.getElementById(id);

	var parentDiv=clicked.parentNode;
	//alert(parentDiv.id);
	if(isFF())
	{
		var clas="class";
	}
	else
	{
		var clas="className";
	}

	var allClosed=true;
	for(var i=1;i<total+1;i++)
	{
		if(i==1) id="one";
		if(i==2) id="two";
		if(i==3) id="three";
		if(i==4) id="four";
		if(i==5) id="five";
		var parentDiv=document.getElementById(id);
		if(!parentDiv) continue;
		var a=parentDiv.getElementsByTagName('a')[0]; 
		var div=parentDiv.getElementsByTagName('div')[0]; 
	
		if(i==which) 
		{
			if(a.getAttribute(clas)=='closed')
			{
				div.setAttribute(clas,'visible');
				a.setAttribute(clas,'open');
				a.firstChild.nodeValue=a.firstChild.nodeValue.replace("+", "-");
				allClosed=false;
			}
			else
			{
				div.setAttribute(clas,'invisible');
				a.setAttribute(clas,'closed');
				a.firstChild.nodeValue=a.firstChild.nodeValue.replace("-", "+");
			}
			continue;
		}
		
		if(a && a.getAttribute(clas)=='open')
		{
			div.setAttribute(clas,'invisible');
			a.setAttribute(clas,'closed');
			a.firstChild.nodeValue=a.firstChild.nodeValue.replace("-", "+");	
		}
	}
}
function expandAppropriate(total)
{
	var url=document.URL;
	var pos=url.indexOf('#');
	var which=0; // Now it doesn't open any link by default. Make it 1 to open first link, 2 to open second etc.
	if(pos!=-1) which=url.substring(pos+1);
	if(which!=0) 
	{
		toggle(which,total);
		return;
	}
}
function openContent(id)
{
	var element=document.getElementById(id);
	var a=document.getElementById('read-more');
	if(!isFF()) 
	{
		a.setAttribute('className','invisible');
		element.setAttribute('className','visible');
	}
	else 
	{
		a.setAttribute('class','invisible');
		element.setAttribute('class','visible');
	}
}

