

	if(document.images){
		cb = new Image;
		cb.src = "images/cb.gif";
		cb_checked = new Image;
		cb_checked.src = "images/cb_checked.gif";
		
		next1 = new Image;
		next1.src = "images/cart/cart_next1.jpg";
		next2 = new Image;
		next2.src = "images/cart/cart_next2.jpg";		

		oki0 = new Image;
		oki0.src = "images/cart/cart_ok0.jpg";
		oki1 = new Image;
		oki1.src = "images/cart/cart_ok1.jpg";
		oki2 = new Image;
		oki2.src = "images/cart/cart_ok2.jpg";				
	}

	function open_forum(){
			var Wwidth= 900;
			var Wheight = 800;
			var linki = 'forum.asp';
			var	Pwidth=screen.width/2-Wwidth/2;
			var	Pheight=screen.height/2-Wheight/2;
			xi=window.open(linki,"windowi","width="+Wwidth+",height="+Wheight+",scrollbars,resizable,top="+Pheight+",left="+Pwidth);
			if(xi){
				xi.focus();
			}
			else{
			}
		
	}
	


	function top_menu(num){
		
	  	var title_msg;
		switch (num){
			case 1:
				title_msg = "ספריית הפונטים";
				break;
			case 2:
				title_msg = "מחירון ועסקאות";
				break;
			case 3:
				title_msg = "פתרונות טיפוגרפיים";
				break;
			case 4:
				title_msg = "תמיכה טכנית";
				break;
			case 5:
				title_msg = "מאמרים וכתבות";
				break;
			case 6:
				title_msg = "פורום טיפוגרפיה";
				break;
			case 7:
				title_msg = "על פונטביט";
				break;
			case 8:
				title_msg = "קבצים להורדה";
				break;
			case 9:
				title_msg = "צור עמנו קשר";
				break;
			case 10:
				title_msg = "קישורים רלוונטיים";
				break;
			case 20:
				title_msg = "מפת האתר";
				break;
		}
		var flashMovie=getFlashMovieObject("topMenu");
		flashMovie.Rewind();
		flashMovie.SetVariable("/:"+"_root.titleFlag", "false");
		flashMovie.SetVariable("/:"+"_root.title", title_msg);
		flashMovie.Play();
		//RewindFlashMovie();
		//SendDataToFlashMovie('_root.titleFlag', 'false');
		//SendDataToFlashMovie('_root.title', title_msg);
		//PlayFlashMovie();
	}

	function right_menu(num){
		elem = top.document.getElementById("hidi");
		elem.style.visibility = "hidden";
		
		switch (num){
			case 0:
				stage.location = "search.asp?menu=1";
				cart.location = "cart/index.asp?mod=cart&action=view";
				top_menu(1);
				break;
			 case 9900:
			 	stage.location = "Search.asp?menu=1";
				cart.location = "cart/index.asp?mod=cart&action=view";				
				break;
			 case 9901:
			 	stage.location = "Search.asp?style=5&menu=1";
				cart.location = "cart/index.asp?mod=cart&action=view";				
				break;
			 case 9902:
			 	stage.location = "Search.asp?class=13&menu=1";
				cart.location = "cart/index.asp?mod=cart&action=view";				
				break;
			 case 9903:
			 	stage.location = "Search.asp?function=4&menu=1";
				cart.location = "cart/index.asp?mod=cart&action=view";				
				break;
			 case 9904:
			 	stage.location = "Search.asp?new=1";
				cart.location = "cart/index.asp?mod=cart&action=view";				
				break;								
			 case 9905:
			 	stage.location = "Search.asp?comp=0";
				cart.location = "cart/index.asp?mod=cart&action=view";				
				break;
			 case 9906:
			 	stage.location = "Search.asp?nikud=0";
				cart.location = "cart/index.asp?mod=cart&action=view";				
				break;				
			 case 9907:
			 	stage.location = "Search.asp?demo=1&menu=1";
				cart.location = "cart/index.asp?mod=cart&action=view";				
				break;		
			 case 9908:
			 	stage.location = "Search.asp?out=1&menu=1";
				cart.location = "cart/index.asp?mod=cart&action=view";				
				break;				
			case 1:
				top_menu(2);
				stage.location = "priceList.asp";
				cart.location = "cart/index.asp?mod=cart&action=view";		
				break;
			 case 9910:
			 	stage.location =  "priceList.asp";
				cart.location = "cart/index.asp?mod=cart&action=view";				
				break;
			 case 9911:
			 	top_menu(2);
			 	stage.location = "inner.asp?id=9911";
				cart.location = "cart.asp";				
				break;
			 case 9912:
			 	top_menu(2);
			 	stage.location = "inner.asp?id=9912";
				cart.location = "cart/index.asp?mod=cart&action=view";				
				break;							
			case 2:
				cart.location = "solutions_screen.asp";
				stage.location = "inner.asp?id=9921";	
				top_menu(3);
				break;
			case 9921:
				stage.location = "inner.asp?id=9921";
				cart.location = "solutions_screen.asp";
				
				//alert(top.getElementById("hidi"));
				top_menu(3);
				break;
			case 9922:
				stage.location = "inner.asp?id=9922";
				cart.location = "solutions_screen.asp";
				
				//alert(top.getElementById("hidi"));
				top_menu(3);
				break;									
			case 9923:
				cart.location = "solutions_screen.asp";
				stage.location = "otf.asp";	
				top_menu(3);
				break;		
			case 9924:
				cart.location = "solutions_screen.asp";
				stage.location = "inner.asp?id=9924";	
				top_menu(3);
				break;	
			case 9925:
				cart.location = "solutions_screen.asp";
				stage.location = "inner.asp?id=9925";	
				top_menu(3);
				break;												
			case 3:
				cart.location = "techSupport_screen.asp";
				stage.location = "inner.asp?id=3";	
				top_menu(4);
				break;
			case 9930:
				stage.location = "inner.asp?id=9930";
				break;
			case 9931:
				stage.location = "inner.asp?id=9931";
				break;				
			case 9932:
				stage.location = "inner.asp?id=9932";
				break;				
			case 9933:
				stage.location = "inner.asp?id=9933";			
				break;				
			case 4:
				//topbar.location = "top_bar.asp?page=5";
				top_menu(5);
				cart.location = "article_screen.asp";
				stage.location = "inner.asp?id=4";				
				break;
			case 5:
				//topbar.location = "top_bar.asp?page=6";
				open_forum();
				top_menu(6);
				break;
			case 6:
				//topbar.location = "top_bar.asp?page=7";
				cart.location = "cart.asp";
				stage.location = "inner.asp?id=6";
				top_menu(7);
				break;				
			case 7:
				cart.location = "download_screen.asp";
				stage.location = "inner.asp?id=7";	
				top_menu(8);
				break;
			case 8:
				//topbar.location = "top_bar.asp?page=9";
				top_menu(9);
				cart.location = "contact_screen.asp";
				stage.location = "inner.asp?id=8";
				break;
			case 9:
				//topbar.location = "top_bar.asp?page=10";
				top_menu(10);
				cart.location = "links_screen.asp";
				stage.location = "inner.asp?id=9";				
				break;			
			default:
				break;
		}
	}

	function search_index(chart){
		//var indexes = new Array("","א","ב","ג","ד","ה","ו","ז","ח","ט","י","כ","ל","מ","נ","ס","ע","פ","צ","ק","ר","ש","ת");
		//stage.location = "search.asp?in="+indexes[chart];

		if(location.href.indexOf("map.asp")!=-1){
			location = "search.asp?in="+chart;		
		}
		else{
			cart.location = "cart/index.asp?mod=cart&action=view";	
			stage.location = "search.asp?in="+chart;
		}
		var flashMovie=getFlashMovieObject("rightMenu");
		var message=flashMovie.GetVariable("/:currentPhase");		
		if(message!=0){
			//flashMovie.Rewind();
			flashMovie.GotoFrame(2);
			flashMovie.Play();
		}
		
		
		
	}

	function goSearch(){
	        document.formi.submit();
	}
	
	function goHome(){
	 	location="default.asp?intro=0";
	}

	function goCart(num){
		if(num<0){
		 	alert("עליך לבחור משקל כדי להוסיפו לסל הקניות\nכרגע אתה נמצא בתצוגת מספרים, אנא בחר משקל");
		}
		else{
			top.cart.location="cart/index.asp?mod=cart&action=add&id="+num;
		}
	}

	function fontWriteDemo(num){
		if(num<0){
		 	num*=-1;
		}	
		top.cart.backLoc = location.href;
		top.stage.location = "search.asp?comp="+num;
	}

	function fontDemo(num){
		if(num<0){
		 	num*=-1;
		}
		openwNoScroll("html_view.asp?id="+num,1000,700);
	}

	function goPDF(num){
		if(num<0){
		 	num*=-1;
		}
		openwRes("pdf_view.asp?id="+num,1000,700);
	}

	function fontBack(num){
	 	top.stage.location = top.cart.backLoc;
	}

	function changeImages(img_name, new_src)
	{
		if(document.images)
			document.images[img_name].src=eval(new_src+".src");
	}

	function openw(linki,Wwidth,Wheight)
	{
		var	Pwidth=screen.width/2-Wwidth/2;
		var	Pheight=screen.height/2-Wheight/2;
		x=window.open(linki,"window","width="+Wwidth+",height="+Wheight+",scrollbars,top="+Pheight+",left="+Pwidth);
		if(x){
			x.focus();
		}
		else{
		}
	}


	function openwRes(linki,Wwidth,Wheight)
	{
		var	Pwidth=screen.width/2-Wwidth/2;
		var	Pheight=screen.height/2-Wheight/2;
		x=window.open(linki,"window","width="+Wwidth+",height="+Wheight+",scrollbars,resizable=yes,top="+Pheight+",left="+Pwidth);
		if(x){
			x.focus();
		}
		else{
		}
	}


	function openwNoScroll(linki,Wwidth,Wheight)
	{
		var	Pwidth=screen.width/2-Wwidth/2;
		var	Pheight=screen.height/2-Wheight/2;
		x=window.open(linki,"window","width="+Wwidth+",height="+Wheight+",top="+Pheight+",left="+Pwidth);
		if(x){
			x.focus();
		}
		else{
		}
	}

	function init(){
		
	}



	function checkUncheckAll(theElement) {
	        var theForm = theElement.form, z = 0;
	 	for(z=0; z<theForm.length;z++){
      			if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
	  			theForm[z].checked = theElement.checked;
	        	}
	       }
        }
        
        
	function checkEmail(){
		var str=document.formi.email.value
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		if (filter.test(str)){
			testresults=true;
			//document.formi.submit();
		}
		else{
			alert("Please input a valid email address!")
			testresults = false
		}
		return testresults;
	
	}
	    /*
		function doPassVar(args){
   		var sendText = args.value;
   		window.document.myFlash.SetVariable("myVar", sendText);
		}


		function thisMovie(movieName) {
  		// IE and Netscape refer to the movie object differently.
  		// This function returns the appropriate syntax depending on the browser.
  		if (navigator.appName.indexOf ("Microsoft") !=-1) {
    		return window[movieName]
  		}	else {
    		return document[movieName]
  		}
		}

		// Checks if movie is completely loaded.
		// Returns true if yes, false if no.
		function movieIsLoaded (theMovie) {
  		if (typeof(theMovie) != "undefined") {
    		return theMovie.PercentLoaded() == 100;
  		} else {
    		return false;
  		}
		}

		function playmovie(movieName) {
  		if (movieIsLoaded(thisMovie(movieName))) {
    		thisMovie(movieName).Play();
  		}
		}

		function stopmovie(movieName) {
  		if (movieIsLoaded(thisMovie(movieName))) {
    		thisMovie(movieName).StopPlay();
  		}
		}



		function golabel(movieName,theLabel) {
  		if (movieIsLoaded(thisMovie(movieName))) {
    		thisMovie(movieName).TGotoLabel("_level0/",theLabel);
  		}
		}

		function flashGo(movieName,theFrame) {
  		if (movieIsLoaded(thisMovie(movieName))) {
    		thisMovie(movieName).GotoFrame(theFrame);
  		}
		}
        */
		
