////////////////////////////////////////////////////////////////////////////////
//                           CopyRights Reserved                              //
//                              Almog Nehemya                                 //
//                         http://almog.coo.co.il                             //
////////////////////////////////////////////////////////////////////////////////


// menu

function showHideTable(menuId)
{
	var obj=document.getElementById(menuId);
    	obj.style.visibility = (obj.style.visibility == "visible"?"hidden":"visible");
}

function showHideTableSuperSub(menuId)
{
	var obj=document.getElementById(menuId);
    	obj.style.visibility = (obj.style.visibility == "visible"?"hidden":"visible");
}

// comments

function checkComments()
{
	var subject = document.commentsFrm.subject.value;
	var comment = document.commentsFrm.comment.value;
	var name = document.commentsFrm.name.value;
	var email = document.commentsFrm.email.value;
	
	if(subject.length == 0){
		alert("Please enter your subject");
		return false;
	}
	if(comment.length == 0){
		alert("Please enter your comment");
		return false;
	}
	if(name.length == 0){
		alert("Please enter your name");
		return false;
	}
	if(email.length == 0){
		alert("Please enter your email");
		return false;
	}
	return true;
}

function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit)
		field.value = field.value.substring(0, maxlimit);
	else
		document.getElementById(countfield).innerHTML = maxlimit - field.value.length + ' Characters Remaining';
}

// send to friend

function send2f()
{
	var yourname 	= document.send2fFrm.yourname.value;
	var youremail	= document.send2fFrm.youremail.value;
	var friendname	= document.send2fFrm.friendname.value;
	var friendemail	= document.send2fFrm.friendemail.value;
	var subject		= document.send2fFrm.subject.value;
	
	if(yourname.length == 0){
		alert("Please enter your name");
		return false;
	}
	if(youremail.length == 0){
		alert("Please enter your email");
		return false;
	}
	if(friendname.length == 0){
		alert("Please enter your friend's name");
		return false;
	}
	if(friendemail.length == 0){
		alert("Please enter your friend's email");
		return false;
	}
	if(subject.length == 0){
		alert("Please enter subject for the email");
		return false;
	}
	return true;
}

function openSend2f(id)
{
	x = window.open("send2friend.php?id="+id, "tellf", "width=400, height=350, resizable=1, toolbar=0, top=100, left=200, location=0, status=1, menubar=0, scrollbars=1");
	x.focus();
}

// Dedicate

function dedicate()
{
	var dedicatetotxt = document.dedicateFRM.dedicatetotxt.value;
	
	if(dedicatetotxt.length == 0){
		alert("Please fill out all the fields");
		return false;
	}
	return true;
}

function openDedicate(id)
{
	x = window.open("dedicate.php?id="+id, "dedicate", "width=500, height=200, resizable=1, toolbar=0, top=100, left=200, location=0, status=1, menubar=0, scrollbars=1");
	x.focus();
}


// Week lessons

function weeklessons_changePic(id,idd)
{
	document.getElementById('weekLesson_'+id).style.display = 'block';
	document.getElementById('weekLesson_'+idd).style.display = 'none';
	
	
	document.getElementById('weekArrow_'+id).style.display = 'block';
	document.getElementById('weekArrow_'+idd).style.display = 'none';
}

function hiddenArrow()
{
	document.getElementById('weekArrow_1').style.display = 'none';
}