function colexpsubcat(objid)
{
	obj = document.getElementById("subcat" + objid);
	if (obj.style.display == 'block')
		obj.style.display = 'none';
	else
		obj.style.display = 'block';
}

function floatDiv(objid)
{
	if(objid == '')
		return;
	
	var obj = "subcat" + objid;
	var obj2 = document.getElementById(obj);
	
	if(obj2.style.display == 'none')
	{
		new Effect.BlindDown(obj2);
	}
	else
	{
		new Effect.BlindUp(obj2);
	}
}

function clearBox(formItem) 
{
	for(i = formItem.length ; i > -1 ; i--) {
		formItem.options[i] = null;
	}                                                   
}

function addBoxItem(formItem, valValue, valText)
{
	newoption = new Option(valText, valValue, false, false);
	formItem.options[formItem.length] = newoption;                               
}

function setStatusMsg(str)
{
	status = str;
}

function validateSubmitForm()
{
	return;var str = "Following errors occured. Please fix them and then try to submit. \n\n";
	i = 1;
	f = document.submitform;
	
	if(trim(f.name.value) == "")
	{
		str += i + ". You did not enter your name\n";
		i++;
	}
	if(!validateEmail(f.email.value))
	{
		str += i + ". You did not enter your valid email address\n";
		i++;
	}
	if(trim(f.url.value) == "" || f.url.value == "http://")
	{
		str += i + ". You did not enter your website\n";
		i++;
	}
	if(trim(f.title.value) == "" || trim(f.title.value).length <= 4)
	{
		str += i + ". Tutorial title must be greater than 5 characters\n";
		i++;
	}
	if(trim(f.tutorial.value) == "" || f.tutorial.value == "http://")
	{
		str += i + ". You did not enter url of tutorial\n";
		i++;
	}
	if(trim(f.thumbnail.value) == "" || f.thumbnail.value == "http://")
	{
		str += i + ". You did not enter url of thumbnail of tutorial\n";
		i++;
	}
	if(f.category.value == "" || f.category.value == "0")
	{
		str += i + ". You did not select a category\n";
		i++;
	}
	if(f.subcategory.value == "" || f.subcategory.value == "0")
	{
		str += i + ". You did not select a sub category\n";
		i++;
	}
	/*if(!f.agreement.checked)
	{
		str += i + ". You must be agreed to our terms and conditions\n";
		i++;
	}*/
	
	
	if(str == "Following errors occured. Please fix them and then try to submit. \n\n")
		return true;
	else
	{
		alert(str);
		return false;
	}
}

function validateEmail(email)
{
	if (f.email.value == "")
		return false;
	else if(f.email.value.indexOf('@') < 1)
		return false;
	else if(f.email.value.indexOf('.') < 1)
		return false;
	
	return true;
}

function trim(str)
{
    return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}