var movieName = "myFlashMovie";

function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
    return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

function StopFlashMovie()
{
	var flashMovie=getFlashMovieObject(movieName);
	flashMovie.StopPlay();
}

function PlayFlashMovie()
{
	var flashMovie=getFlashMovieObject(movieName);
	flashMovie.Play();
	//embed.nativeProperty.anotherNativeMethod();
}

function RewindFlashMovie()
{
	var flashMovie=getFlashMovieObject(movieName);
	flashMovie.Rewind();
}

function NextFrameFlashMovie()
{
	var flashMovie=getFlashMovieObject(movieName);
	// 4 is the index of the property for _currentFrame
	var currentFrame=flashMovie.TGetProperty("/", 4);
	var nextFrame=parseInt(currentFrame);
	if (nextFrame>=10)
		nextFrame=0;
	flashMovie.GotoFrame(nextFrame);		
}


function SendDataToFlashMovie(vars,args)
{
	var flashMovie=getFlashMovieObject(movieName);
	flashMovie.SetVariable("/:"+vars, args);
}

function ReceiveDataFromFlashMovie()
{
	var flashMovie=getFlashMovieObject(movieName);
	var message=flashMovie.GetVariable("/:message");
	document.controller.Data.value=message;
}
		
		
		
        var chosenCartItem,chosenCartNum
        chosenCartItem = null;
		chosenCartNum = 0
		
		function over_cart(obj){
			if(chosenCartItem!=obj){
	         	obj.className='cart_over';
			}
		}		
		

		function out_cart(obj){
			if(chosenCartItem!=obj){		
	         	obj.className='cart';
			}
		}		
		
		function chooseCartItem(obj,num){
            if(chosenCartItem!=null){
			 	 chosenCartItem.className='cart';
			}
		 	chosenCartItem = obj;
			chosenCartNum = num;
		    obj.className='cart_over';
		}
		
		var cart_del_flag = false;
		
		function delCart(){
			if(!cart_del_flag){
		 		cart_del_flag = true;
		 		location="index.asp?mod=cart&action=delete&id="+chosenCartNum;
		 	}
		}
		
		
		function cart_del(){
			if(chosenCartNum!=null){
		 		location="cart/index.asp?mod=cart&action=delete&inner=1&id="+chosenCartNum;
		 	}
		}		
		
		function checkOut(){
		    //location="index.asp?mod=cart&action=delete&id=all"
			if(total_products==0){
				alert("סל הקניות שלך ריק, בכדי להכניס פונטים לסל הקניות, לחץ על כפתור 'הוסף לסל קניות' בספריית הפונטים");
				top.stage.location = "../search.asp?menu=1";
			}
			else{
				if(total_products<4){
					alert(".ניתן לרכוש מינימום 4 משקלים");
					top.stage.location = "../search.asp?menu=1";
				}
				else{
					if(pack_font_flag){
						alert("נותרו עוד "+pack_fonts_left+" משקלים לבחירה על מנת להשלים את חבילת ה-"+pack_fonts+" משקלים");
						pack_font_flag = false;
					}
					else{
						if(pack_font_flag2){
							alert("בלחיצה על אישור הנך מוותר על זכותך לעוד "+pack_fonts_left+" משקלים");
							pack_font_flag2 = false;
							top.stage.location="../pay1.asp";
						}
						else{
							top.stage.location="../pay1.asp";
						}
					}
				}
			}
		}
		
		
		

