// Reis Makina Main JavaScript Library

$(document).ready( function (){
				 
							 
							 
	//E Bülten Forum.
	$("#ebultenform").validationEngine();

    
	$('#bultenadiniz').focus(function() {
  		if ($('#bultenadiniz').val() == "Adınız") {
			$('#bultenadiniz').val("");
		}
	});
    
	$('#bultenmail').focus(function() {
  		if ($('#bultenmail').val() == "E-Posta Adresiniz") {
			$('#bultenmail').val("");
		}
	});
	ddsmoothmenu.init({
		mainmenuid: "header_menu", //Menu DIV id
		orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
		align:"left",
		classname: 'header_menuc', //class added to menu's outer DIV
		arrowimages: {down:['downarrowclass', '/images/down.gif', 0], right:['rightarrowclass', '/images/right.gif']},
		//customtheme: ["#804000", "#482400"],
		transition: {overtime:300, outtime:300}, //duration of slide in/ out animation, in milliseconds
		shadow: {enable:false, offsetx:5, offsety:5}, //enable shadow?
		contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
	});	
});

function main() {
	//kurcek();
}


function kurcek() {
	$.ajax({
		type: "GET",
		cache: false,
		url: "/ajax.kurcek.php",
		data: "",
		success: function(msg){
			$("#kurlar").html(msg);
		}
	});
}

function isimcek(ne, val) {
	//alert(val);
	if (ne == val.value) {
		//val.value = "";
	}
}

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function bultenSubmit() {
    var isok = $("#ebultenform").validationEngine('validate');
    if (isok){
        formseri = $("#ebultenform").serialize();
        $.ajax({
                type: "POST",
                url: "ajax.ebulten.php",
                data: formseri,
                success: function(cevap) { 
                    cevap = trim(cevap);
                    switch(cevap)
                    {
                        case "ok":
                        alert("Bülten aboneliğiniz eklenmiştir.");
                        break;
                        default:
                        alert(cevap);
                    }
                },
                dataType: "html"
            });
    }
    return false;
}


function shareOnFacebook() {
    u = location.href.replace('liste','rm'); t = document.title; window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u) + '&t=' + encodeURIComponent(t), 'sharer', 'toolbar=0,status=0,width=626,height=436'); return false;

}
function shareOnFriendFeed() {
    u = location.href.replace('liste', 'rm'); t = document.title; window.open('http://friendfeed.com/share/bookmarklet/frame#url=' + encodeURIComponent(u) + '&title=' + encodeURIComponent(t), 'sharer', 'toolbar=0,status=0,width=626,height=436'); return false;

}
function shareOnTwitter() {
    u = location.href.replace('liste', 'rm'); t = document.title; window.open('http://twitter.com/home?status=' + encodeURIComponent(u) + ' ' + encodeURIComponent(t) +' @reismakina', 'sharer', 'toolbar=0,status=0,width=800,height=600'); return false;

}

