
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" : "" );
}




// text resizing
var currentTextSize = null;
var currentLineHeight = null;
// check for cookie
if (get_text_cookie("artFontSize")) {
    currentTextSize = parseInt(get_text_cookie("artFontSize"));
    currentLineHeight = parseInt(get_text_cookie("artLineHeight"));
} else {
    currentTextSize = 12;
    currentLineHeight = currentTextSize + 10;
    setCookie("artFontSize",currentTextSize,1,"/","plugin.yuppy.ro");
    setCookie("artLineHeight",currentLineHeight,1,"/","plugin.yuppy.ro");
}

function textSize(dir) {
    if (dir == 'up') {
        if (currentTextSize <= 18) {
            currentTextSize += 2;
        }
    } else if (dir == 'down') {
        if (currentTextSize >= 10) {
            currentTextSize -= 2;
        }
    }else{
    	currentTextSize=12;
    }
    currentLineHeight = currentTextSize + 10;
    document.getElementById('text_articol').style.fontSize = currentTextSize + 'px';
    document.getElementById('text_articol').style.lineHeight = currentLineHeight + 'px';

    
    // write/rewrite cookie
    setCookie("artFontSize",currentTextSize,1,"/","plugin.yuppy.ro");
    setCookie("artLineHeight",currentLineHeight,1,"/","plugin.yuppy.ro");
}

function get_text_cookie ( cookie_name )
{
  var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' );

  if ( results ) {
    return ( unescape ( results[1] ) );
  }
  else { return null; }
}


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

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

