	
	var _page;
    var subpage;
    var currentPage;
    var CONFIG_URL = "http://www.seemybulgaria.net/smb/";
    var newPage = false;
	var checkPage;
    _page = window.location.hash.toString();
    var contentDiv;
    var _mapDiv;
	var mapObj;
    var _pageDiv;
	var _viewObjectDiv;
	checkPage = setInterval("History();", 1000);
	var historyArray = Array()
	var d = document;
	var registrationPanelOpened = false;
	var loginPanelOpened = false;
	var addObjectPanelOpened = false;
	var myObjectPanelOpened = false;

  window.onload = init;
  
 // function gotoStep(stepNum){
  //alert($('addObjFrame').contentWindow.document.getElementById('1').tagName);
  function gotoStep(e,stepNum){
  
  var i=1;
	while(i!=7){
		$('addObjFrame').contentWindow.document.getElementById("s"+i.toString()).style.display = "none";
		i++;
	}
	
	$('step_tab1').style.background = "#fff";
	$('step_tab2').style.background = "#fff";
	$('step_tab3').style.background = "#fff";
	$('step_tab4').style.background = "#fff";
	$('step_tab5').style.background = "#fff";
	$('step_tab6').style.background = "#fff";
	$('step_tab7').style.background = "#fff";
	$('step_tab'+stepNum).style.background = "#ccc";
	$('addObjFrame').contentWindow.document.getElementById("s7").style.display = "none";
	$('addObjFrame').contentWindow.document.getElementById("s"+stepNum).style.display = "block"; 
	$('addObjFrame').contentWindow.document.getElementById("objData").blur();
	$('addObjFrame').contentWindow.document.getElementById("tags").blur();
	$('addObjFrame').contentWindow.document.getElementById("cats").blur();
	
		var fader = document.createElement("INPUT");
		fader.style.height = "0px;";
		$('fake_inp').appendChild(fader);
		fader.focus();
		$('fake_inp').innerHTML = "";
  }
  

  
  
  function addObject(){
	fader();
	
			if(!addObjectPanelOpened){
		
			addObjectPanelOpened = true;
			if($('addObject_panel') && $('addObject_panel').style.visibility == "hidden"){
			
				setOpacityProperty($('addObject_panel'), 0);
				$('addObject_panel').style.display = "block";
				$('addObject_panel').style.visibility ="visible";
				setOpacity('addObject_panel',0, 9, 1);
				
				return true;
			}
		
			var w = (parseInt(getDocumentWidth()) -850 )/2;
			var h = (parseInt(getDocumentHeight()) - 600 )/2;
		
			var _container = document.createElement("DIV");
			_container.style.left = w+"px";
			_container.style.top = "30px";
			
			document.body.appendChild(_container);
			var ID = "addObject_panel";
			
			setOpacityProperty($('addObject_panel'), 0);
			_container.id = ID;
			_container.className = "addObject_panel";
			_container.style.zIndex = 10;
			_container.style.background ="#fff";
			_container.style.position ="absolute";
			_container.style.width = "850px";
			_container.style.height = "600px";
			_container.style.border = "5px solid green";
			_container.style.padding = "5px";
			_container.style.cursor = "default";
			_container.style.color = "#000";
			setOpacity('addObject_panel',0, 9, 1);
			page = "addObject";
			var AJAXRequest = makeRequest();
			//AJAXRequest.overrideMimeType('text/html');
			AJAXRequest.open("GET", page + ".php", true);
            AJAXRequest.onreadystatechange = function () {if (AJAXRequest.readyState == 4 || AJAXRequest.readyState == "complete") {if (AJAXRequest.status == 200) 
					{
						_container.innerHTML =AJAXRequest.responseText;
											
					} 

					else {_container.innerHTML = AJAXRequest.status;}
				}};
            AJAXRequest.send(null);
		}else{
			addObjectPanelOpened = false;
			$('login_panel').style.display = "none";
			$('login_panel').style.visibility ="hidden";
			setOpacity('login_panel',  9, 0, 0);
		}
  }
  
  
  function myObjects(){
	fader();
	
			if(!myObjectPanelOpened){
		
			myObjectPanelOpened = true;
			if($('myObject_panel') && $('myObject_panel').style.visibility == "hidden"){
			
				setOpacityProperty($('myObject_panel'), 0);
				$('myObject_panel').style.display = "block";
				$('myObject_panel').style.visibility ="visible";
				setOpacity('myObject_panel',0, 9, 1);
				
				return true;
			}
		
			var w = (parseInt(getDocumentWidth()) -850 )/2;
			var h = (parseInt(getDocumentHeight()) - 600 )/2;
		
			var _container = document.createElement("DIV");
			_container.style.left = w+"px";
			_container.style.top = "30px";
			
			document.body.appendChild(_container);
			var ID = "myObject_panel";
			
			setOpacityProperty($('myObject_panel'), 0);
			_container.id = ID;
			_container.className = "myObject_panel";
			_container.style.zIndex = 10;
			_container.style.background ="#fff";
			_container.style.position ="absolute";
			_container.style.width = "850px";
			_container.style.height = "600px";
			_container.style.border = "5px solid green";
			_container.style.padding = "5px";
			_container.style.cursor = "default";
			_container.style.color = "#000";
			setOpacity('myObject_panel',0, 9, 1);
			page = "myObjects";
			var AJAXRequest = makeRequest();
			//AJAXRequest.overrideMimeType('text/html');
			AJAXRequest.open("GET", page + ".php", true);
            AJAXRequest.onreadystatechange = function () {if (AJAXRequest.readyState == 4 || AJAXRequest.readyState == "complete") {if (AJAXRequest.status == 200) 
					{
						_container.innerHTML =AJAXRequest.responseText;
											
					} 

					else {_container.innerHTML = AJAXRequest.status;}
				}};
            AJAXRequest.send(null);
		}else{
			myObjectPanelOpened = false;
			$('login_panel').style.display = "none";
			$('login_panel').style.visibility ="hidden";
			setOpacity('login_panel',  9, 0, 0);
		}
  }
  
	function jswin(page){
		window.open(page, "newwin", "width=600,height=450,toolbar=true,locationbar=0,directories=true,status=false,menubar=true,scrollbars=1,resizable=1");
	}

	function register(){
		if(!registrationPanelOpened){
		
			registrationPanelOpened = true;
			if($('register_panel') && $('register_panel').style.visibility == "hidden"){
			
				setOpacityProperty($('register_panel'), 0);
				$('register_panel').style.display = "block";
				$('register_panel').style.visibility ="visible";
				setOpacity('register_panel',0, 8.5, 1);
				
				return true;
			}
		
			var w = (parseInt(getDocumentWidth()) - 400 )/2;
			var h = (parseInt(getDocumentHeight()) - 400 )/2;
		
			var _container = document.createElement("DIV");
			_container.style.left = w+"px";
			_container.style.top = "120px";
			
			document.body.appendChild(_container);
			var ID = "register_panel";
			
			setOpacityProperty($('register_panel'), 0);
			_container.id = ID;
			_container.className = "register_panel";
			_container.style.zIndex = 10;
			_container.style.background ="#fff";
			_container.style.position ="absolute";
			_container.style.width = "400px";
			_container.style.border = "5px solid green";
			_container.style.padding = "10px";
			_container.style.cursor = "default";
			_container.style.color = "#000";
			setOpacity('register_panel',0, 8.5, 1);
			page = "registration_form";
			var AJAXRequest = makeRequest();
			//AJAXRequest.overrideMimeType('text/html');
			AJAXRequest.open("GET", page + ".php", true);
            AJAXRequest.onreadystatechange = function () {if (AJAXRequest.readyState == 4 || AJAXRequest.readyState == "complete") {if (AJAXRequest.status == 200) 
					{
						_container.innerHTML =AJAXRequest.responseText;
						
						var forma = $('registration_form');
						for(i=forma.elements.length-1;i>=0;i--){
							if(forma.elements[i].name == "doit"){
								addEventN(forma.elements[i],"click", doitRegister);
							}
						}
						
					} 

					else {_container.innerHTML = AJAXRequest.status;}
				}};
            AJAXRequest.send(null);
		}else{
			registrationPanelOpened = false;
			$('register_panel').style.display = "none";
			$('register_panel').style.visibility ="hidden";
			setOpacity('register_panel', 8.5, 0, 0);
		}
	}
	


	function login(){
		if(!loginPanelOpened){
		
			loginPanelOpened = true;
			if($('login_panel') && $('login_panel').style.visibility == "hidden"){
			
				setOpacityProperty($('login_panel'), 0);
				$('login_panel').style.display = "block";
				$('login_panel').style.visibility ="visible";
				setOpacity('login_panel',0, 8.5, 1);
				
			page = "login_form";
			var AJAXRequest = makeRequest();
			//AJAXRequest.overrideMimeType('text/html');
			AJAXRequest.open("GET", page + ".php", true);
            AJAXRequest.onreadystatechange = function () {if (AJAXRequest.readyState == 4 || AJAXRequest.readyState == "complete") {if (AJAXRequest.status == 200) 
					{
						_container.innerHTML =AJAXRequest.responseText;
						
						var forma = $('login_form');
						for(i=forma.elements.length-1;i>=0;i--){
							if(forma.elements[i].name == "doit"){
								addEventN(forma.elements[i],"click", doitLogin);
							}
						}
						
					} 

					else {_container.innerHTML = AJAXRequest.status;}
				}};
            AJAXRequest.send(null);
			
			
				return true;
			}
		
			var w = (parseInt(getDocumentWidth()) - 400 )/2;
			var h = (parseInt(getDocumentHeight()) - 400 )/2;
		
			var _container = document.createElement("DIV");
			_container.style.left = w+"px";
			_container.style.top = "120px";
			
			document.body.appendChild(_container);
			var ID = "login_panel";
			
			setOpacityProperty($('login_panel'), 0);
			_container.id = ID;
			_container.className = "login_panel";
			_container.style.zIndex = 10;
			_container.style.background ="#fff";
			_container.style.position ="absolute";
			_container.style.width = "400px";
			_container.style.border = "5px solid green";
			_container.style.padding = "10px";
			_container.style.cursor = "default";
			_container.style.color = "#000";
			setOpacity('login_panel',0, 8.5, 1);
			page = "login_form";
			var AJAXRequest = makeRequest();
			//AJAXRequest.overrideMimeType('text/html');
			AJAXRequest.open("GET", page + ".php", true);
            AJAXRequest.onreadystatechange = function () {if (AJAXRequest.readyState == 4 || AJAXRequest.readyState == "complete") {if (AJAXRequest.status == 200) 
					{
						_container.innerHTML =AJAXRequest.responseText;
						
						var forma = $('login_form');
						for(i=forma.elements.length-1;i>=0;i--){
							if(forma.elements[i].name == "doit"){
								addEventN(forma.elements[i],"click", doitLogin);
							}
						}
						
					} 

					else {_container.innerHTML = AJAXRequest.status;}
				}};
            AJAXRequest.send(null);
		}else{
			loginPanelOpened = false;
			$('login_panel').style.display = "none";
			$('login_panel').style.visibility ="hidden";
			setOpacity('login_panel', 8.5, 0, 0);
		}
	}

	function doitRegister(){
	{
		var forma = $('registration_form');
		var error;
		var error1;

		for(i=forma.elements.length-1;i>=0;i--){
			if(forma.elements[i].className == "required" && !forma.elements[i].value.match(/\S/) && forma.elements[i].name != "agree"){
				error = forma.elements[i];
			}
			
			if(forma.elements[i].className == "required" && forma.elements[i].value.length<6 && forma.elements[i].name != "captcha" && forma.elements[i].name != "agree"){
				error = forma.elements[i];
			}
			
			if(forma.elements[i].name == "email" && !forma.elements[i].value.match(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i)){
				error = forma.elements[i];
			}
			
			
			if(forma.elements[i].name == "re_email"){
				if(forma.elements[i].value != forma.elements[i-1].value){
					error = forma.elements[i];
				}
			}
			
			if(forma.elements[i].name == "password"){
				if(forma.elements[i].value.length < 6){
					error = forma.elements[i];
				}
			}
			if(forma.elements[i].name == "re_password"){
				if(forma.elements[i].value != forma.elements[i-1].value){
					error = forma.elements[i];
				}
			}
			if(forma.elements[i].name == "agree" && !forma.elements[i].checked){
				error1 = document.getElementById("agreement");
				error1.style.background = "red";
				error1.focus();
				forma.elements[i].onchange = function(){
					document.getElementById("agreement").style.background = "";	
				}
			}

		}
		
				
			if(error){
				error.style.border = "2px solid red";
				error.focus();
				error.onchange = function(){
					this.style.border = "2px solid #000";	
				}
			}
			
			if(!error && !error1){
			
			var xhr = makeRequest();
			var reg_username = document.getElementById('_reg_username').value;
			var reg_pass = document.getElementById('_reg_password').value;
			var reg_email = document.getElementById('_reg_email').value;
			var reg_captcha = document.getElementById('_reg_captcha').value;
			
			fake = parseInt(new Date().getTime().toString().substring(0, 10));

			var url = "ajax_register.php";
			var params = "reg_username="+reg_username+"&reg_pass="+reg_pass+"&reg_email="+reg_email+"&reg_captcha="+reg_captcha+"&fake="+fake;
			xhr.open("POST", url, true);

			xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xhr.setRequestHeader("Content-length", params.length);
			xhr.setRequestHeader("Connection", "close");

			xhr.onreadystatechange = function() {
				if(xhr.readyState == 4 && xhr.status == 200) {
					if(xhr.responseText == "duplicate username"){
						alert('Потребителското име е вече заето, моля изберете друго');
						document.getElementById('_reg_username').value = "";
						document.getElementById('_reg_username').focus();
					}else if(xhr.responseText == "code"){
						alert('Грешен код от картинката');
						document.getElementById('captcha').value="";							
						document.getElementById('captcha').focus();
					}else if(xhr.responseText == "duplicate email"){
						alert('Email-a е вече зает, моля изберете друг');
						document.getElementById('_reg_email').value="";							
						document.getElementById('_reg_email').focus();
					}else{
					
						document.getElementById('registration_form').innerHTML = "Успешна регистрация! Моля, активирайте своя профил от пощата си !";
					}
					}
				}
				xhr.send(params);
			}
		}
	}
	
	function logout(){
		var AJAXRequest = makeRequest();
		//AJAXRequest.overrideMimeType('text/html');
        AJAXRequest.open("GET", "ajax_logout.php", true);
        AJAXRequest.onreadystatechange = function () {if (AJAXRequest.readyState == 4 || AJAXRequest.readyState == "complete") {if (AJAXRequest.status == 200) 
		{
			window.location.reload();
		}
		}};
         AJAXRequest.send(null);
	}
	
	function doitLogin(){
	{
		var forma = $('login_form');
		var error;

		for(i=forma.elements.length-1;i>=0;i--){
			if(!forma.elements[i].value.match(/\S/)){
				error = forma.elements[i];
			}

		}
						
			if(error){
				error.style.border = "2px solid red";
				error.focus();
				error.onchange = function(){
					this.style.border = "2px solid #000";	
				}
			}
			
			if(!error){
			
			var xhr = makeRequest();
			var login_username = document.getElementById('_login_username').value;
			var login_pass = document.getElementById('_login_password').value;
			var login_captcha = document.getElementById('_login_captcha').value;
			
			fake = parseInt(new Date().getTime().toString().substring(0, 10));

			var url = "ajax_login.php";
			var params = "login_username="+login_username+"&login_pass="+login_pass+"&captcha="+login_captcha+"&fake="+fake;
			xhr.open("POST", url, true);

			xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xhr.setRequestHeader("Content-length", params.length);
			xhr.setRequestHeader("Connection", "close");

			xhr.onreadystatechange = function() {
				if(xhr.readyState == 4 && xhr.status == 200) {
					if(xhr.responseText == "error"){
						alert('Грешени потребител/парола или неактивен акаунт !');
						document.getElementById('_login_username').value = "";
						document.getElementById('_login_username').focus();
					}else if(xhr.responseText == "code"){
						alert('Грешен код от картинката');
						document.getElementById('captcha').value="";							
						document.getElementById('captcha').focus();
					}else if(xhr.responseText == "activate"){
						alert('Неактивиран профил! Моля активирайте профила си!');		
						loginPanelOpened = false;
						$('login_panel').style.display = "none";
						$('login_panel').style.visibility ="hidden";
						setOpacity('login_panel', 8.5, 0, 0);
					}else{
						$('username').innerHTML = xhr.responseText;
						$('username').innerHTML += '<span style="cursor: pointer;color: red;font-size: 8px;" alt="Излез" title="Излез" onclick="logout();">[x]</span>';
						$('user_menu').innerHTML = '<div onclick="javascript: addObject();" class="menu_button"><div class="spacer">Добави обект</div></div>';
						$('user_menu').innerHTML += '<div onclick="javascript: myObjects();" class="menu_button"><div class="spacer">Мои Обекти</div></div>';
						//$('user_menu').innerHTML += '<div onclick="javascript: favObjects();" class="menu_button"><div class="spacer">Любими Обекти</div></div>';
						$('user_menu').innerHTML += '<div class="menu_button"><div class="spacer"><a style="text-decoration: none;color: white" href="profile.php">Профил</a></div></div>';
						//$('user_menu').innerHTML += '<div onclick="javascript: friends();" class="menu_button"><div class="spacer">Приятели</div></div>';
						loginPanelOpened = false;
						$('login_panel').style.display = "none";
						$('login_panel').style.visibility ="hidden";
						setOpacity('login_panel', 8.5, 0, 0);
					}
					}
				}
				xhr.send(params);
			}
		}
	}
	
	function showSearchPanel(xPos, yPos){
		var panelContainer = document.createElement("DIV");
		panelContainer.style.left = xPos+"px";
		panelContainer.style.top = yPos+"px";
		
		document.body.appendChild(panelContainer);
		var ID = "search_panel";
		panelContainer.id = ID;
		panelContainer.className = "search_panel";
		panelContainer.style.zIndex = 10;
		panelContainer.style.background ="#fff";
		panelContainer.style.position ="absolute";
		panelContainer.style.width = "200px";
		panelContainer.style.height = "300px";
		panelContainer.style.cursor = "default";
	}
  
    function init() {
		addEventN($('search_input'), "keydown", searchObject);
		addEventN($('search_input'), "focus", function(e){
			this.value="";targ = getTarg(e);
			var searchPanelX = parseInt(findPosX(targ))+parseInt(targ.style.width);
			var searchPanelY = parseInt(findPosY(targ))+parseInt(targ.style.height);
			
	//		showSearchPanel(searchPanelX,searchPanelY);
		}
		
		);
		
		contentDiv = $("content");
		_mapDiv = $("_map");
		_pageDiv = $("_page");
		_viewObjectDiv = $("viewObject");
        var divs = document.getElementsByTagName("a");
        for (var i = 0; i < divs.length; i++) {
            if (divs[i].className == "menu_button") {
                divs[i].onmouseover = function () {this.style.backgroundImage = "url(themes/Default/img/menu_button_on.gif)";};
                divs[i].onmouseout = function () {this.style.backgroundImage = "url(themes/Default/img/menu_button_off.gif)";};
            }
        }
		if(navigator.userAgent.search(/msie/i)!= -1){
        var areas = document.getElementsByTagName("AREA");
        for (var i = 0; i < areas.length; i++) {
            areas[i].onmouseover = function (){
				document.body.style.cursor = "pointer";
			}
            areas[i].onmouseout = function (){
				document.body.style.cursor = "default";
			}
        }
		}
        show_panel(1);
		
		if (window.location.toString().split("#/").length == 1) {
            window.location.hash = "/index";
        }

		
            var flashvars = {};
            var params = {menu: "false", allowscriptaccess: "always", swLiveConnect : "true", enablejs:"true", wmode:"transparent"};
            var attributes = {id: "smbmap", name: "smbmap", classid :"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"};
//<!-- ************************ MACKED CORECTIONS FROM ME ***************************** -->				
            swfobject.embedSWF("flash/map_gm.swf", "_map", "843", "506", "9.0.0", false, flashvars, params, attributes);
//<!-- ************************ MACKED CORECTIONS FROM ME ***************************** -->				
			mapObj = $('smbmap');
			mapObj.style.height = "0px";
			mapObj.style.overflow = "hidden";
			mapObj.style.visibility = "hidden";
		
		
		newPage = true;
		History();
		
		disableSelect(document.body);
		disableSelect($('base'));
		
    }
	
	function searchObject(){
	
	}

	