timerID = null;

function ScrollRight(speed){
    if(document.getElementById){
        if(parseInt(txt.style.left) > cnt.offsetWidth - txt.offsetWidth)
        txt.style.left = parseInt(txt.style.left) - speed + "px";
        timerID = setTimeout("ScrollRight("+speed+")",30);
    }
}

function ScrollLeft(speed){
    if(document.getElementById){
        if(parseInt(txt.style.left) < 0)
        txt.style.left = parseInt(txt.style.left) + speed + "px";
        timerID = setTimeout("ScrollLeft("+speed+")",30);
    }

}

function ScrollStop(){
    if(document.getElementById){
        clearTimeout(timerID);
    }
}

function ScrollInit() {
    if (document.getElementById) {
        cnt = document.getElementById("cont");
        txt = document.getElementById("text");
        txt.style.left = 0;
    }
}

function resetFontSize(){
 	document.formi.fontsize.value = def_font_size;
}

function in_compare_choose(id,textim){
	 //location = "search.asp?comp="+id+"&text="+textim+"&dc=1";
	var compare_text;
	var flashMovie=getFlashMovieObject('flashc');
	compare_text = flashMovie.GetVariable('/:textim');	
	location ="search.asp?comp="+id+"&text="+URLencode(compare_text)+"&dc=1";
}
/*
function URLEncode(plaintext)
{
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
				encoded += ch;
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for

	return encoded;
}
*/
function URLencode(sStr) {
    return escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27').replace(/\//g,'%2F');
}

