//facebookClick
function fbs_click(pageToShare)
{	
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent("http://www.elidor.com.tr"+pageToShare.split("#").join("").split("//").join("/")),'sharer','toolbar=0,status=0,width=626,height=436');
	return false;
}

function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            oldonload();
            func();
        }
    }
}


addLoadEvent(urlRewrite);

function urlRewrite(){
	//manuel//
	//var currenthost = "http://localhost/elidor/"
	var currenthost = "http://"+location.host+"/";
	
	var currenturl = location.href;			
	
	var path = currenturl.split(currenthost).join("");
	if(path.indexOf('elidor') == 0){
		path=path.substring(6,path.length);
	}
	path=path.split("default.aspx").join("");
	
	//var currenthost = location.host;
	//var currenthostendslash = "http://"+location.host+"/";
	
		
	if(currenturl.indexOf('#') < 0) {
		//Injects # in the url.
		//Check if path is larger then 1
		if(1 < path.length){
			location.href = currenthost+"#/"+path//.substring(0,location.pathname.length);
		}
		
	} else {
		// Checks if # is in the right place
		if(currenthost.length != currenturl.indexOf('#')){
			//Removes the # form the string an injects i at the right place.
			location.href = currenthost+"#/"+path//.substring(0,location.pathname.length);		
		}
		
	}
	
}

