

function showComment(id)
{
	if(document.getElementById(id).style.display=="none")
	{
		document.getElementById(id).style.display="";
		document.getElementById(id*1000).style.display="";
		document.getElementById(id*1500).style.display="";
		document.getElementById(id*2000).style.display="";
	}	
	else
	{
		document.getElementById(id).style.display="none";
	
	document.getElementById(id*1000).style.display="none";	
	document.getElementById(id*1500).style.display="none";	
	document.getElementById(id*2000).style.display="none";

	}	
}


function showComment5(id)
{
	if(document.getElementById(id).style.display=="none")
	{
		document.getElementById(id).style.display="";
		document.getElementById(id*1000).style.display="";
		document.getElementById(id*2000).style.display="";

	}	
	else
	{
		document.getElementById(id).style.display="none";
	
	document.getElementById(id*1000).style.display="none";	
document.getElementById(id*2000).style.display="none";

	}	
}


function showComment2(id)
{
	if(document.getElementById(id).style.display=="none")
	{
		document.getElementById(id).style.display="";
		}	
	else
	{
		document.getElementById(id).style.display="none";
	

	}	
}


// Changes the cursor to an hourglass
function cursor_wait() {
document.body.style.cursor = 'pointer';
}

// Returns the cursor to the default pointer
function cursor_clear() {
document.body.style.cursor = 'default';
}

// Does some arduous calculation
function calc() {
var dummy = 0;

for (var i=0; i<1000000;i++) {
for (var z=0; i<1000000;i++) {
dummy = dummy + z + i;
}
}

cursor_clear();
}


function clearTxtField(fieldName){

 myfield = document.getElementById(fieldName)  ;
 

if (myfield.value == document.getElementById(fieldName+('1')).value)

  {
  myfield.value = "" ;
  
  }
 
}

function unclearTxtField(fieldName){

 myfield = document.getElementById(fieldName)  ;

  //myfield = document.getElementsByName(fieldName)
 
if (myfield.value == "")

  {
  myfield.value = document.getElementById(fieldName+('1')).value ;
  
  }


}



function clearTxtField3(fieldName){

 myfield = document.getElementById(fieldName)  ;
 

  myfield.value = "" ;
  

 
}



function checkEmailAddress(field)
{
var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
if (goodEmail)
	{
		return true;
	}
else
	{
		if (field.value=="" || field.value==" ")
			{
				alert ('  שדה לא תקין! נא לתקן ');
				field.focus();
				return false;
			}
		else
			{
				alert ('כתובת דואר שגויה');
				document.send.email.style.background = "red" ;

				field.focus();
				field.select();
				return false;
			}
	}
}

function validMail(strEmail) //if valid mail - return true
{
	var r, re;
	var email = new String(strEmail);
	re = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/ig;
	if(email.search(re)==0) 
		return true;
	else
		return false;	
}


function validateForm()
{



if(document.send.nose.value == "" || document.send.nose.value == "נושא")
	{
		alert("נא למלא את שדה הנושא!");
		document.send.nose.style.background = "red" ;

		document.send.nose.focus();

		
		return false;
	}

if(document.send.name.value == "" || document.send.name.value == "שם השואל-ת")
	{
		alert("חובה לרשום שם");
		document.send.name.style.background = "red" ;

		document.send.name.focus();

		
		return false;
	}
if(!checkEmailAddress(document.send.email)){return false;}

if(!validMail(document.send.email.value))
	{
		alert("כתובת המייל לא תקינה");
		document.send.email.focus();
	
		return false;
	}
	document.send.submit();
	return true;
}

function divcolor(x){
document.getElementById(x).style.backgroundColor = "#C0C0C0";
}
function restartcolor(x){
document.getElementById(x).style.backgroundColor = "";
}


function bordercolor(x){

document.getElementById(x).style.border="1px solid red";
// document.getElementById(x).style.borderTop="solid red"; 
}

function restartborder(x){
document.getElementById(x).style.border="1px solid white";
}



function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}



			function divcolor2(x){
				document.getElementById(x).style.backgroundColor = "#0066FF";
				document.getElementById(x).style.fontSize = "18px";


			}
			function restartcolor2(x){
				document.getElementById(x).style.backgroundColor = "";
				document.getElementById(x).style.fontSize = "";
			}
			
			
			
function changecolor(x){
myObj = document.getElementById(x);

myObj.style.color = "white";
}


function changecolor4(x){
myObj = document.getElementById(x);

myObj.style.color = "#B08319";
}

			
function changecolor5(x){
myObj = document.getElementById(x);

myObj.style.color = "white";
}

function resetcolor(x){
myObj = document.getElementById(x);

myObj.style.color = "";

}
			
			


function enlarge(id){



document.getElementById(id).style.pixelWidth=100
document.getElementById(id).style.pixelHeight=80


}

function revertback(id){
document.getElementById(id).style.pixelWidth=103
document.getElementById(id).style.pixelHeight=64
}


function PrintContent(idme) 
   {        var DocumentContainer = document.getElementById(idme);        var WindowObject = window.open('', "TrackHistoryData",                               "width=740,height=325,top=200,left=250,toolbars=no,scrollbars=yes,status=no,resizable=no");        WindowObject.document.writeln(DocumentContainer.innerHTML);        WindowObject.document.close();        WindowObject.focus();        WindowObject.print();        WindowObject.close();    }


