﻿/*
	Social Like Box Plugin
	Burak TAMTÜRK - webmaster@gazeteobjektif.com
*/

var del, del2, oldresize, oldscroll;
del=null;
del2=null;

function renew() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}

	jQuery(del).css({
		'top': ((myHeight/2)-122) + window.pageYOffset,
		'left': (myWidth/2)-348,
	});
}

function closeBox() {
	if(del!=null) {
		del2.onclick=null;
		jQuery(del).fadeOut(1000, function() {
			document.body.removeChild(del);
			del=null;
			window.onresize=oldresize;
			window.onscroll=oldscroll;
		});
		jQuery(del2).fadeOut(1000, function() {
			document.body.removeChild(del2);
			del2=null;
		});
	}
	return false;
}

function showBox(l) {
	var atmp, btmp, btmp2, myWidth = 0, myHeight = 0, ing, il;
	if(del!=null) return ;

	il=0;
	il=window.location.hostname.indexOf('.');
	if(il!=-1) {
		if(window.location.hostname.substring(0,3)=='eng') {
			ing=1;
		}
	}

	del2=document.createElement("div");
	del2.className="backgroundPopup";
	del2.onclick=closeBox;

	del=document.createElement("div");
	del.className="likex2";


	btmp=document.createElement("a");
	btmp.className="pngltl";
	btmp.href="/kampanyalar.php";
	atmp=document.createElement("img");
	atmp.src="/img/animation.gif";
	btmp.appendChild(atmp);
	del.appendChild(btmp);

	atmp=document.createElement("a");
	atmp.className="likeFbLink";
	atmp.href="http://www.facebook.com/gurses.oto.as";
	del.appendChild(atmp);

	atmp=document.createElement("a");
	atmp.className="linkTwLink";
	atmp.href="http://twitter.com/Gursesotoas";
	del.appendChild(atmp);

	atmp=document.createElement("a");
	atmp.className="likeGpLink";
	atmp.href="https://plus.google.com/u/0/b/118406053380431031300/";	
	del.appendChild(atmp);

	atmp=document.createElement("a");
	atmp.className="likeGptLink";
	atmp.href="https://plus.google.com/u/0/b/118406053380431031300/";	
	del.appendChild(atmp);

	atmp=document.createElement("a");
	atmp.className="likeTwtLink";
	atmp.href="https://twitter.com/Gursesotoas";	
	del.appendChild(atmp);

	atmp=document.createElement("div");
	atmp.className="lkl2";
	btmp=document.createElement("a");
	btmp.href="#";
	btmp.onclick=closeBox;
	atmp.appendChild(btmp);
	del.appendChild(atmp);

	atmp=document.createElement("div");
	atmp.className="alt";

	btmp=document.createElement("div");
	btmp.className="fb";

	btmp.innerHTML="<iframe src=\"http://www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fgurses.oto.as&amp;send=false&amp;layout=button_count&amp;width=98&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font=verdana&amp;height=21&amp;appId=140892909342865\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:98px; height:21px;\" allowTransparency=\"true\"></iframe>";
	atmp.appendChild(btmp);	

	btmp2=document.createElement("div");
	btmp2.className="koddostuclike";
	btmp=document.createElement("a");
	btmp.href="https://plus.google.com/u/0/b/118406053380431031300/me/posts";
	btmp2.appendChild(btmp);
	atmp.appendChild(btmp2);


	btmp=document.createElement("div");
	btmp.className="tw";
	if(ing) btmp.innerHTML="<iframe scrolling=\"no\" frameborder=\"0\" allowtransparency=\"true\" src=\"http://platform.twitter.com/widgets/follow_button.html#button=blue&amp;id=twitter_tweet_button_0&amp;lang=en&amp;screen_name=Gursesotoas&amp;show_count=false\" class=\"twitter-follow-button\" style=\"width: 70px; height: 20px;\" width=\"70\" title=\"\"></iframe>";
	else btmp.innerHTML="<iframe scrolling=\"no\" frameborder=\"0\" allowtransparency=\"true\" src=\"http://platform.twitter.com/widgets/follow_button.html#button=blue&amp;id=twitter_tweet_button_0&amp;lang=tr&amp;screen_name=Gursesotoas&amp;show_count=false\" class=\"twitter-follow-button\" style=\"width: 70px; height: 20px;\" width=\"70\" title=\"\"></iframe>";
	atmp.appendChild(btmp);	



	del.appendChild(atmp);
	del.style.display='none';

	if( typeof( window.innerWidth ) == 'number' ) {
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}


	jQuery(del).css({
		'top': (((myHeight/2)-122) + ((window.pageYOffset)?window.pageYOffset:(document.documentElement && document.documentElement.scrollTop)?document.documentElement.scrollTop:document.body.scrollTop)),
		'left': (myWidth/2)-348
	});

	oldresize=window.onresize;
	oldscroll=window.onscroll;

	window.onresize=renew;
	window.onscroll=renew;

	document.body.appendChild(del2, document.body);
	document.body.appendChild(del, document.body);
	
	jQuery(del2).fadeTo(1000, 0.7);
	jQuery(del).fadeIn(1000);
}

