$(document).ready(function(){

var scre = parseInt(screen.width);
var ovposarray = new Array({top: 0, left: 286}, {top: 0, left: 250});

var tlinks = new Array("www.mavibayrak.org.tr", "www.turkihale.com", "www.fglojistik.com.tr", "www.ozlemturkone.com.tr", "www.madenruhsatlari.com", "www.paranavision.com.tr", "www.mensanmentese.com", "www.aymermedikal.com.tr", "www.ankaraocakbasi.com", "www.promedia-ats.com", "www.onurguvenlik.com.tr", "www.akpartimodernlesme.com", "www.artetoyrentacar.com.tr", "www.turcev.org.tr", "www.damlatibbicihaz.com", "www.femamimarlik.com", "www.medelsis.com.tr", "www.barinakotel.com.tr", "www.kioskpart.com", "www.eraykutu.com", "www.turkishtenders.com", "www.eskizaman.net", "www.atlantiksavunma.com.tr", "www.akdas.com.tr", "www.okyanusankara.com", "www.hunt.com.tr");

var titles = new Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26");

var i=3;

var intervalID = setInterval(function() {
$('.items div').eq(i).find("img").attr({
src : "images/sites/site" + titles[i] + ".jpg" , 
title : tlinks[i], 
alt : tlinks[i]
});
i++;
if(i >= 26) clearInterval(intervalID);
}, 250);

if(scre == 1024) {
$('#maincontainer').css({ 'margin-left' : '280px' });
$('body').css({ 'background-position' : '-50px 0' });
var ovpos = ovposarray[1];
}
else {
var ovpos = ovposarray[0];
}

$('div.items div').click(function() {
var index = $("div.items div").index(this);
window.open('http://' + tlinks[index]);
return false;
});

$("div.scrollable").scrollable({ size: 1, navi: '#thumbdots', naviItem: 'a' });

$(".navi a").click(function() { 
var newhref = parseInt( $(this).attr("href"));

$('#sitetitle').fadeOut(500);
$('#sitetitle').queue(function() {
$(this).attr("src","images/titles/title" + titles[newhref] + ".png");
$(this).fadeIn(800);
$(this).dequeue();
});

$('#tooltip h3').empty().append(tlinks[newhref]);
$('#sitelink').attr("href", "http://" + tlinks[newhref]);

});

$('#prevdots').click(function() { $('#thumbdots').scrollTo('-=29', 800, {axis:'y'}); });

$('#nextdots').click(function() { $('#thumbdots').scrollTo('+=29', 800, {axis:'y'}); });

$(".scrollable").tooltip({ tip : '#tooltip', offset : [50, 7], position : ['top', 'center'],  effect: 'toggle'
 });

var myTimer = {};

myTimer = $.timer(5000, function() { $('#tooltip2').fadeIn(1000); });
myTimer = $.timer(10000, function() { $('#tooltip2').fadeOut(1000); });

myTimer = $.timer(30000, function() { $('#tooltip2').fadeIn(1000); });
myTimer = $.timer(35000, function() { $('#tooltip2').fadeOut(1000); });

var t;
$('#aboutmedetail').hover(function() { clearTimeout(t); $('#tooltip2').fadeIn(1000); }, function() { t = setTimeout(function() {$('#tooltip2').fadeOut(1000)}, 1000);   });

$("a[rel]").overlay({
onBeforeLoad : function() { 
 
var wrap = this.getContent().find("div.wrap"); 
 
if (wrap.is(":empty")) { 
wrap.load(this.getTrigger().attr("href")); 
}

} // end function
, start : ovpos 
, finish : ovpos 
} 
); 

$('#contactbutton').click(function() {
var cfvisi = $('#contactform').css('display');

if(cfvisi == 'none')
$('#contactform').slideDown(1000);
else
$('#contactform').slideUp(1000);

});

});