function showboxSendToFriend(frombody, phpSelf, host){
	body_height=(eval)(document.getElementById('wrapper').offsetHeight + document.getElementById('footer').offsetHeight);
	//alert(body_height);
	document.getElementById('boxSendToFriend').style.display = 'block';
	document.getElementById('cover').style.display = 'block';
	if(body_height<768){
		document.getElementById('cover').style.height = 1024+'px';
	} else {
		document.getElementById('cover').style.height = body_height+'px';
	}
	if(frombody == 0){
		// inhibam mesajele de eroare
		document.getElementById('error_message').style.display = "none";
		var aLabel = new Array("label_your_email", "label_email1", "label_subject", "label_message", "label_captcha");
		for(i=0;i<aLabel.length;i++){
			document.getElementById(aLabel[i]).className = "error1";
		}
		
		// resetam valorile 
		document.getElementById('title').value = "Informatii Total Fun";
		document.getElementById('message').value = "Am gasit pe site-ul Total Fun ceva ce m-am gandit ca te-ar interesa, la adresa aceasta:  " + host + phpSelf;
		document.getElementById('nr_elements').value = "1";
		document.getElementById('your_email').value = "";
		document.getElementById('email1').value = "";
		for(i=2;i<=5;i++){
			var id_email = "p_email_"+i;
			document.getElementById("email"+i).value = "";
			document.getElementById(id_email).style.display = "none";
		}
		document.getElementById("show_new_email").style.display = "";
	}
}
function showWrapperboxSendToFriend(){
	document.getElementById('nr_elements').value = "1";
	document.getElementById('your_email').value = "";
	document.getElementById('email1').value = "";
	for(i=2;i<=5;i++){
		var id_email = "p_email_"+i;
		document.getElementById("email"+i).value = "";
		document.getElementById(id_email).style.display = "none";
	}
	document.getElementById("show_new_email").style.display = "";
	document.getElementById('boxSendToFriend').style.display = 'none';
	document.getElementById('cover').style.display = 'none';
}

/* pentru bookmark-uri*/
function CreateBookmark(s_title) {
	favTitle = s_title;
	favUrl = window.location.href;
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(favTitle, favUrl,"");
	}else if( window.external ) { // IE Favorite
		window.external.AddFavorite( favUrl, favTitle);
	}else if(window.opera && window.print) { // Opera Hotlist
		return true;
	}
}

/*pentru print*/

function addEvent(obj, evType, fn, useCapture){
  if (obj.addEventListener){
    obj.addEventListener(evType, fn, useCapture);
    return true;
  } else if (obj.attachEvent){
    var r = obj.attachEvent("on"+evType, fn);
    return r;
  }
}

function cssPrintIE(){
	cssPrint('OFF');
}
function printIE(){
	window.print();
}

function cssPrint(STATE){
	document.getElementById('pane2').className = 'classPrint';
	if(STATE == undefined){
		STATE = 'OFF';
	}
	if(STATE.toUpperCase() == 'ON'){
		var H = document.getElementsByTagName('head').item(0);
		var printStyle = document.createElement('link');
		printStyle.setAttribute('href', 'layout-print.css');
		printStyle.setAttribute('rel', 'stylesheet');
		printStyle.setAttribute('id', 'printCSSLink');
		H.appendChild(printStyle);

		if(navigator.userAgent.indexOf('MSIE 6') > -1){
			var H = document.getElementsByTagName('head').item(0);
			var printStyle = document.createElement('link');
			printStyle.setAttribute('href', 'layout-print-ie6.css');
			printStyle.setAttribute('rel', 'stylesheet');
			printStyle.setAttribute('id', 'printCSSLinkIE6');
			H.appendChild(printStyle);
		}

		var B = document.getElementsByTagName('body').item(0);
		var bR = document.createElement('input');
		bR.setAttribute('id', 'printCSS_Renunta');
		bR.setAttribute('type', 'button');
		bR.setAttribute('value', 'Renunta');
		//bR.setAttribute('onclick', 'javascript:cssPrint(\'OFF\');');

		addEvent(bR, 'click', cssPrintIE);

		bR.style.position="absolute";
		bR.style.zIndex="99999";
		bR.style.width="100px";
		bR.style.top="10px";
		bR.style.left="50%";
		bR.style.marginLeft="220px";
		B.appendChild(bR);

		if(navigator.userAgent.toUpperCase().indexOf('SAFARI') == -1){
			var bP = document.createElement('input');
			bP.setAttribute('id', 'printCSS_Tipareste');
			bP.setAttribute('type', 'button');
			bP.setAttribute('value', 'Tipareste');
			//bP.setAttribute('onclick', 'javascript:print();');
	
			addEvent(bP, 'click', printIE);
	
			bP.style.position="absolute";
			bP.style.zIndex="99999";
			bP.style.width="100px";
			bP.style.top="10px";
			bP.style.left="50%";
			bP.style.marginLeft="100px";
			B.appendChild(bP);
		}

		window.location.href='#';

	}else if(STATE.toUpperCase() == 'OFF'){
		document.getElementById('pane2').className = 'scroll-pane';
		if(link_ != ''){
			document.location.href=link_;
		}else{
			var H = document.getElementsByTagName('head').item(0);

			NODES = H.childNodes;
			for(i=0; i<NODES.length; i++){
				if(NODES[i].id=='printCSSLink' || NODES[i].id=='printCSSLinkIE6'){
					if(navigator.userAgent.toUpperCase().indexOf('SAFARI') > -1 || navigator.userAgent.indexOf('MSIE 6') > -1){
						NODES[i].href='/';
					}else{
						H.removeChild(NODES[i]);
					}
				}
			}
			NODES = H.childNodes;
			for(i=0; i<NODES.length; i++){
				if(NODES[i].id=='printCSSLink' || NODES[i].id=='printCSSLinkIE6'){
					if(navigator.userAgent.toUpperCase().indexOf('SAFARI') > -1 || navigator.userAgent.indexOf('MSIE 6') > -1){
						NODES[i].href='/';
					}else{
						H.removeChild(NODES[i]);
					}
				}
			}

			B = document.getElementsByTagName('body').item(0);
			NODES = B.childNodes;
			for(i=0; i<NODES.length; i++){
				if(NODES[i].id=='printCSS_Renunta'){
					B.removeChild(NODES[i]);
				}
			}

			if(navigator.userAgent.toUpperCase().indexOf('SAFARI') == -1){
				NODES = B.childNodes;
				for(i=0; i<NODES.length; i++){
					if(NODES[i].id=='printCSS_Tipareste'){
						B.removeChild(NODES[i]);
					}
				}
			}
		}
	}
}
