$(document).ready(function() {
	$.ajaxSetup({
        contentType: "application/x-www-form-urlencoded;charset=ISO-8859-9"
	});

	$(".modal").fancybox({
		'showCloseButton' : false
	});

	if(index == 1){
		$.fancybox(
			'<div style="background:url(\'pop/fx.jpg\');width:500px;height:450px"><a target="_blank" href="http://twitter.com/turkishfx" style="margin:0;padding:0;top:387px;left:135px;width:220px;height:20px;position:relative;display:block;"><'+ '/a>' + '<a target="_blank" href="http://www.facebook.com/TurkishFX" style="margin:0px;padding:0;top:387px;left:125px;width:235px;height:20px;position:relative;display:block;"></a></div>',
			{
				'autoDimensions'	: false,
				'width'				: 500,
				'height'			: 450,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			}
		);
	}

	sosyal();
});




function sos_buk(site,u,t){
	if (!u) u=location.href; u=encodeURIComponent(u);
	if (!t) t=document.title; t=encodeURIComponent(t);

	if (site=='twitter') url='http://twitter.com/home?status='+t+' - '+u;
	if (site=='stumbleupon') url='http://www.stumbleupon.com/submit?url='+u+'&title='+t;
	if (site=='myspace') url='http://www.myspace.com/Modules/PostTo/Pages/?u='+u+'&t='+t;
	if (site=='google') url='http://www.google.com/bookmarks/mark?op=add&bkmk='+u+'&title='+t;
	if (site=='facebook') url='http://www.facebook.com/sharer.php?u='+u+'&t='+t;
	if (site=='friendfeed') url='http://friendfeed.com/?url='+u+'&title='+t;
	if (site=='delicious') url='http://del.icio.us/post?v=2&url='+u+'&notes=&tags=&title='+t;

	if (site=='browser') if (window.sidebar){window.sidebar.addPanel(document.title,location.href,'');} else if (window.external){window.external.AddFavorite(location.href,document.title);} else if (window.opera && window.print) return false;
	window.open(url);
	return false;
}

function sosyal(){
	sosHTML='', sosSit=['facebook','twitter','friendfeed','myspace','delicious','google'], sosTit=['Facebook','Twitter','FriendFeed','StumbleUpon','MySpace','Delicious','Google'];
	for (i=0; i<sosSit.length; i++){
		sosHTML+='<a href="javascript:;" onclick="sos_buk(\''+sosSit[i]+'\');" title="'+sosTit[i]+'"><img src="img/'+sosSit[i]+'.png" width=25></a>\n';
	}
	$('#sosyal').html(sosHTML);
}


function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){

		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){

		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){

		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){

		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){

		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){

		    return false
		 }

		 if (str.indexOf(" ")!=-1){

		    return false
		 }

 		 return true
	}

function Git(u){
	document.location=u;
}

function ac(loc,w,h){
   config=""
   config+="toolbar=no,";
   config+="location=no,"
   config+="directories=no,";
   config+="status=yes,"
   config+="menubar=no,"
   config+="scrollbars=yes,"
   config+="resizable=no,"
   config+="copyhistory=no,"
   config+="width="+w+","
   config+="height="+h;

	popup=window.open(loc, 'popup', config);
}


function OpenWindow(pUrl, pName, pWidth, pHeight)
	{
		//var w = window.open("haber_detay.asp","popup","tolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0, resizable=no,width=400,height=200");
		var w = window.open(pUrl, pName, "scrollbars=1, resizable=yes,width="+pWidth+",height="+pHeight);
		w.focus();
	}

function HisseAnaliz(pFonksiyon,gelen_sembol)
	{


		var obj, deg, sembolid, sembol, arr, vguid;
		deg  = gelen_sembol;
		arr = deg.split('|')
		sembolid = arr[0];
		sembol = arr[1];

		vguid=Math.floor(Math.random()*1000000000);

		if(sembolid<=0){
			alert ("Lütfen Bir Senet Seçiniz?");
			return;
		}

		if(pFonksiyon=="PGC")
			OpenWindow('http://www.matriks.web.tr/kurumlar/turkish/t_AliciSaticiHisse.asp?sembolid='+sembolid+'&GUID='+vguid,'webanaliz','710','800');

		if(pFonksiyon=="TAKAS")
			OpenWindow('http://www.matriksdata.com/Matriks/t_Takas.asp?sembolid='+sembolid+'&GUID='+vguid,'webanaliz','800','800');

		if(pFonksiyon=="JAVAMATRIKS")
			OpenWindow('http://www.matriksdata.com/forjavamatriks/JavaTA/JavaTA.asp?GUID='+vguid,'javata','830','625');

		if(pFonksiyon=="DETAY")
			document.location='hisseanaliz.php?hisse=' + sembolid;

		if(pFonksiyon=="TEMEL")
			OpenWindow('http://www.matriks.web.tr/kurumlar/turkish/malitablolar.asp?hisse=' + sembolid + '&sembol=' + sembol,'temelanaliz','710','800');
	}

