// JavaScript Document
jQuery(document).ready(function(){
		//dd=dds/0
		// Initialize history plugin.
		// The callback is called at once by present location.hash. 
		jQuery.historyInit(pageload);

		// PageLoad function
		// This function is called when:
		// 1. after calling jQuery.historyInit();
		// 2. after calling jQuery.historyLoad();
		// 3. after pushing "Go Back" button of a browser
		jQuery.noConflict();
		function pageload(hash) {
			// hash doesn't contain the first # character.
			//alert("pageload:" + hash)
			//ss=ss/25;
			if(hash) {
				// restore ajax loaded state
				hash = hash.replace(/xæ&/, '?');
				//jQuery("#icerikkismi").load(hash,'',showNewContent());
				//alert(hash);
				jQuery.ajax({
					url: hash,
					type: 'GET',
					dataType: "html",
					success: function(result) {
						jQuery('#icerikkismi').html(result);						
						showNewContent();
					}				
					});	
			} else {
				// start page
				jQuery("#icerikkismi").empty();
			}
		}

	});
	
	 function showNewContent() {
		jQuery("#yukleniyorkismi").remove();
		jQuery('#icerikkismi').css("display","none");
		jQuery('#icerikkismi').css("position","relative");
		jQuery('#icerikkismi').css("top","0px");
		jQuery('#icerikkismi').css("width","100%");
		jQuery('#icerikkismi').show("1000");
		//jQuery('#icerikkismi').css("opacity","0.2")
		/*jQuery('#icerikkismi').animate({
		  top: '0px',width:'100%'
		}, 1500,"easeOutBounce");
		*/
		Cufon.replace(jQuery(".sayfabasligi"));	
		//jQuery('#icerikkismi').hide('fast',function(){jQuery('#icerikkismi').slideUp(1500);});
          
     }


var ajaxmethod="get";
var ajaxformparametre="";
function icerikyukle(yol)
{ 
	var strloading="<div id='yukleniyorkismi' style='position:absolute;left:0px;top:0px;height:100%;width:100%;z-index:30'><div id='yukleniyorkismibackground' style='position:absolute;left:0px;top:0px;background-color:#fff;height:" + jQuery("#icerikkismi").height() + "px;width:100%;z-index:0;'></div><div style='z-index:5;position:absolute;left:0px;top:250px;width:100%;height:100px;font-weight:bold'><center>....Yükleniyor...<br><br><img src='ajax/ajax-loader" + loaddergif + ".gif'></center></div></div>";	
	jQuery("#icerikkismi").append(strloading);
	jQuery("#yukleniyorkismibackground").css("opacity","0.8");
	//document.getElementById('icerikkismi').innerHTML="<div style='height:750px'><div style='height:250px'></div><center>....Yükleniyor...<br><br><img src='ajax/ajax-loader" + loaddergif + ".gif'></center></div>";
	
	if (yol.indexOf("?")!=-1) {
	//Math.random();
	yol=yol + UI + "&uyeidsi=" +Math.random();
	}
	else
	{
	yol=yol + "?" + UI + "uyeidsi=" +Math.random();
	}
	yol=yol.replace(/Ü/g,"%DC");
	yol=yol.replace(/Ð/g,"%D0");
	yol=yol.replace(/Ý/g,"%DD");
	yol=yol.replace(/Þ/g,"%DE");
	yol=yol.replace(/Ç/g,"%C7");
	yol=yol.replace(/Ö/g,"%D6");
	
	yol=yol.replace(/ü/g,"%FC");
	yol=yol.replace(/ð/g,"%F0");
	yol=yol.replace(/ý/g,"%FD");
	yol=yol.replace(/þ/g,"%FE");
	yol=yol.replace(/ç/g,"%E7");
	yol=yol.replace(/ö/g,"%F6");

	var ilksayfa=document.getElementById("yuklenensayfa").innerHTML;
	document.getElementById("yuklenensayfa").innerHTML=yol;
	jQuery("body").animate({scrollTop:"150px"},500,"easeInExpo",function(){
																		 ajaxsabasla();
																		 })
	function ajaxsabasla(){
		if (ajaxmethod=="get"){
				var hash = yol;
				//alert("click:" + hash);
				hash = hash.replace('?', 'xæ&');
				hash = hash.replace(/^.*#/, '');
				// moves to a new page. 
				// pageload is called at once. 
				// hash don't contain "#", "?"
				jQuery.historyLoad(hash);
		}
		else if	(ajaxmethod=="post"){
			jQuery.ajax({
						url: yol,
						type: 'POST',
						dataType: "html",
						data: ajaxformparametre,
						success: function(result) {
							jQuery('#icerikkismi').html(result);						
							showNewContent();
						}				
						});	
		}
		ajaxmethod="get";
		ajaxformparametre="";
	}
	return false

}
/*-----------------------
* jQuery Plugin: Scroll to Top
* by Craig Wilson, Ph.Creative http://www.ph-creative.com
* Copyright (c) 2009 Ph.Creative Ltd.
* Version: 3.0, 29/10/2009
-----------------------*/
jQuery(function(){jQuery.fn.scrollToTop=function(options){if(options.speed){var speed=options.speed;}else{var speed="fast";}if(options.ease){var ease=options.ease;}else{var ease="jswing";}if(options.start){var start=options.start;}else{var start="0";}var scrollDiv=jQuery(this);jQuery(this).hide().removeAttr("href");if(jQuery(window).scrollTop()>start){jQuery(this).fadeIn("fast");}jQuery(window).scroll(function(){if(jQuery(window).scrollTop()>start){jQuery(scrollDiv).fadeIn("fast");}else{jQuery(scrollDiv).fadeOut("fast");}});jQuery(this).click(function(event){jQuery("body").animate({scrollTop:"0px"},speed,ease);});}});
/*-----------------------*/
jQuery(window).bind("resize scroll",function(){kutularisabitle()});
	kutularisabitle = function() {
		var pos = getViewport();
		if (document.getElementById("ihsan_outer")!=undefined){
			jQuery("#ihsan_outer").css('left', ((jQuery("#ihsan_outer").width()	+ 36) > pos[0] ? pos[2] : pos[2] + Math.round((pos[0] - jQuery("#ihsan_outer").width()	- 36)	/ 2)));
			jQuery("#ihsan_outer").css('top',  ((jQuery("#ihsan_outer").height()	+ 50) > pos[1] ? pos[3] : pos[3] + Math.round((pos[1] - jQuery("#ihsan_outer").height()	- 50)	/ 2)));		
		}
		jQuery("#toTop").css('left',pos[0]+pos[2]-jQuery("#toTop").width()+'px');
		jQuery("#toTop").css('top',pos[1]+pos[3]-jQuery("#toTop").height()+'px');
	};	