function validateFormcal()
{




if(document.send.rabi.value == "" || document.send.rabi.value == "הרב ")
	{
		alert("חובה לרשום את שם הרב");
		document.send.rabi.style.background = "red" ;

		document.send.rabi.focus();

		
		return false;
	}



if(document.send.checkme.value == "" || document.send.checkme.value == "כן")
	{
		alert("תשובה לא נכונה בשאלת אבטחה!");
		document.send.rabi.style.background = "red" ;

		document.send.checkme.focus();

		
		return false;
	}


if(document.send.checkme.value == "לא" || document.send.checkme.value == "אסור")
{
	document.send.submit();
	return true;
}	
	
	
}



function validateFormcal9()
{


	document.send.submit();
	return true;
}


function boltme(id)
{

document.getElementById(id).style.fontWeight="bold";


}

function boltmeoff(id)
{

document.getElementById(id).style.fontWeight="";


}





//  äöâú äúîåðåú  -----------------------------------------------------------------------
this.imagePreview = function(){	
	/* CONFIG */
		
		xOffset = 120;
		yOffset = 40;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	$("a.preview").hover(function(e){
		
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t  : "";
		$("body").append("<p align=right dir=rtl id='preview'><img width=120 height=100 src='"+ this.name +"'  />"+ "</p>");								 
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("normal");						
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
    });	
	$("a.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


function loadajax()
{
loadXMLDoc('users', '', '');
}

// starting the script on page load
$(document).ready(function(){
	imagePreview();
	
//loadCounter();

//users_interval = setInterval ("loadajax()",5005);




});


function loadCounter () {

loadajax();
setTimeout(loadCounter, 5000);

}




//------------------------------------------------------------------------------


function divcolor_trivia(x){
dd=document.getElementById('isclick').value

if (document.getElementById(x).style.backgroundColor == "#e00000" || x == dd )
{}
else
{
document.getElementById(x).style.backgroundColor = "#f00000";
}
}
function restartcolor_trivia(x){

dd=document.getElementById('isclick').value


if (document.getElementById(x).style.backgroundColor == "#e00000" || x == dd )
{}
else
{
document.getElementById(x).style.backgroundColor = "000000";
}


}





/***********************************************
* JavaScript Sound effect- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/

function playsoundrotet(maze)
{

var theImages = new Array() // do not change this




if (maze == 'yes')
{
for (k = 0; k < 13; k++)

{
theImages[k] = '/midi/yes/'+k+'.wav'

}
}

if (maze == 'no')
{
for (k = 0; k < 18; k++)

{
theImages[k] = '/midi/no/'+k+'.wav'

}
}



var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));



document.getElementById("soundeffect").src="" //reset first in case of problems
document.getElementById("soundeffect").src=theImages[whichImage];







}
//  סיום הרוטציה


function playsound(soundfile){
if (document.all && document.getElementById){
document.getElementById("soundeffect").src="" //reset first in case of problems
document.getElementById("soundeffect").src=soundfile
}
}

function playreka(soundfile){
if (document.all && document.getElementById){
document.getElementById("soundreka").src=soundfile
}
}

function stopplayreka(){
if (document.all && document.getElementById){
document.getElementById("soundreka").src="" //reset first in case of problems
window.clearInterval(intervalID);
}
}

function bindsound(tag, soundfile, masterElement){
if (!window.event) return
var source=event.srcElement
while (source!=masterElement && source.tagName!="HTML"){
if (source.tagName==tag.toUpperCase()){
playsound(soundfile)
break
}
source=source.parentElement
}
}

 function showComment2(id)
{
	if(document.getElementById(id).style.display=="none")
	{
		document.getElementById(id).style.display="";

	}	
	else
	{
		document.getElementById(id).style.display="none";
	

	}	
}


function decode2(text){

var a = new Array("à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ë", "ê", "ì", "î", "í", "ð", "ï", "ñ", "ò", "ô", "ó", "ö", "õ", "÷", "ø", "ù", "ú");
var b = new Array("א", "ב", "ג", "ד", "ה", "ו", "ז", "ח", "ט", "י", "כ", "ך", "ל", "מ", "ם", "נ", "ן", "ס", "ע", "פ", "ף", "צ", "ץ", "ק", "ר", "ש", "ת");
var dcoded = '';
var coded = '';
dcoded ='';
var non;
var sing;
for(i=0;i<text.length;i++){
	non = text.charAt(i);
	for(x=0;x<a.length;x++){
	if(a[x] == non){
	dcoded += b[x];
	sing = 1;
	break;
	}
	if(x==(a.length-1) && sing != 1){
	dcoded += non;
	break;
	}
	}
	sing='';
}
return dcoded;
}




function loadXMLDoc(whome, id2, idme2)
{

if (whome == "users")
{
$.ajax({
  url: 'users_online.asp',
  
  
  success: function(data) {
  
  kisme = unescape(data);
  
  kisme = decode2(kisme);
  
  
    $('#users_online').html(kisme);

  }

});

  }

}


function hidush_trivia()
{
var answer = confirm ('האם אתה בטוח?')

if (answer){

$.get("ajax_functions.asp", { action3: "hidush_nikud" } );


}
else{


return false;

}



}



function upmenow()
{

$.get("c_files.asp", { action3: "nikud" } );



}




function checkloged()
{
$.get("trivia_online.asp", { check_loged: "ssss" } );

}

function send_it(idme2, id2)
// ####################

{

 $.ajax({
 url: 'trivia_online.asp?user_me='+idme2+'&user_vs='+id2,
 
 success: function(data) {
  
 kisme = unescape(data);
  
  kisme = decode2(kisme);
  
  
 $('#check_send').html(kisme);


 }
 });

 }

// ####################




function confirm_send(id, name, idme)
{




var answer = confirm ('?'+'האם אתה מעוניין לשלוח בקשה למשחק טריוויה עם '+name)
if (answer)


send_it(idme, id);





else

return false;
}



