﻿var clickmessage="Copyright"
function disableclick(ev) {
		{if (document.all)
		{if (event.button==2 || event.button==3)
		{if (event.srcElement.tagName=="IMG")
		{alert(clickmessage);
		return false;}}}
		if (document.layers)
		{if (ev.which==3)
		{alert(clickmessage);
		return false;}}}
}

function associateimages(){
		{for (i=0;i<document.images.length;i++)
		document.images[i].onmousedown=disableclick}

		if (document.all)
		document.onmousedown=disableclick
		else if (document.layers)
		associateimages();
}

function ShowHide(a,b){
  obj1=document.getElementById(a);
  obj2=document.getElementById(b);
  obj1.style.display="block";
  obj2.style.display="none";
}

function winop(winname,h,w,l,t){
  windop = window.open(winname,"small","height="+h+",width="+w+",left="+l+",top="+t);
  windop.focus();
}

function noclic(clic){
   return true;
}

function setcurpage(id){
	document.res.cur_page.value=id;
	document.res.submit();
}

function setsort(id){
document.res.sort.value=id; 
document.res.submit();
}

//start info
function ShowHideTable(a,b,c,d)
{
	obj1=document.getElementById(a);
	obj2=document.getElementById(b);
	obj1.style.display="block";
	obj2.style.display="none";
	document.getElementById(c).className='selected';
	document.getElementById(d).className='';
}
function validation( btn )
{
  var vSubmit = document.getElementById('submit_type');
  vSubmit.value = btn;
  //smallform.submit();
}
//end info

// PARAMETRAGE DU SCRIPT
var tjs_delai=20;
var tjs_max=50;
var tjs_mode=0; // 0 - calque toujours en haut de page / 1 - calque en bas

// LE RESTE NE CHANGE PAS
var tjs_hauteur=0;
function PrintCalque() {
	setTimeout("Start()",tjs_delai);
}
function Start() {
	// Toujours en haut :
	MoveLayer("tomber",GetTop("tomber"));
	setTimeout("Start()",tjs_delai);
}

function MoveLayer(nom,top) {
	if (document.getElementById) { //IE5 et NS6
		document.getElementById(nom).style.top=top;
	}
	if ((document.all)&&(!document.getElementById)) { //IE4 seul
		document.all[nom].style.top=top;
	}
	if (document.layers) { //NS4.X seul
		document.layers[nom].top=top;
	}
}

function GetTop(nom) {
	// Partie 1 : R?cup?ration de la position du calque et de la page
	if (document.getElementById) { //IE5
		var pos=parseInt(document.getElementById(nom).style.top);
		var wintop=parseInt(document.body.scrollTop);
		var avail=document.body.clientHeight;
	}
	if ((document.getElementById)&&(!document.all)) { //NS6
		var pos=parseInt(document.getElementById(nom).style.top);
		var wintop=parseInt(window.pageYOffset);
		var avail=window.innerHeight;
	}
	if ((document.all)&&(!document.getElementById)) { //IE4 seul
		var pos=parseInt(document.all[nom].style.top);
		var wintop=parseInt(document.body.scrollTop);
		var avail=document.body.clientHeight;
	}
	if (document.layers) { //NS4.X seul
		var pos=parseInt(document.layers[nom].top);
		var wintop=parseInt(window.pageYOffset);
		var avail=window.innerHeight;
	}

	// Partie 2 : Traitement de la position
	if (tjs_mode==0) { // toujours en haut
		var delta=Math.ceil((pos-wintop)/3);
		if (delta>20) {delta=20;}
		if (delta<-20) {delta=-20;}
		var top=pos-delta;
	}
	if (tjs_mode==1) {// toujours en bas
		var delta=Math.ceil((pos-(wintop+avail-tjs_hauteur)));
		if (delta>tjs_max) {delta=tjs_max;}
		if (delta<-1*tjs_max) {delta=-1*tjs_max;}
		var top=pos-delta;
	}
	//alert(top);
	return top;
}

function validation_smart_agent( btn )
{
    if (document.buy_form.email.value == '') {alert('נא למלא דוא"ל');document.buy_form.email.focus();}
    else if (document.buy_form.fname.value == '') {alert('נא למלא שם');document.buy_form.fname.focus();}
    else if (!VerifEmail(document.buy_form.email.value)) {alert('נא לרשום דוא"ל תקין');document.buy_form.email.focus();}
    else if (document.buy_form.city.value == '-1')alert('נא לבחור עיר');
    else if (document.buy_form.cagree.checked == false)alert('נא להסכים עם התנאים');
    else document.buy_form.submit();

}

function VerifEmail(email)
{
   var place = email.indexOf("@",1);
   var point = email.indexOf(".",place+1);
   if ((place > -1)&&(email.length >2)&&(point > 1))return(true);
   else return(false);
}

function SetLangageSite(lang){
    var url = window.location.href;
    pos = url.lastIndexOf('hebrew/');
    url = url.substring(pos+6);
    var path = "http://www.lagur.com/";
    url = path+lang+url;
    window.location.href = url;
}

function CreateBookmarkLink() {
    var title = window.document.title; 
      // Blogger - Replace with <$BlogItemTitle$> 
      // MovableType - Replace with <$MTEntryTitle$>

    var url = window.location.href;  

    if (window.sidebar) { // Mozilla Firefox Bookmark
        window.sidebar.addPanel(title, url,"");
    } else if( window.external ) { // IE Favorite
        window.external.AddFavorite( url, title); }
    else if(window.opera && window.print) { // Opera Hotlist
        return true; }
 }

