

var tabs_ids = new Array("tab1", "tab2");
    
function switchid(id){    
    empty_content();
    setactive_tab(id);
    get_text(id);
}


function empty_content ()
{
	//existed ?
	//i think don't need check here, since we already check before call switch('tab1') on init.js

	if($('#tablecontent').length > 0)
		$('#tablecontent').html('-empty-');
}


function setactive_tab (id){
	//loop through the array and hide each element by id
	//alert(id);
	for (keyVar in tabs_ids) 
	{
			
		tag_id =  tabs_ids[keyVar];
		//alert(tag_id);
		//safe function to hide an element with a specified id
		if (tag_id != id)
		{
			//remove class active from others
			$('#' + tag_id).removeClass('active');
		}
		else
		{
			//add class active to current
			$('#' +tag_id).addClass('active');
		}
	}
             
}

function hidediv(id) {

    //hide a element with ID = id
    $('#'+id).hide();
}

function showdiv(id) {
    //show a element with ID = id
	$('#'+id).show();
}


function isValid() 
{
 
	var name=document.review_submit.name.value;
	var title=document.review_submit.title.value;
	var text=document.review_submit.text.value;
	var txtCaptcha=document.review_submit.txtCaptcha.value;
	var error ='';
	 
	if (name == '' || name == 'Your Name') {error +='Invalid name ' + "\n";}
	if (title == '' || title == 'Review Title') {error +='Invalid title ' + "\n";}
	if (text == '' || text == 'Review content') {error +='Invalid review message ' + "\n";}
	if (txtCaptcha == '') {error +='Invalid Captcha ' + "\n";}

	if (error == '') {return true;}
	else 
			{
				alert (error);
				return false;
			}
}