function otf(num) {
	if(num==0){
		location="otf.asp"
	}
	else{
		location="otf.asp?nav="+num
	}
}
 
function check_cb(num){
	var a = eval("document.formi.cb"+num);
	if(a.value=="0"){
		a.value="1";
		changeImages("icb"+num,"cb_checked");


		if(num==1){
			document.getElementById("pc_cont").style.visibility="visible";
				if(document.formi.cb5.value=="1"){
					document.getElementById("pcmac_cont").style.visibility="visible";	
					document.getElementById("pcmac_cont2").style.visibility="visible";	
				}
				else{
					document.getElementById("pcmac_cont").style.visibility="hidden";	
					document.getElementById("pcmac_cont2").style.visibility="hidden";	
				}
		}
		if(num==5){
			document.getElementById("mac_cont").style.visibility="visible";
				if(document.formi.cb1.value=="1"){
					document.getElementById("pcmac_cont").style.visibility="visible";	
					document.getElementById("pcmac_cont2").style.visibility="visible";	
				}	
				else{
					document.getElementById("pcmac_cont").style.visibility="hidden";	
					document.getElementById("pcmac_cont2").style.visibility="hidden";	
				}				
		}

	}
	else{
		a.value="0";
		changeImages("icb"+num,"cb");	

		if(num==1){
			document.getElementById("pc_cont").style.visibility="hidden";

			document.getElementById("pcmac_cont").style.visibility="hidden";	
			document.getElementById("pcmac_cont2").style.visibility="hidden";	

		}
		if(num==5){
			document.getElementById("mac_cont").style.visibility="hidden";

			document.getElementById("pcmac_cont").style.visibility="hidden";	
			document.getElementById("pcmac_cont2").style.visibility="hidden";	
			
		}


	}
	
	checkSumi();
}

