function OpenNewWindow(url, x, y) {
	var options = "toolbar=no,menubar=no,scrollbars=yes,resizable=yes,width=" + x + ",height=" + y;
		msgWindow=window.open(url,"", options);
}

function OpenNewWindowNoScroll(url, x, y) {
	var options = "toolbar=no,menubar=no,scrollbars=no,resizable=yes,width=" + x + ",height=" + y;
		msgWindow=window.open(url,"", options);
}

// ----------------------------------------------------------------------------------------------

function sender(link){
    //window.alert(id+ "  " +quant);
    var url = BASEURL+"send.php?link="+link;
    xmlHttp=GetXmlHttpObject(responsed);
    xmlHttp.open("GET", url , true);
    xmlHttp.send(null);
}

function getAjaxContent(id){
    //window.alert(id+ "  " +quant);
    var url = BASEURL+"getcontent.php?id="+id;
    xmlHttp=GetXmlHttpObject(resp_cont);
    xmlHttp.open("GET", url , true);
    xmlHttp.send(null);
} 
function hidePopup(){
    //window.alert(id+ "  " +quant);
    document.getElementById('popup').style.display='none';
}
function preview(form){
    //window.alert(id+ " _ " +quant);
    valami= "rec_nm="+form.rec_nm.value;
    valami += "&rec_em="+form.rec_em.value;
    valami += "&send_nm="+form.send_nm.value;
    valami += "&send_em="+form.send_em.value;
    valami += "&privmsg="+form.privmsg.value;
    valami += "&pre="+form.pre.value;
    valami += "&link="+form.link.value;
    xmlHttp=GetXmlHttpObject(responsed);
    //xmlHttp.setRequestHeader('Content-Type','multipart/form-data');
    xmlHttp.open("GET", "http://bionatura.hu/send.php?"+valami , false);
    xmlHttp.send(null);
}
function sendLink(form){
	//window.alert(form);
    valami= "rec_nm="+form.rec_nm.value;
    valami += "&rec_em="+form.rec_em.value;
    valami += "&send_nm="+form.send_nm.value;
    valami += "&send_em="+form.send_em.value;
    valami += "&privmsg="+form.privmsg.value;
    valami += "&send="+form.send.value;
	valami += "&link="+form.link.value;
    xmlHttp=GetXmlHttpObject(responsed);
	//xmlHttp.setRequestHeader('Content-Type','multipart/form-data');
    xmlHttp.open("GET", "http://bionatura.hu/send.php?"+valami , false);
	xmlHttp.send(null);
}

function responsed() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
        res=xmlHttp.responseText;
        if (res.indexOf('1') == 0) {
            res=res.substr(1);
            setTimeout('hidePopup()', 3000);
        }
        document.getElementById('popup_content').innerHTML = res;
        document.getElementById('popup').style.display='block';
		//window.location.reload();
	} 
} 

function resp_cont() 
{ 
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
        res=xmlHttp.responseText;
        if (res.indexOf('1') == 0) {
            res=res.substr(1);
            setTimeout('hidePopup()', 3000);
        }
        document.getElementById('popup_content').innerHTML = res;
        document.getElementById('popup').style.display='block';
        //window.location.reload();
    } 
} 

var voltcsere = false;
var menet = "<b>Visszaigazolás menete:</b><br /> 1. Ön <b>leadja</b> rendelését a webshopon keresztül,<br /> 2. automatikus email választ kap a rendelés <b>beérkezéséről</b>,<br /> 3. munkatársunk <b>telefonon véglegesíti, és visszaigazolja</b> az Ön rendelését.";
function hintInfo() {
  if (!voltcsere) {   
      voltcsere = true;
      htmll = $("#printable_cont").html();
      htmll = htmll.replace("visszaigazolásával","<span class='hinter' style='display:inline!important'><span style='position:relative;cursor:pointer' onmouseover='showHint(this)' onmouseout='hideHint()'>visszaigazolás</span><span>ával</span></span>");
      $("#printable_cont").html(htmll);
      $("body").append("<div id='thint' style='position:absolute;left:70px;top:10px;display:none;padding:5px;border:1px orange solid;background:#D1E2EF;color:black; width:300px;z-index:30000'>"+menet+"</div>")
  } 
}

function hintInfoOff() {
    voltcsere = false;
    $(".hinter").after("visszaigazolásával");
   $(".hinter").remove();
}

function showHint(obj) {
    var offset = $(obj).offset(); 
    $("#thint").css("top",(parseInt(offset.top)+30)+"px"); 
    $("#thint").css("left",(parseInt(offset.left)+5)+"px"); 
    $("#thint").fadeIn("fast"); 
}

function hideHint() { 
    $("#thint").fadeOut(); 
}

$(document).ready(function(){
    if ($("#printable_cont").attr("style") == "margin: 30px 10px;") {

        $("#printable_cont").mouseover(function() {hintInfo();});
      $("#printable_cont").mouseout(function() {hintInfoOff();});
    }
});

/*function GetXmlHttpObject(handler)
{

	var objXmlHttp=null

	if (navigator.userAgent.indexOf("Opera")>=0)
	{
		alert("This feature doesn't work in Opera") 
		return 
	}
	if (navigator.userAgent.indexOf("MSIE")>=0)
	{ 
		var strName="Msxml2.XMLHTTP"
		if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
		{
			strName="Microsoft.XMLHTTP"
		} 
		try
		{ 
			objXmlHttp=new ActiveXObject(strName)
			objXmlHttp.onreadystatechange=handler
			return objXmlHttp
		} 
		catch(e)
			{ 
				alert("Error. Scripting for ActiveX might be disabled") 
				return 
			} 
	} 
	if (navigator.userAgent.indexOf("Mozilla")>=0)
	{
		objXmlHttp=new XMLHttpRequest()
		objXmlHttp.onload=handler
		objXmlHttp.onerror=handler 
		return objXmlHttp
	}
}*/
