var  intital_top = 0;
jQuery(document).ready(function () {
	jQuery('#fb_share_button').html('<a name="fb_share" type="button_count" href="http://www.facebook.com/sharer.php?u='+escape(_GPD.PAGE.url)+'&t='+_GPD.PAGE.title+'">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>');
	jQuery('#fb_recom_button').html('<iframe src="http://www.facebook.com/plugins/like.php?href='+escape(_GPD.PAGE.url)+'&amp;layout=standard&amp;show_faces=true&amp;width=300&amp;action=recommend&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:300px; height:80px"></iframe>');
	jQuery('#fb_like_box').html('<iframe src="http://www.facebook.com/plugins/activity.php?site='+escape(_GPD.SITE.url)+'&amp;width=300&amp;height=300&amp;header=true&amp;colorscheme=light&amp;recommendations=false" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:300px; height:300px;" allowTransparency="true"></iframe>');
	jQuery('#fb_like_button').html('<iframe src="http://www.facebook.com/plugins/like.php?href='+escape(_GPD.PAGE.url)+'&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;font=trebuchet+ms&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>');
	
		
	if ( $("#recommend_allover").length > 0 ) {
		p = $('#recommend_allover').position();
		intital_top = p.top + 20;
		intital_top = parseInt(intital_top);
		$(window).scroll(recommend_allover).resize(recommend_allover);				
	}
});


function recommend_allover(){	
	if (intital_top<=$(window).scrollTop()){
		$('#recommend_allover').css({'position': 'fixed','margin-top':'0px','top':'0px','z-index':987321,'width': $('#recommend_allover').width()});			
	}else{
		$('#recommend_allover').css({'position': '','margin-top':'20px'});
	}
}

function changeBg(el,stat) {
	if (stat){ el.className='menu_hover'; } else { el.className='menu_out'; }
}
//IE FLICKER FIX :d
try {
 	  document.execCommand("BackgroundImageCache", false, true);
  }
catch(err) {}

//image1 = new Image();
//image1.src = "http://www.yuppy.ro/images/common/menu_head.gif";

var ie=document.all
var ns6=document.getElementById && !document.all
function showPopUp(){
	document.getElementById('pWinConfg').style.visibility='visible';
}
function hidePopUp(){
	document.getElementById('pWinConfg').style.visibility='hidden';
}
function startPopUp(){
	timerID=setTimeout('showPopUp()',3000);
}

function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if cookie exists
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1)
         end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}
function setCookie( name, value, expires, path, domain, secure ) 
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct 
expires time, the current script below will set 
it for x number of days, to make it for hours, 
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" ) + 
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}

function loadornot(){
	if (get_cookie('popunder')=='true'){
		startPopUp();
		setCookie("popunder","false",1,"/","www.yuppy.ro");
	}
}

loadornot();

function report_comment(cid,type) {
	if(jQuery !== undefined) {
		$.ajax({
		   type: 'POST',
		   url:  'http://www.yuppy.ro/ajax.php',
		   data: 'act=report_comment&cid=' + cid + '&type=' + type,
		   success: function(result){			
				if(result.success) {
					alert('Comentariul a fost raportat!');
				}
		   },
		   dataType: 'json'
		 });
	}
}

var old_ps_art = 0;

function show_plugin_slide(id) {
	if (id == old_ps_art) return;
	if(jQuery !== undefined) {
		$('#ps_art_'+old_ps_art).fadeOut('fast',
			function() { $('#ps_art_'+id).fadeIn('fast'); }
		);
		
		$('#ps_but_'+old_ps_art).removeClass('ps_butt_current');
		$('#ps_but_'+id).addClass('ps_butt_current');
		
		old_ps_art = id;
	}
}

function plugin_slide_nav(pos) {
	if (document.getElementById('ps_art_'+(old_ps_art+pos)))
		show_plugin_slide(old_ps_art+pos);
}

function open_picture_window(url) {
	var fWP = window.open(url, 'gf_picture', 'location=1,status=1,scrollbars=1,resize=1,width=1000,height=780');
	fWP.focus();
	
	return false;
}

function validate_poll_form() { 
	return true; 
}

