var isNS4 = (navigator.appName=="Netscape")?1:0;

function check_valid_email(str_email)
{
	var  ret_val = true;
	func_email = str_email;
	if(func_email.indexOf("@") < 2)
	{
	 ret_val=false;
	}
	if(func_email.indexOf(".") == 1 || func_email.indexOf(".") == func_email.length)
	{
	 ret_val=false;
	}
	return ret_val;
}

function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }


function open_big_pic(pic_str)
{
 a_win =  window.open ("big_pic_gen.asp?pic="+pic_str,"asd","toolbar=no,scrollbars=no,width=10,height=10");	
}

function resetpic(x)
{

picv=document.getElementById (x);
picv2=document.getElementById ("dis"+x);		
picv.value="0";
picv2.value="";
}


function open_popup(x,ty)
{
	
		  pic=document.getElementById(x);	

			 
		 if (pic.value=="" || pic.value=="0")
			{
				open('../includes/popuppic.asp?id='+x+'&type='+ty,'pics','width=650,height=450,left=100,top=100');
			}
			else
			{
			   alert("עלייך להסיר את הקוב הקיים");
			}
 }
		 

		 
		 
	function open_popup_flash(x_str)
	{
	 window.open('../includes/popupflash.asp?id='+x_str+'&w=130&h=150','pics','width=250,height=160,top=150,left=180');
	}	 

	function show_hide_func(str_obj)
	{
		 all_to_hide = document.getElementsByTagName("DIV");
		 for(i=0;i<all_to_hide.length;i++)
			all_to_hide[i].style.display = "none";
		 if(document.getElementById(str_obj).style.display=="none")
		{
			  document.getElementById(str_obj).style.display = "";
		}
		else
		{
			 document.getElementById(str_obj).style.display = "none";
		}
	}

	function hide_func(str_obj)
	{
		 document.getElementById(str_obj).style.display = "none";
	}

function display_pic(str_pic)
{
 pics = document.getElementById("dis"+str_pic) ;
 if(pics.value!="")
 {
 window.open ("../../pic/"+pics.value,"big_pic","width=400,height=400,toolbar=no,scrollbars=yes,resizable=yes,status=no");
 }
 else
 {
  alert("לא קיים קובץ להצגה")
 }
}

function rev_stat()
{
 if(document.getElementById("Add_New").style.display=="none")
 {
  document.getElementById("Add_New").style.display='';
 }
 else
 {
  document.getElementById("Add_New").style.display='none';
 }
}

function ClearField(F_id)
{
 In_id = document.getElementById(F_id) ;
 In_id.value="";
}

function display_file(str_inp_name)
{
 var obj_file = document.getElementById(str_inp_name);
 window.open("../../files/"+obj_file.value,"file","status=false")  
}

function get_color(color_id)
{
	In_color = document.getElementById(color_id) 
	In_color.value =  showModalDialog('../includes/colors2.asp', 'as', 'dialogLeft:150px;dialogTop:300px;dialogWidth:380px;dialogHeight:260px;help:no;status:no;scrollbars:no;')
}

function alertandred(url,msg)
{
var ans;
ans = confirm(msg);
if(ans==true) location.href = url;
}

function open_win(str_url,str_name,str_para)
{
 res_win = window.open(str_url,str_name,str_para);
}



function clear_form(s_form) 
{
	document.getElementById(s_form).reset();
}

function show_hide_obj(str_obj)
{
	if(document.getElementById(str_obj).style.display == "")
	{
		document.getElementById(str_obj).style.display = "none";
	}
	else
	{
		document.getElementById(str_obj).style.display = "";
	}
}

function check_login(str_form)
{
 user = document.getElementById("user").value;
 pass = document.getElementById("pass").value;
 if(pass=="" || user == "")
	alert("יש למלא שם משתמש וסיסמא");
 else
	document.getElementById(str_form).submit();	
}

function check_valid_reg(str_reg_form)
{
  if(document.getElementById("reg_pass").value  != document.getElementById("reg_pass2").value  )
	{
	 alert("אנא וודא את הסיסמא");
	}
	else
	{
	if(document.getElementById("Fname_reg").value == "" || document.getElementById("reg_email").value == "" || document.getElementById("reg_username").value == "" || document.getElementById("reg_pass").value =="" || document.getElementById("securityCode").value =="")
		alert("יש למלא את כל הפרטים בטופס");
		else
			document.getElementById(str_reg_form).submit();
	}
}


function start_news()
{
document.getElementById("news").start();
}

function stop_news()
{
document.getElementById("news").stop();
}

function update_quant(direc,no)
{
	var quant = parseInt(document.getElementById("qunt" + no ).value);
	switch(direc)
		{
			case "up":
				quant = quant + 1;
				break;
			case "down":
				quant = quant - 1;
				break;
		}
		document.getElementById("qunt" + no ).value = quant;
		document.getElementById("f_u").submit();
 
		
}


function buy_method(val_m)
{
 if(val_m==true)
	document.getElementById("tr_card").style.display = "none";
 else
	document.getElementById("tr_card").style.display = "";
}

function go_search(str_form,str_f)
{
	var text_f = document.getElementById(str_f).value;
	if(text_f == "")
		alert("נא להגליד מילות חיפוש");
	else
		document.getElementById(str_form).submit();
}

function open_blank(pid)
{
 b_win =  window.open ("blank.asp?id="+pid,"textpage","toolbar=no,scrollbars=no,width=760,height=500,top=10,left=10");	
}

function  check_asc_code(k_code_ie,k_code_nt)
{
	var acb = new Array(30);
	var ret_val;
	var show_alert=false;
	acb = ["א","ב","ג","ד","ה","ו","ז","ח","ט","י","כ","ל","מ","ם","נ","ן","ס","ע","פ","ף","צ","ץ","ק","ר","ש","ת"];
	if(isNS4 == true)
	{
		for (x=0;x<=25 ;x++ )
		{
			if(k_code_nt==acb[x].charCodeAt(0)) show_alert=true;
		}
		if(show_alert==true)
		{
			alert("נא להקליד תווים באנגלית ומספרים בלבד");
		}
		else
		{
		ret_val =  k_code_nt;
		}
		
	}
	else
	{
	
		for (x=0;x<=25 ;x++ )
		{
			if(k_code_ie == acb[x].charCodeAt(0)) show_alert=true;
		}
		if(show_alert==true)
			alert("נא להקליד תווים באנגלית ומספרים בלבד");
		else
			ret_val = k_code_ie;
	}
	
	

}

function submit_buyform(str_form)
{
	
	
	document.getElementById(str_form).submit();
	//document.getElementById(str_form).action="ssl.asp";
	//document.getElementById(str_form).target="_self";
}
