function getVar(name)
 {
         get_string = document.location.search;         
         return_value = '';
         
            name_index = get_string.indexOf(name + '=');
            
            if(name_index != -1)
              {
              get_string = get_string.substr(name_index + name.length + 1, get_string.length - name_index);
              end_of_value = get_string.indexOf('&');
              if(end_of_value != -1)                
                return_value = get_string.substr(0, end_of_value);                
              else                
                return_value = get_string;                
              }
         
         return(eval(return_value));        
}
		 
function getProperty(el,NNprop,IEprop) {
	
	var o = document.getElementById(el);
	if (navigator.appName != "Microsoft Internet Explorer") {
		var v = document.defaultView.getComputedStyle(o,null).getPropertyValue(NNprop);
	} else {
		var v = eval('o.currentStyle.' + IEprop);
	}
	return v;
}

function Coordinates(level) {
	this.cmleft = getProperty("card" + level, "left","left");
	this.cmtop = getProperty("card" + level ,"top", "top");
	this.czi = getProperty("card" + level ,"z-index", "zIndex");
	this.fmleft = getProperty("flag" + level + "-env","left", "left");
	this.fmtop = getProperty("flag" + level + "-env","top", "top");
	this.fzi = getProperty("flag" + level + "-env","z-index", "zIndex");
}

function init() {
	f=1;
	level=getVar("l");
	Visibility(level);
}

window.onload=init;


function Swop(level) {
	act = new Coordinates(level);
	with(document.getElementById("card" + level).style) {
		left = first.cmleft;
		top = first.cmtop;
		zIndex = first.czi;
		overflow = 'auto';
	}
	with(document.getElementById("flag" + level + "-env").style) {
		top = first.fmtop;
		zIndex = first.fzi;
	}
	with(document.getElementById("card" + f).style) {
		left = act.cmleft;
		top = act.cmtop;
		zIndex = act.czi;
		overflow = 'hidden';		
	}
	with(document.getElementById("flag" + f + "-env").style) {	
		top = act.fmtop;
		zIndex = act.fzi;
	}
	f = level;
}

function Visibility(level) {

  switch(level) {
    case 1 : 
			first = new Coordinates(f);
			Swop(level);
	     	break;
    case 2 : 
			first = new Coordinates(f);
			Swop(level);
	     	break;
    case 3 :  
			first = new Coordinates(f);
			Swop(level);
	     	break;
    case 4 :  
			first = new Coordinates(f);
			Swop(level);
	     	break;
    case 5 :  
			first = new Coordinates(f);
			Swop(level);
	     	break;
    case 6 : 
			first = new Coordinates(f);
			Swop(level);
	     	break;
    case 7 : 
			first = new Coordinates(f);
			Swop(level);
	     	break;

   default :
	     break;
 }
}