function google_ad_request_done(google_ads) {
	//console.debug(google_ads);
	var s = '';
	var i;
	if (google_ads.length == 0) {
		return;
	}
	if (google_ads[0].type == "flash") {
		s += '<a href=\"' +
		google_info.feedback_url + '\" style="color:#000000"><b>Ads by Google</b></a><br>' + 
		'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' +
		'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="' +
		google_ad.image_width + '" HEIGHT="' +
		google_ad.image_height + '"> <PARAM NAME="movie" VALUE="' +
		google_ad.image_url + '">' +
		'<PARAM NAME="quality" VALUE="high">' +
		'<PARAM NAME="AllowScriptAccess" VALUE="never">' +
		'<EMBED src="' +
		google_ad.image_url + '" WIDTH="' +
		google_ad.image_width + '" HEIGHT="' +
		google_ad.image_height +
		'" TYPE="application/x-shockwave-flash"' +
		' AllowScriptAccess="never" ' +
		' PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';
	} else if (google_ads[0].type == "image") {
		s += '<a href=\"' +
		google_info.feedback_url + '\" style="color:#000000"><b>Ads by Google</b></a><br> <a href="' +
		google_ads[0].url + '" target="_top" title="go to ' +
		google_ads[0].visible_url + '" onmouseout="window.status=\'\'"onmouseover="window.status=\'go to ' +
		google_ads[0].visible_url + '\';return true"><img border="0" src="' +
		google_ads[0].image_url + '"width="' +
		google_ads[0].image_width + '"height="' +
		google_ads[0].image_height + '"></a>';
	} else if (google_ads[0].type == "html") {
		s += google_ads[0].snippet;
	} else {
		if (google_ads.length == 1) {
			var br_html = (ads_shape != 0) ? ' ' : '<br>';
			var rem_brk = (rem_br == 0) ? '<br>' : '&nbsp;&nbsp;';
			s += '<a href=\"' + google_info.feedback_url + '\" style="float: left; clear: both; color:#000000;font-size:12px;text-decoration: underline;"><b>Anunşuri Google</b></a><br><ul style="float: left; clear: both; padding: 0px; margin: 5px 0px 0px 0px;">'
			for(i = 0; i < google_ads.length; ++i) {
				s += '<li style="'+li_style+'"><a style="'+url_title_style+'" href="' + google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\';return true"> <span style="color: #4a4a4a; font-size: 13px; float: nonr; text-decoration:underline; text-align: left;"> ' + google_ads[i].line1 + '</span></a>'+rem_brk+'<span style="float: none; text-align: left;'+text_style+'">' +
				google_ads[i].line2 + br_html +
				google_ads[i].line3 + '<br></span> <span style="float: none; text-align: left;"><a style="'+url_link_style+'" href="' +
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';return true">' +
				google_ads[i].visible_url + '</span></a></li>';
			}
			s += '</ul>';
		} else if (google_ads.length > 1) {
			var br_html = (ads_shape != 0) ? ' ' : '<br>';
			var rem_brk = (rem_br == 0) ? '<br>' : '&nbsp;&nbsp;';
			s += '<a href=\"' + google_info.feedback_url + '\" style="float: none; clear: both; color:#000000;font-size:12px;text-decoration: underline;"><b>Anunşuri Google</b></a><br><ul style="float: left; clear: both; padding: 0px; margin: 5px 0px 0px 0px;">'
			for(i = 0; i < google_ads.length; ++i) {
				s += '<li style="'+li_style+'"><a style="'+url_title_style+'" href="' + google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\';return true"> <span style="color: #4a4a4a; font-size: 13px; float: left; text-decoration:underline; text-align: left;"> ' + google_ads[i].line1 + '</span></a>'+rem_brk+'<span style="float: none; text-align: left;'+text_style+'">' +
				google_ads[i].line2 + br_html +
				google_ads[i].line3 + '<br></span> <span style="float: left; text-align: left;"><a style="'+url_link_style+'" href="' +
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';return true">' +
				google_ads[i].visible_url + '</span></a></li>';
			}
			s += '</ul>';
		}
	}
	document.write(s);
	return;
}

