// JavaScript Document

var External= Class.create();

External.prototype = {
	 	
	
	
	initialize: function(){
		// base info

		this.home = 'pages/';
		this.ext = '.php';
		this.buddha = 'img';
		this.place = 'content';
		//this.place='topcontent';
		// inner states
		this.used=false;
		this.current='nothing';
		this.inplace=false;
		this.completed=true;
		this.internal=document.getElementById("img");
		//alert (this.internal);
		//this.internal.style.visibility="hidden";
	
		
	},
	
	backhome: function() {
		
		if (this.inplace) {
			this.back();
			this.inplace=false;
		}
		else {
			var e= new Effect.BlindDown (this.buddha, {curation:2, queue:'front'});
		};
	},
		
	
	load: function(name) {
	 
     //alert ("load called");
	 isExternal=true;
	 document.getElementById("topcontent").style.visibility="hidden";
	// document.getElementById("ext").style.visibility="visible";
	//document.getElementById("test").style.visibility="hidden";
	 
	 var url = this.home + name + this.ext;
	 var myAjax = new Ajax.Updater(
	      this.place,
		  url,
		  {method: 'get'});
		 var e= new Effect.BlindDown (this.place, {duration:2, queue: 'front'});
	 this.current=name;
	 //document.getElementById("test").style.visibility="hidden";
	// document.getElementById("ext").style.visibility="visible";
	  
	  
	// document.getElementById("loader").style.visibility="hidden";
	// document.getElementById("topcontent").style.visibility="hidden";
	// document.getElementById("subpage").style.visibility="hidden";  
	 //document.getElementById("topcontent").style.zIndex=0;
	 
	 },  
	 
	  gatewaytest: function (name) {
	  
	   if (completed){
		   completed=false;
	   if (name != this.current) {
		   this.load(name);
	   }
	   else {
		   this.effectit();
	   };
	   if (!this.inplace) {
		   this.move();
	   
	   };
	   completed=true;
	   };
	   
	   
	 },
	 
	 gateway: function (name) {
		 
	  
	
	   if (name != this.current) {
		   this.load(name);
	   }
	   else {
		   this.effectit();
	   };
	   if (!this.inplace) {
		   this.move();
	   };
	   
	 },
	 
	 effectit: function() {
		 var e= new Effect.BlindDown (this.place, {duration:2, queue: 'front'});
	 },
	 
	 move: function() {
       //alert ("I am called");
       new Effect.Scale ("img", 50, {duration:2, scaleFromCenter:false, queue:'nowhere'});
       new Effect.MoveBy ("img", 0, -100, {duration: 2});
       new Effect.MoveBy(
		    "subpage", -970, -950,
			{duration:2, queue: 'nowhere'});
	   this.inplace=true;


		  
    },
	
	back: function(){
	   new Effect.Scale ("img", 200, {duration:2, scaleFromCenter:false, queue:'nowhere'});
       new Effect.MoveBy ("img", 0, 100, {duration: 2});
       new Effect.MoveBy(
		    "subpage", 970, 950,
			{duration:2, queue: 'nowhere'});
	   this.inplace=false;
	}
		
}

    
	
	