$(document).ready(function(){
	
	// #block-headline-flash
	var flashvars = {};
	var params = {};
	params.quality = "best";
	params.scale = "noscale";
	params.wmode = "transparent";
	params.allowfullscreen = "false";
	var attributes = {};
	swfobject.embedSWF("flash/sosbil_flash_headline.swf", "block-headline-flash", "884", "234", "9.0.0", false, flashvars, params, attributes);
	
	// #tanitimVideo #tvi
	swfobject.embedSWF("videolar/tanitim.swf", "tvi", "200", "192", "9.0.0", false, flashvars, params, attributes);
	
	// fix ie's pseudo (IE/Win only allows the :hover pseudo-class to be applied to a link)
	startList = function() {
	if (document.all&&document.getElementById) {
	navRoot = document.getElementById("block-navmain");
	for (i=0; i<navRoot.childNodes.length; i++) {
	node = navRoot.childNodes[i];
	if (node.nodeName=="LI") {
	node.onmouseover=function() {
	this.className+=" over";
	}
	node.onmouseout=function() {
	this.className=this.className.replace(" over", "");
	}
	}
	}
	}
	}
	window.onload=startList;
	
	// guesbook dialogs - ajax request
	$('#succesComm').dialog({
		autoOpen: false,
		width: 370,
		buttons: { "Tamam": function() { $(this).dialog("close"); } }
	});
	$('#fname').dialog({
		autoOpen: false,
		width: 370,
		buttons: { "Tamam": function() { $(this).dialog("close"); } }
	});
	$('#messg').dialog({
		autoOpen: false,
		width: 370,
		buttons: { "Tamam": function() { $(this).dialog("close"); } }
	});
	$('#scode').dialog({
		autoOpen: false,
		width: 370,
		buttons: { "Tamam": function() { $(this).dialog("close"); } }
	});
	$('#scodewr').dialog({
		autoOpen: false,
		width: 370,
		buttons: { "Tamam": function() { $(this).dialog("close"); } }
	});
	$('#syserr').dialog({
		autoOpen: false,
		width: 370,
		buttons: { "Tamam": function() { $(this).dialog("close"); } }
	});
	
	$("#post_comment").click(function(){
		var x = $(this).attr("title");
		if(x !== 'ok') {
			var fullname = $('#gb-fullname').val();
			var mail = $('#gb-email').val();
			var msg = $('#gb-msg').val();
			var code = $('#secode').val();
			if(!fullname) {
				$('#fname').dialog('open');
			} else if (!msg){
				$('#messg').dialog('open');
			} else if (!code){
				$('#scode').dialog('open');
			} else {
				$(this).text('lütfen bekleyin...');
				$.ajax({
					type: "POST",
					url: "postcomment.php",
					data: "fullname="+fullname+"&mail="+mail+"&msg="+msg+"&code="+code+"",
					success: function(msg){
						if(msg === '1') {
							$('#scodewr').dialog('open');
							$('#secode').val("");
							$("#secimg").attr("src",'securimage_show.php?sid=' + Math.random());
						} else if (msg === '2') {
							$('#syserr').dialog('open');
						} else if (msg === '3'){
							$('#succesComm').dialog('open');
							$("#post_comment").attr("title","ok");
							$("#post_comment").text("mesajınız gönderildi");
							$('#guesbook-input .light').css('opacity',0.7)
							$('#guesbook-input .light').css({ width: $('#guesbook-input').width() + "px", height: $('#guesbook-input').height() + "px" });
							$('#guesbook-input .light').fadeIn("normal");
						}
					}
				});
			}
		}
	});
	
	
});
// facebook share
function fbs_click() {
	u=location.href;
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent($("#shownews .col2 .headline").text()),'sharer','toolbar=0,status=0,width=626,height=436');
	return false;
}