/*
	CET Virtual Library™

	Centre for Educational Technology,
	Ramat-Aviv, Israel.
	http://lib.cet.ac.il/

	WARNING.JS
*/

	var status = 2
	
	function on_down(el)
	{
		el.className = "clsButtonDown"
	}

	function on_up(el)
	{
		el.className = "clsButton"
	}

	function on_warning_click(el)
	{
		Warning.style.visibility = "hidden"	
		if (el.name == "OK" ){
			
			if ( status == 1 )
				window.print ()
			else if (status == 2)
			{				
				var rng = document.body.createTextRange();
				rng.collapse();
				rng.moveToPoint((document.body.offsetWidth/2),(document.body.offsetHeight/2))
				rng.expand("word");
				rng.select();
				rng.execCommand("Copy");
				rng.moveToPoint(1,1);
				rng.collapse();
				rng.select();
			}			
		}
				
	}
	
	function on_out(el)
	{
		el.className = "clsButton"
	}
	
	function on_print()
	{
		status = 1
		open_warning()
	}
	
	function on_copy()
	{
		status = 2
		open_warning()
	}

	function on_copy_selection()
	{
		
		status = 3
		var Q = window.document.selection.createRange().text
		if ( !Q )
		{
			WarningText.innerHTML = WarningAlt2.innerHTML
		}
		else
		{		
			window.clipboardData.setData("Text",Q)
			WarningText.innerHTML = WarningAlt.innerHTML
		}
		
		open_warning2()
	}
		
	function open_warning()
	{		
		Warning.style.posLeft = (document.body.offsetWidth/2) - (Warning.offsetWidth/2)
		Warning.style.posTop = (document.body.scrollTop + document.body.offsetHeight/2) - (Warning.offsetHeight/2)
		Warning.style.visibility = ""
	}
	
	function open_warning2()
	{
		Warning.style.posLeft = document.body.offsetWidth - 600
		Warning.style.posTop = document.body.all("footer_ctl").offsetTop - 50
		Warning.style.visibility = ""
	}