function checkSumi(){
	var a = eval("document.formi.cb1");
	var b = eval("document.formi.cb5");
	
	if(a.value=="1" && b.value=="1"){
		fsum = rounddig(sum*1.3);
		document.getElementById("sumi").innerHTML = fsum;
		
		
	}
	else{
		fsum = sum;
		document.getElementById("sumi").innerHTML = fsum;
	}
	
	checkSumi_c();
}


function rounddig(n)
{
 pennies = n * 100;

 pennies = Math.round(pennies);

 strPennies = "" + pennies;
 len = strPennies.length;

 return strPennies.substring(0, len - 2) + "." + strPennies.substring(len - 2, len);
}


function checkSumi_c(){
	var comp_num = parseInt(document.formi.comp_number.value);
	if(comp_num>50){
		alert("להזמנה של יותר מ-50 מחשבים אנא התקשר לפונטביט 6831234 - 03.");
	}
	else{
		var factori = Math.floor((comp_num-1)/5);
		var new_sum = rounddig(fsum*Math.pow(1.3,factori));
		document.getElementById("sumi").innerHTML = new_sum;
		document.formi.sum.value = new_sum;
	}
	
}

function pay4(){
	if(document.formi.cb1.value=="0" && document.formi.cb5.value=="0"){
		alert("PC או MAC אנא בחר פורמט פונט ");
	}
	else{
		document.formi.submit();
	}
}

function check_form(){
	if(document.formi.contact_name.value!="" && document.formi.phone.value!="" && document.formi.company.value!="" && document.formi.address.value!="" && document.formi.fax.value!="" && document.formi.mobile.value!="" && document.formi.email.value!=""){
		//var flashMovie=getFlashMovieObject("oki");
		//flashMovie.GotoFrame(2);
		document.getElementById("but0").innerHTML = "<a href='javascript:document.formi.submit();' onmouseover=changeImages('but','oki2'); onmouseout=changeImages('but','oki1');><img name='but' src='images/cart/cart_ok1.jpg' width='80' height='23' border='0'></a>"
	}
}

function check_form2(){
	if(document.formi.contact_name.value!="" && document.formi.phone.value!="" && document.formi.company.value!="" && document.formi.address.value!="" && document.formi.phone.value!="" && document.formi.fax.value!="" && document.formi.mobile.value!="" && document.formi.email.value!=""){
		//var flashMovie=getFlashMovieObject("oki");
		//flashMovie.GotoFrame(2);
		document.getElementById("but0").innerHTML = "<a href='javascript:document.formi.submit();' onmouseover=changeImages('but','oki2'); onmouseout=changeImages('but','oki1');><img name='but' src='images/cart/cart_ok1.jpg' width='80' height='23' border='0'></a>"
	}
}

function check_cb2(num){
	var a = eval("document.formi.cb"+num);
	if(a.value=="0"){
		document.formi.action = "club3.asp";
		a.value="1";
		changeImages("icb"+num,"cb_checked");
	}
	else{
		document.formi.action = "club4.asp";
		a.value="0";
		changeImages("icb"+num,"cb");	
	}

}
function clearCart(){
	
	location = "hp.asp";
}

function site_english(){
	//alert("Coming Soon...");
	location = "http://fontbit.co.il/default.asp?loc=inner%2Easp%3Fid%3D10002";
}

function search_site(){
	alert("Coming Soon...");
}

