
 $(document).ready(function(){
 
  // Add Scroller Object
  $jScroller.add("#news_container","#newsticker","up",1,1);
  $jScroller.add("#news_container2","#newsticker2","up",1,1);
  $jScroller.config.refresh = 50;

  // Start Autoscroller
  $jScroller.start();
  
  $('.sub_category_table').hide(); 
  
 });


function topMenu(menuId,id)
{
	var obj = document.getElementById(menuId)
	if (id==1)
	{
	obj.style.visibility = 'visible';
	//obj.style.display = 'block';
	}
	
	if (id==0)
	{
	obj.style.visibility = 'hidden';
	//obj.style.display = 'none';
	}
	
}

function show_sub(MessageID)
{
if (eval("document.all.sub_menu" + MessageID))
	{
	if (eval("sub_menu" + MessageID + ".style.display=='none'"))
		{
		eval("sub_menu" + MessageID + ".style.display='block'")
		}
	else
		{
		eval("sub_menu" + MessageID + ".style.display='none'")
		}
	}
}


var last_div='empty'

function faq_function(new_one, Question)
{		
	document.getElementById(Question).style.display = "none";
	document.getElementById(new_one).style.display = "block";	
	last_div=new_one
	last_question=Question
}


function WindowOpen(address)
{
window.open(address,"BigPic","scrollbars=0,resizable=1,toolbar=0,status=0,location=0,menubar=0")
}

function JumpToIt(list)
{
    var selection = list.options[list.selectedIndex].value;
    if (selection != "None") 
        location.href = selection;
}





function checktext(){
var x=document.right_search1.FreeSearch.value

if (x=="") {
alert("יש להקליד מילה לחיפוש")
testresult=false
}
else {
testresult=true
}
}


function checknumber(){
var x=document.right_search2.CourseNum.value
var anum=/(^\d+$)|(^\d+\.\d+$)/
if (x=="") {
alert("יש להקליד מספר קורס")
testresult=false
}
else if (anum.test(x)){
testresult=true;

}
else{
alert("יש להכניס מספרים בלבד")
testresult=false
}
return (testresult)
}

function openWindow(pURL)
{
	myWindow = window.open(pURL, "", 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=170,height=240');
}


function checkdates(){
var x=String(document.dateForm.FromDateSearch.value)
var y=String(document.dateForm.ToDateSearch.value)

if (x=="" || y==""){
	testresult=false
	alert("יש להזין תאריך התחלה ותאריך סיום")
}
else {

z=x.substring(6,10)+x.substring(3,5)+x.substring(0,2)
w=y.substring(6,10)+y.substring(3,5)+y.substring(0,2)

if (z<=w)
testresult=true
else{
alert("תחום תאריכים אינו חוקי")
testresult=false
}
}
return (testresult)
}

function CheckFormHome()
{
    home_name=document.getElementById("home_name").value;   
    if (home_name.length==0) 
    {
  	  	alert("נא למלא שם");
		return false;
    }
    
    home_phone=document.getElementById("home_phone").value;
    home_mail=document.getElementById("home_mail").value;
    
     if (home_phone.length==0 && home_mail.length==0) 
    {
  	  	alert("נא למלא טלפון או מייל");
		return false;
    }
    
    if (isNaN(home_phone) == true && (home_phone.length!=0)) 
    {
  	  	alert("נא למלא רק מספרים");
		return false;
    }
        
    
    
    if (home_mail!="") {
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(home_mail))
			{
			return true;
			}
			else
			{
		  	  	alert("נא למלא כתובת אימייל תקינה");
				return false;
            }
    }
    else
        return true;
}

function CheckFormAshara() {
    ashara_name = document.getElementById("ashara_name").value;
    if (ashara_name.length == 0) {
        alert("נא למלא שם");
        return false;
    }

    ashara_phone = document.getElementById("ashara_phone").value;
    ashara_mail = document.getElementById("ashara_mail").value;

    if (ashara_phone.length == 0 && ashara_mail.length == 0) {
        alert("נא למלא טלפון או מייל");
        return false;
    }

    if (isNaN(ashara_phone) == true && (ashara_phone.length != 0)) {
        alert("נא למלא רק מספרים");
        return false;
    }



    if (ashara_mail != "") {
        if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(ashara_mail)) {
            return true;
        }
        else {
            alert("נא למלא כתובת אימייל תקינה");
            return false;
        }
    }
    else
        return true;
}

function CheckFormCourse() {
    course_name = document.getElementById("course_name").value;
    if (course_name.length == 0) {
        alert("נא למלא שם");
        return false;
    }

    course_phone = document.getElementById("course_phone").value;
    course_mail = document.getElementById("course_mail").value;

    if (course_phone.length == 0 && course_mail.length == 0) {
        alert("נא למלא טלפון או מייל");
        return false;
    }

    if (isNaN(course_phone) == true && (course_phone.length != 0)) {
        alert("נא למלא רק מספרים");
        return false;
    }



    if (course_mail != "") {
        if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(course_mail)) {
            return true;
        }
        else {
            alert("נא למלא כתובת אימייל תקינה");
            return false;
        }
    }
    else
        return true;
}