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

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