(function()
	{
	if (window.location.hash !== "")
						{
							var Loc = window.location.toString();
							Loc = Loc.substr(0,Loc.lastIndexOf("#"));
							if (Loc.indexOf(".php")>0) Loc = Loc.substr(0,Loc.lastIndexOf(".php")); 						
							Loc = Loc.substr(0,Loc.lastIndexOf("/") + 1); 
							window.location.href =(Loc + 'index.php?' + window.location.hash.toString().replace("#","")); 
						}	
	function add_event(obj, trigger, func)
				{
					if (obj.addEventListener) obj.addEventListener(trigger,function() { func() } ,false)
					else if (obj.attachEvent) obj.attachEvent ("on" + trigger,function() { func() });
					
				}	
				
	window.cvni_listener = function(hash)
		{
			var h = hash.replace("#",""); 
			
			var ex = h.split("&"); 
			var Base = new Object;
			Base.height= function(hi)
				{	
						if (!window.CVNI_IF) window.CVNI_IF = document.getElementById("cvni")
						window.CVNI_IF.height= (hi > 880)  ? ((document.all) ? parseInt(hi) + 30 : hi): 910;
				}	
				
			Base.isdomain = function(ha)
				{
					if (ha.indexOf("@")<0) return false;
					var URL = ha.split("@");
					if (window.location.toString().indexOf(URL[0]) < 0) 
						{
							var Loc = window.location.toString();
							if (Loc.indexOf(".php")>0) Loc = Loc.substr(0,Loc.lastIndexOf(".php")); 
							Loc = Loc.substr(0,Loc.lastIndexOf("/") + 1); 
							window.location.href =(Loc + 'index.php?p=' + URL[1]);
//							window.location.href = window.location.href + 'index.php?p=' + URL[1];
						}
				}
				
			Base.setpage = function(hash)
				{
					
					hash=hash.replace(/#/g,"=");
					hash=hash.replace(/@/g,"&");
					window.location.hash="#p=" + hash; 
					window.scrollTo(0,0);
				}
			for(var i = 0; i<ex.length; i++)
				{
					var t = ex[i].split("="); 
					var N = t[0];
					if (typeof Base[N] == "function") Base[N](unescape(t[1]));
				}
		}

	add_event(window,'load', function()
				{
					window.CVNI_IF = document.getElementById("cvni");
				});
	})();
								
