/******************************************************************************************/
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;
	}
}

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;
  }
}

var link_ = '';

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

function cssPrint(STATE){
	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'){
		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]);
					}
				}
			}
		}
	}
}


function recommend_this_link(my_text){
	
	//var nr_email = document.getElementById('nr_elements').value;
	//alert(nr_email);
	/*body_height=document.getElementById('page').offsetHeight;
	//alert(body_height);
	document.getElementById('boxSendtofriend').style.display = 'block';
	document.getElementById('cover').style.display = 'block';
	document.getElementById('your_email').focus();
	if(body_height<768){
		document.getElementById('cover').style.height = 1024+'px';
	} else {
		document.getElementById('cover').style.height = body_height+'px';
	}*/
	body_height=document.getElementById('body_wrapper').offsetHeight;
	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';
	}
	
	document.getElementById('boxSendToFriend').style.display = 'block';
	if(my_text != ""){
		document.getElementById('r-message').value = my_text;
	}
	//document.getElementById('cover').style.display = 'block';
	document.getElementById('your_email').focus();
	if(my_text != ""){
		for(i=1;i<=5;i++){
			document.getElementById('label_email'+i).className="none";
			document.getElementById('email'+i).value="";
		}
		document.getElementById('label_your_email').className="none";
		document.getElementById('your_email').value="";
		document.getElementById('error_message').style.display="none";
		document.getElementById('success_message').style.display="none";
		document.getElementById('nr_elements').value=1;
		for(j=2;j<=5;j++){
			document.getElementById("p_email_"+j).style.display="none";
		}
		document.getElementById("show_new_email").style.display = "";
	}
}

function showWrapperboxSendToFriend(){
	document.getElementById('boxSendToFriend').style.display = 'none';
	document.getElementById('cover').style.display = 'none';
}
function add_new_email(nr_email){
	var nr_email = document.getElementById('nr_elements').value;
	if(nr_email < 5){
		nr_email = eval(nr_email) + 1;
		var id_email = "p_email_"+nr_email;
		document.getElementById(id_email).style.display = "";
		document.getElementById("nr_elements").value = nr_email;
		if(nr_email == 5){
			document.getElementById("show_new_email").style.display = "none";
		}
	}
}