/*--------------------------------------------------------------------------*/
/*	Lightbox	
*	This is a script for creating modal dialog windows (like the ones your operating
*	system uses)
*	
*/
window.scroll(0, 0)
var Lightbox = {
	/* hideAll - closes all open lightbox windows */
	hideAll: function(){
		lboxes = document.getElementsByClassName('lbox')
		lboxes.each(function(box){
				Element.hide(box)
			}
		)
		if ($('overlay')){
			Element.remove('overlay');
			}
	}
}
Lightbox.base = Class.create();
Lightbox.base.prototype = {

	initialize: function(element, options){
		//start by hiding all lightboxes
		Lightbox.hideAll();
	
		this.element = $(element);
		this.options = Object.extend({
			lightboxClassName : 'lightbox',
			closeOnOverlayClick : false,
			externalControl : false
		}, options || {} )

		//create the overlay
		new Insertion.Before(this.element, "<div id='overlay' style='display:none;'></div>");
		
Element.addClassName(this.element, this.options.lightboxClassName)
	
		//also add a default lbox class to the lightbox div so we can find and close all lightboxes if we need to
		Element.addClassName(this.element, 'lbox')
		
		//Tip: make sure the path to the close.gif image below is correct for your setup
		closer = '<img id="close" src="/images/close.png" alt="Close" title="Закрыть окно" />'

		//insert the closer image into the div
		new Insertion.Top(this.element, closer);
		
		Event.observe($('close'), 'click', this.hideBox.bindAsEventListener(this) );
		
		if (this.options.closeOnOverlayClick){
			Event.observe($('overlay'), 'click', this.hideBox.bindAsEventListener(this) );
		}
		if (this.options.externalControl){
			Event.observe($(this.options.externalControl), 'click', this.hideBox.bindAsEventListener(this) );
		}
				
		this.showBox();	
	},
	
	showBox : function(){
		//show the overlay
	   Element.show('overlay');

		//center the lightbox
	   this.center();
	  
	   	//show the lightbox
	   Element.show(this.element);
	   return false;
	},
	
	hideBox : function(evt){	
		Element.removeClassName(this.element, this.options.lightboxClassName)
		Element.hide(this.element);
		//remove the overlay element from the DOM completely
		Element.remove('overlay');
		return false;
	},
		
	center : function(){
		var my_width  = 0;
		var my_height = 0;
		
		if ( typeof( window.innerWidth ) == 'number' ){
			my_width  = window.innerWidth;
			my_height = window.innerHeight;
		}else if ( document.documentElement && 
				 ( document.documentElement.clientWidth ||
				   document.documentElement.clientHeight ) ){
			my_width  = document.documentElement.clientWidth;
			my_height = document.documentElement.clientHeight;
		}
		else if ( document.body && 
				( document.body.clientWidth || document.body.clientHeight ) ){
			my_width  = document.body.clientWidth;
			my_height = document.body.clientHeight;
		}
		
		this.element.style.position = 'absolute';
		this.element.style.zIndex   = 99;
		
		var scrollY = 0;
		
		if ( document.documentElement && document.documentElement.scrollTop ){
			scrollY = document.documentElement.scrollTop;
		}else if ( document.body && document.body.scrollTop ){
			scrollY = document.body.scrollTop;
		}else if ( window.pageYOffset ){
			scrollY = window.pageYOffset;
		}else if ( window.scrollY ){
			scrollY = window.scrollY;
		}
		
		var elementDimensions = Element.getDimensions(this.element);
		
		var setX = ( my_width  - elementDimensions.width  ) / 2;
		var setY = ( my_height - elementDimensions.height ) / 2 + scrollY;
		
		setX = ( setX < 0 ) ? 0 : setX;
		setY = ( setY < 0 ) ? 0 : setY;
		
		this.element.style.left = setX + "px";
		this.element.style.top  = setY + "px";
		
	}

	
}



function changeCountry(country)
{
document.getElementById('russian-table').style.display = 'none';

if (country==1) {
document.getElementById('countries-table').style.display = 'none';
document.getElementById('russian-table').style.display = 'block';
}


	//document.getElementById('tarif-cz').style.display = 'none';
	//document.getElementById('tarif-1').style.display = 'none';
	//document.getElementById('tarif-ru').style.display = 'none';
	//document.getElementById('ogran').innerHTML = '';

if(country==1) document.getElementById('number').innerHTML = '3649';		
if (country==2) setTarif(930399999,'5','2.60 $');
if (country==3) setTarif(7796,'5','2.50 $');
if (country==4) setTarif(1098,'2','1.30 $');
if (country==5) setTarif(90645045,'5','3.60 $');
if (country==6) setTarif(80888,'5','2.60 $');
if (country==7) setTarif(1945,'5','3.00 $');
if (country==8) setTarif(5339,'2','1.90 $');
//if (country==9) setTarif(9915,'8','3.85 $');
if (country==9) setTarif(9915,'5','3 $');
if (country==10) setTarif(1171,'10','5 $');
if (country==11) setTarif(1874,'10','5.30 $');
if (country==12) setTarif(1645,'10','4.20 $');
if (country==13) setTarif(7117,'5','2.00 $');
if (country==14) setTarif(2322,'8','3.10 $');
if (country==15) setTarif(7910,'8','4.00 $');
if (country==16) setTarif(4565,'5','2.60 $');
if (country==17) setTarif(179479,'5','2.50 $');
if (country==18) setTarif(83868,'8','3.80 $');
if (country==19) setTarif(9090199,'10','4.35 $');
if (country==20) setTarif(72170,'5','2.60 $');
if (country==21) setTarif(17012,'5','2.60 $');  

if (country==22) setTarif(4171,'5','3 $');  
if (country==23) setTarif(1171,'10','5 $');  
if (country==24) setTarif(4545,'5','2 $');  
if (country==25) setTarif(1121,'2','2 $');  
if (country==26) setTarif(9014,'5','3 $');  


}
 



function setTarif(number,traffic,price)
{
document.getElementById('countries-table').style.display = 'block';
	document.getElementById('number').innerHTML = number;
	document.getElementById('number_td').innerHTML = number;
	document.getElementById('traffic_td').innerHTML = traffic+' ГБ';
	document.getElementById('price_td').innerHTML = price;
}

