function Print(){
	 	var w = 700;
	 	var h = 800;
	 	var content;
	 	var winl = (screen.width - w) / 2;
     	var wint = (screen.height - h) / 2-50;
     	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+'resizable=1,scrollbars=yes';
	 	content = document.getElementById('printSection');
  			var generator=window.open('','name',winprops);
  			generator.document.write('<html><head><title>Spausdinti</title>');
 			generator.document.write('<link href=".\/template\/popupStyle.css" rel="stylesheet" type="text\/css" media="print" \/>');
 			generator.document.write('</head><body><p id="display" align="right"><a href="#" onclick="window.print(); return window.close();">Spausdinti</a></p>');
  			generator.document.write('<div>'+content.innerHTML+'</div>');
  			generator.document.write('</body></html>');
  			generator.document.close();
  			return false;
}

function openwindow(url, width, height) {
	// hack for IE 7
	if(navigator.appVersion.indexOf('MSIE 7') != -1) {
		height += 20;
	}

	xposition = 20; yposition = 20;
	if ((parseInt(navigator.appVersion) >= 4 )){
		xposition = (screen.width - width) / 2;
		yposition = (screen.height - height) / 2;
	}

	args = "width=" + width + ","
		    + "height=" + height + ","
			+ "location=0,"
			+ "menubar=0,"
			+ "resizable=0,"
			+ "scrollbars=no,"
			+ "status=0,"
			+ "titlebar=0,"
			+ "toolbar=0,"
			+ "hotkeys=0,"
			+ "screenx=" + xposition + ","  //NN Only
			+ "screeny=" + yposition + ","  //NN Only
			+ "left=" + xposition + ","     //IE Only
			+ "top=" + yposition;           //IE Only
	ww = window.open(url, '', args);
}

function toggleEditor(id) {
	if (!tinyMCE.getInstanceById(id)) {
		$('#'+id).addClass('tinymce_area');
		tinyMCE.execCommand('mceAddControl', false, id);
	}
	else {
		$('#'+id).removeClass('tinymce_area').addClass('inputTextarea');
		tinyMCE.execCommand('mceRemoveControl', false, id);
	}
}