function disableSelect(obj){
try{

	addEventN(obj, "selectstart", killEvent);
	addEventN(obj, "select", killEvent);
	addEventN(obj, "mousedown", killEvent);
	addEventN(obj, "contextmenu", killEvent);
	
	if (typeof obj.style.MozUserSelect!="undefined") //Firefox route
	obj.style.MozUserSelect="none"
}catch(e){}
	
}

    function History() {
        currentPage = window.location.hash.toString();
        if (_page != currentPage || newPage) {
            _page = currentPage;
			if(historyArray.length > 10){
				while(historyArray.length != 0){
					historyArray.pop();
				}
			}	
			historyArray.push(_page);
            newPage = true;
            loadPage();
        }
    }


    function back2map() {
        window.location.hash = "/index";
    }
    function thisMovie(movieName)
    {
      if(navigator.appName.indexOf("Microsoft") != -1)
      {
        return window[movieName];
      }
      else
      {
        // return gid(movieName);
        return document[movieName];
      }
    };

	function callchangeVmode(value){
	//alert($("view_object").tagName);
        thisMovie("view_object").changeVmode(value);
	}
	
	function navigateToURL(hashString){
			//	alert(historyArray[historyArray.length-1].split("#/details/")[1].split("/")[0]);
		//		alert(historyArray[historyArray.length].split("#/details/")[1].split("/")[0]);
	//	if(historyArray.length > 2 && historyArray[historyArray.length-1].split("#/details/")[1].split("/")[0] == historyArray[historyArray.length-2].split("#/details/")[1].split("/")[0]){
//
			window.location.hash = hashString;
		//}
	}
	
	function checkForChangeVmode(jsvmode,jsfileid){
		return true;
		if(historyArray.length > 2 && historyArray[historyArray.length-1].split("#/details/")[1].split("/")[0] == historyArray[historyArray.length-2].split("#/details/")[1].split("/")[0]){
			
			callchangeVmode(jsvmode.toString()+","+jsfileid.toString());
			
			return true;
		}else{
			return false;
		}
		
	}
	

    function viewObject(jsobjectid, jsvmode, jsfileid) {
		hideMap();
		
		
        var flashvars = {objectid: jsobjectid , vmode: jsvmode , fileid: jsfileid};
        var params = {menu: "false", allowscriptaccess: "always", wmode:"transparent"}; 
        var attributes = {id: "view_object", name: "view_object"};
        swfobject.embedSWF("flash/view_object.swf?" + parseInt(new Date().getTime().toString().substring(0, 10))
, "view_objectContainer", "843", "645", "10.0.0", "null", flashvars, params, attributes);
	
		
	}
	function clearViewObject(){
		swfobject.removeSWF("view_object");
		_viewObjectDiv.innerHTML = '<div id="view_objectContainer"></div>';
	}

	function hideMap(){
	
			contentDiv.className = "dummy";
			_mapDiv.style.height = "0px";
			mapObj.style.height = "0px";
			mapObj.style.visibility = "hidden";
			_pageDiv.innerHTML = "&nbsp;";
			_pageDiv.style.display = "none";
			_pageDiv.style.height = "0px";
			_viewObjectDiv.visiblity = "visible";
	}

    function loadPage() {
        if (_page.split("#/")[1].split("/").length > 1) {
            subpage = _page.split("#/")[1].split("/")[1];
        }
        if (subpage == "register") { 
            fader();
        }
        page = _page.split("#/")[1].split("/")[0];
			
        if (page == "details"){
			hideMap();
			
			
            var jsobjectid = window.location.hash.split("#/")[1].split("/")[1];
            var vmode = window.location.hash.split("#/")[1].split("/")[2];
            var fileid = window.location.hash.split("#/")[1].split("/")[3];
			
					
				
			if (!vmode) {
				vmode = 0;
			}
			if (!fileid) {
				fileid = 1;
			}
			
			
			//if(!checkForChangeVmode(vmode, fileid)){
			
				viewObject(jsobjectid, vmode, fileid);
			//}
        } else if (page == "index") {
			clearViewObject();
			contentDiv.className = "dummy";
			_pageDiv.innerHTML = "&nbsp;";			
			_pageDiv.style.display = "none";			
			
			
			mapObj.style.visibility = "visible";
			mapObj.style.height = "506px";
			$('content').style.background = "none";
        } else {
			$('content').style.background = "url(themes/default/img/page.jpg)";
			clearViewObject();
			_pageDiv.style.height = "593px";
			_pageDiv.innerHTML = "&nbsp;";
			
			_mapDiv.style.height = "0px";
			mapObj.style.height = "0px";
			mapObj.style.visibility = "hidden";
			
			contentDiv.className = "page_content";
			_pageDiv.style.display = "block";

            var AJAXRequest = makeRequest();
			//AJAXRequest.overrideMimeType('text/html');
            AJAXRequest.open("GET", page + ".php", true);
            AJAXRequest.onreadystatechange = function () {if (AJAXRequest.readyState == 4 || AJAXRequest.readyState == "complete") {if (AJAXRequest.status == 200) 
					{
						_pageDiv.innerHTML =AJAXRequest.responseText;
					} 

					else {contentDiv.innerHTML += AJAXRequest.status;}
				}};
            AJAXRequest.send(null);
        }
        $("base").style.display = "block";
        newPage = false;
		History();
	}
	
	



    function show_panel(panelNum) {
        $("panel_1").style.display = "none";
        $("panel_2").style.display = "none";
        $("panel_3").style.display = "none";
        $("panel_4").style.display = "none";
        $("panel_5").style.display = "none";
        $("sp1").className = "sp";
        $("sp2").className = "sp";
        $("sp3").className = "sp";
        $("sp4").className = "sp";
        $("sp5").className = "sp";
        $("sp" + panelNum).className = "sp sp_active";
        $("panel_" + panelNum).style.display = "block";
    }


    function cancelBubble(e) {
        e.cancelBubble = true;
        e.stopPropagation();
    }


    function $(id) {
        return document.getElementById(id);
    }


    function $tag(tag) {
        return document.getElementsByTagName(tag);
    }


    function addEventN(obj, evt, fn) {
        if (obj.addEventListener) {
            obj.addEventListener(evt, fn, false);
        } else if (obj.attachEvent) {
            obj.attachEvent("on" + evt, fn);
        }
    }


    function removeEventN(obj, evt, fn) {
        if (obj.removeEventListener) {
            obj.removeEventListener(evt, fn, false);
        } else if (obj.detachEvent) {
            obj.detachEvent("on" + evt, fn);
        }
    }


    function killEvent(e) {
        if (!e) {
            var e = window.event;
        }
        e.cancelBubble = true;
        e.returnValue = false;
        if (e.stopPropagation) {
            e.stopPropagation();
        } else {
            e.cancelBubble = false;
        }
        return false;
    }


    function findPosX(obj) {
        var curleft = 0;
        if (obj.offsetParent) {
            while (1) {
                curleft += obj.offsetLeft;
                if (!obj.offsetParent) {
                    break;
                }
                obj = obj.offsetParent;
            }
        } else if (obj.x) {
            curleft += obj.x;
        }
        return curleft;
    }


    function findPosY(obj) {
        var curtop = 0;
        if (obj.offsetParent) {
            while (1) {
                curtop += obj.offsetTop;
                if (!obj.offsetParent) {
                    break;
                }
                obj = obj.offsetParent;
            }
        } else if (obj.y) {
            curtop += obj.y;
        }
        return curtop;
    }


    function getTarg(e) {
        if (!e) {
            var e = window.event;
        }
        if (e.target) {
            targ = e.target;
        } else if (e.srcElement) {
            targ = e.srcElement;
        }
        if (targ.nodeType == 3) {
            targ = targ.parentNode;
        }
        return targ;
    }


    function getMouseX(e) {
        if (e.pageX) {
            posx = e.pageX;
        } else if (e.clientX) {
            posx = e.clientX + d.body.scrollLeft + d.documentElement.scrollLeft;
        }
        return posx;
    }


    function getMouseY(e) {
        if (e.pageY) {
            posy = e.pageY;
        } else if (e.clientY) {
            posy = e.clientY + d.body.scrollTop + d.documentElement.scrollTop;
        }
        return posy;
    }


    function die() {
        return true;
    }


    function getDocumentWidth() {
        var db = d.body, de = d.documentElement, mode = d.compatMode;
        w = 0;
        if (db && mode == "BackCompat" && isMSIE) {
            w = db.scrollWidth;
        } else {
            w = Math.max(db && db.scrollWidth || 0, de && de.scrollWidth || 0);
        }
        w = db.scrollWidth;
        return w;
    }


    function getDocumentHeight() {
        var db = d.body, de = d.documentElement, mode = d.compatMode;
        h = 0;
        if (db && mode == "BackCompat" && isMSIE) {
            h = db.scrollHeight;
        } else {
            h = Math.max(db && db.scrollHeight || 0, de && de.scrollHeight || 0);
        }
        return h;
    }


    function makeRequest() {
        var xmlHttp;
        try {
            xmlHttp = new XMLHttpRequest;
        } catch (e) {
            try {
                xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {
                    alert("Your browser does not support AJAX!");
                    return false;
                }
            }
        }
        return xmlHttp;
    }


    function setOpacity(obj, cval, value, inout) {
        try {
            obj = $(obj);
            obj.style.opacity = cval / 10;
            obj.style.filter = "alpha(opacity=" + cval * 10 + ")";
            if (inout == 1) {
                if (value > cval) {
                    obj.style.display = "block";
                    cval += 0.5;
                    setTimeout("setOpacity('" + obj.id + "'," + cval + "," + value + ", 1)", 5);
                }
            } else {
                if (value < cval && cval > 1) {
                    cval -= 3;
                    setTimeout("setOpacity('" + obj.id + "'," + cval + "," + value + ", 0)", 5);
                } else {
                    obj.parentNode.removeChild(obj);
                }
            }
        } catch (e) {
        }
    }


    function setOpacityProperty(obj, value) {
        try {
            obj.style.opacity = value / 10;
            obj.style.filter = "alpha(opacity=" + value * 10 + ")";
        } catch (e) {
        }
    }


    function tween(obj, property, unit, startValue, endValue, ease, time) {
        obj = $(obj);
        obj.style[property] = startValue + unit;
        if (startValue != endValue && ease == "in") {
            startValue -= 5;
            setTimeout("tween('" + obj.id + "','" + property + "', '" + unit + "'," + startValue + "," + endValue + ", '" + ease + "'," + time + ")", time);
        } else if (startValue != endValue && ease == "out") {
            startValue += 5;
            setTimeout("tween('" + obj.id + "','" + property + "', '" + unit + "'," + startValue + "," + endValue + ",'" + ease + "'," + time + ")", time);
        }
    }


    function faderClose() {
        setOpacity("fader", 7, 0, 0);
    }


function fader(){
		var d = document,
		db = d.body,
		de = d.documentElement,
		mode = d.compatMode;
		
	
	w = 0, h = 0;
	var h = getDocumentHeight();
	var w = getDocumentWidth();
		
	
	
		var fader = document.createElement("DIV");
		fader.id = "fader";
		document.body.appendChild(fader);
		$('fader').style.display = "block";
		$('fader').style.position = "absolute";
		$('fader').style.left = "0px";
		$('fader').style.top = "0px";
		$('fader').style.zIndex = "2"; 
		$('fader').style.backgroundColor = "black";
		setOpacityProperty($('fader'), 0);
		
		$('fader').style.width = w+"px";
		$('fader').style.height = h+"px";
		setOpacity('fader',0, 3, 1)
}
