// JavaScript Document

/* IE için ekstralar öfff aman ya! 
 * garbage coding for IE6 gosh!
 * please upgrade to modern browsers now!  
 */
function hover(obj, col){
	obj.style.cursor = 'pointer';
	obj.style.backgroundColor = col; // '#cbdde4' '#f3dae0'
}

function noHover(obj){
	obj.style.backgroundColor = '';
}

function showTagList(obj) {
	obj.getElementById[2].style.display='block';
}


function sharePopup(addr) {
	var pw=1000; 
	var ph=700;
	var xpos=(screen.width/2) - (pw/2);
	var ypos=(screen.height/2) - (ph/2);
	window.open(addr, 'popupWindow', 'scrollbars=1,toolbar=0,status=0,top='+ypos+',left='+xpos+',width='+pw+',height='+ph);	
}




$(document).ready(function(){
			
	/* IE6 needs then causes garbage! */
	if ( $.browser.msie && $.browser.version.substr(0,1)<7 ) {
		$(".date, .userBox, .userBoxOldAnswer, .authorInfoBox, .dateOldAnswer").css("margin-left", "10px");
		$(".onLeft").css("margin-left", "20px");		
		$(".onRight").css("margin-right", "20px");
		$("#enterComment .entryInfo").css("margin-left", "8px");
		
		$("#mainQuestionBox, #yesterday, .searchResult, .participantBox, .fromNewspaper").mouseover(function () {
			$(this).css("background-color","#f3dae0");
			$(this).next(".questionFooter").css("background-color","#f3dae0");
			$(".tagList", this).css("display","block");
		});
		
		$("#mainQuestionBox, #yesterday, .searchResult, .participantBox, .fromNewspaper").mouseout(function () {
			$(this).css({"background-color":"", "cursor":"pointer"});
			/*$(this).next(".questionFooter").css({"background-color":"", "cursor":"pointer"});*/
			$(".tagList", this).css("display","none");
		});
			
		/* infobar'lar */
		$(".navigateResultPages a dt").mouseover(function () {
			$(this).css({"background-position": "right", "cursor": "pointer"});			
		});
		$(".navigateResultPages a dt").mouseout(function () {
			$(this).css("background-position", "left");					
		});
		
	} else {
		$(".date, .userBox, .userBoxOldAnswer").css("margin-left", "18px");
		$(".onLeft").css("margin-left", "40px");
		$(".onRight").css("margin-right", "40px");
		$("#enterComment .entryInfo").css("margin-left", "12px");
	}
	
	
		
	/* YORUM YAZ KUTUSU AÇILIR */
	$(".enterComment").click(function () {
		$(this).css("background-color","#f7afc3");
		$(this).parent().next(".commentFormBox").slideDown("slow");
	});
	/* YORUM KUTUSUNU KAPAT DÜGMESI */
	$(".cancelCommenting").click(function () {
		$(".enterComment").css("background-color","");
		$(this).parent().parent().parent().slideUp("fast");
	});
	
	
	/* BÜLTENE KAYIT YAPILDI */
	/*$(".subscription").slideUp("fast");*/
	/*$(".subscriptionSaved").slideDown("slow");*/
	
	
	/* KAYDEDILDI KUTULARI GELIR 5sn SONRA KAPANIR */
	$(".commentSaved, .subscriptionSaved, .traineeApplied").css("display","block");
	setTimeout(closeSavedBoxes, 5000);
	function closeSavedBoxes() {		
		$(".commentSaved, .applicationSaved, .subscriptionSaved, .traineeApplied").slideUp("normal");
	}
	
	$("#mainQuestionBox a.thankYou").click(function () {
		$("#mainQuestionBox .commentSaved").slideUp("normal");
	});
	
	$("#yesterday a.thankYou").click(function () {
		$("#yesterday .commentSaved").slideUp("normal");
	});
	

	/* ARKADASINA GÖNDER DÜGMESI */
	$("#openForm").click(function () {
		$(this).parent().css("display","none");
		$(".submitAction").css("display","block");
		$(".sendFromAndComment").slideDown("slow");
	});
	$("#sendToFriend").click(function () {
		$(".sendFromAndComment").slideUp("normal");
		$("#sentThanks").slideDown("slow");
		$("#openForm").parent().css("display","block");
		$(".submitAction").css("display","none");
		setTimeout(function(){ $("#sentThanks").slideUp("normal") }, 2000);
	});
	
	
	/* BIR SORU DA SEN SOR, "ÖNER" DÜGMESI */
	$("#openSuggestionForm").click(function () {
		$(this).parent().css("display","none");
		$(".submitSuggestionAction").css("display","block");
		$(".suggestionBox").slideDown("slow");
	});
	$("#submitSuggestionAction").click(function () {		
		$("#sentSuggestionThanks").slideDown("slow");
		$("#openSuggestionForm").parent().css("display","block");
		$(".submitSuggestionAction").css("display","none");
		$(".suggestionSentThanks").slideDown("normal");
		setTimeout(function(){ $(".suggestionSentThanks").slideUp("normal") }, 5000);
	});
	

	/* MENU'DEKI ARAMA DÜGMESI */
	$(".mainSearch").click(function () {												
		//$(this).css({"background-color":"#8b9b93", "padding-right":"83px"});		
		$(this).css({"background-color":"#8b9b93", "padding-right":"100px"});		
		$("#searchBox, .searchBoxTop").fadeIn("normal");
	});	
	$("#closeButton").click(function () {
		$(".mainSearch").css({"background-color":""});
		$("#searchBox, .searchBoxTop").fadeOut("fast");
	});
	
	
	/* PAYLAS SOSYAL AG IKONLARI */ 
	$("#shareIconList li, #shareIconList li a").mouseover(function () {
		$(this).css("border","0");
		$("dd", this).fadeIn("normal").css({"background-image":"url(images/balloon.gif)"});
		$("dt", this).css({"background-position":"left", "cursor":"pointer"});
	});
	$("#shareIconList li, #shareIconList li a").mouseout(function () {
		$("dd", this).fadeOut("slow");
		$("dt", this).css({"background-position":"right"});		
	});
	
	
	/* TEMSILCI BASVURUSU LINKINE TIKLENDIGINDE  */
	$(".apply").click(function () {		
		$(this).parent().next(".applicationBox").slideDown("slow");
	});
	$(".closeApplicationBox").click(function () {
		$(this).parent().parent().parent().slideUp("normal");
	});
	
	
	/* DIGER GÖRSELLER GALERISI */
	$("a.zoom").fancybox();
	$("a.group, li.group").fancybox({'hideOnContentClick': false}); 
	
});
/* ** JQUERY ENDS ****************************************************************** */
	
	function hide_it(obj) {
    var elm=document.getElementById(obj);
    elm.style.visibility= "hidden";
	}	
	

function closeMeBaby(who){
	var me=document.getElementById(who);
/* visibility dersem form sadece görünmez olur 
 * ama linkleri çalismaya devam eder! 
 * yani ekranda hayalet linkler gezinir 
 * o yüzden visibility yerine display... 
 */
	me.style.display="none"; 
}



