﻿var icerik = '#icerik';
var loading = '<center><strong>Sayfa Yükleniyor..</strong><br /><img border="0px" src="images/loading.gif" /></center>';
$(document).ready(function () {
    //$("#haberler").jCarouselLite({ vertical: true, hoverPause: true, visible: 6, auto: 500, speed: 2000 });
    //$("#headertxt").jCarouselLite({ vertical: true, hoverPause: true, visible: 9, auto: 500, speed: 2000 });
    $("a[rel='example2']").colorbox({ transition: "fade" });
});
$(function () {
    $(".hakkimizda").click(function () {
        makeR(icerik, 'db.htm .' + $(this).attr("class"), null, 6);
    });
    $(".iletisim").click(function () {
        makeR(icerik, 'db.htm .' + $(this).attr("class"), null, 6, function () { loadMaps();});
    });
    $(".urunler").click(function () {
       return false;
	   // makeR(icerik, 'db.htm .' + $(this).attr("class"), null, 6, function () { loadMaps(); });
    });	
    $(".referanslar").click(function () {
        //makeR(icerik, 'db.htm .' + $(this).attr("class"), null, 6, function () { $("area").click(function () { makeR('#loadSehir', $(this).attr("rel"), null, 7); }); });
    });
});
function RakamUret(from, to) {return Math.floor((to - (from - 1)) * Math.random()) + from;}
function makeR(div, page, loading, effect, callback) {
    if (typeof callback != "function") { callback = function(){}; }
    if (!loading) { loading = '<center><strong>Sayfa Yükleniyor..</strong><br /><img border="0px" src="images/loading.gif" /></center>'; }
    if (!effect) { $(div).html(loading); $(div).load(page, function () { callback(); }); return false; }
    else {
        if (effect == 1) {effect = RakamUret(2,7); }
        if (effect == 2) { $(div).toggle('fast'); $(div).html(loading); $(div).load(page, function () { $(div).toggle('fast', function () { callback(); }); }); return false; }
        if (effect == 3) { $(div).html(loading); $(div).fadeOut('slow', function () { $(div).load(page, function () { $(div).fadeIn('slow', function () { callback(); }); }); }); return false; }
        if (effect == 4) { $(div).html(loading); $(div).hide('slow'); $(div).load(page, function () { $(div).show('slow', function () { callback(); }); }); return false; }
        if (effect == 5) { $(div).html(loading); $(div).slideToggle('slow', function () { $(div).hide('slow'); $(div).load(page, function () { $(div).slideToggle('slow', function () { callback(); }); }); }); return false; }
        if (effect == 6) { $(div).html(loading);$(div).animate({ width: "hide", "opacity": "toggle", paddingLeft: "hide", paddingRight: "hide", marginLeft: "hide", marginRight: "hide" }, 1000, function () { $(div).css('margin-left', '100%'); $(div).load(page, function () { $(div).animate({ paddingLeft: "show", paddingRight: "show", marginLeft: "0px", marginRight: "show", "opacity": "toggle" }, 1000, function () { callback(); }); }); });  return false; }
        if (effect == 7) { $(div).html(loading); $(div).animate({ width: "hide", "opacity": "toggle", paddingLeft: "hide", paddingRight: "hide", marginLeft: "hide", marginRight: "hide" }, 1000, function () { $(div).load(page, {contentType: "application/json; charset=utf-8"} , function () { $(div).animate({ "opacity": "toggle", width: "show", paddingLeft: "show", paddingRight: "show", marginLeft: "show", marginRight: "show" }, 1000, function () { callback(); }); }); }); return false; }
    }
}

function mapsLoaded() {
    var map = new google.maps.Map2(document.getElementById("map"));
    map.setCenter(new google.maps.LatLng(36.578799, 36.182013), 15);
    var marker = new GMarker(new GLatLng(36.578799, 36.182013));
    map.addOverlay(marker);
    marker.openInfoWindowHtml("<center><img src='images/maplogo.png' /></center>");

}
function saatYaz() {
    var datemx = new Date();
    var mySaat = ("00" + datemx.getHours()).substr(("00" + datemx.getHours()).length - 2, 2);
    var myDakika = ("00" + datemx.getMinutes()).substr(("00" + datemx.getMinutes()).length - 2, 2);
    var mySaniye = ("00" + datemx.getSeconds()).substr(("00" + datemx.getSeconds()).length - 2, 2);
    var saatim = mySaat + ":" + myDakika + ":" + mySaniye;
    return saatim
}
function loadMaps() {
    google.load("maps", "2", { "callback": mapsLoaded });
	
$('.ileform').submit( function(){
	$('#bilgim').html('<center><img src="images/loading.gif" /></center>');
		$.post('sendmail.php',{adi:$('#Text1').val(),mail:$('#Text2').val(),mesaj:$('#Text3').val() },function(data){
if (data.length>0) {$('#bilgim').html(data + '&nbsp;' + saatYaz());} else {$('#bilgim').html('istenmeyen hata oluştu..');} 
});
    return false;
});		
}
