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 printDiv (div) {
    var a = window.open('','','width=800,height=600');
    a.document.open("text/html");
    a.document.write('<html><head><link rel="stylesheet" href="/css/index.css"></link><link rel="stylesheet" href="/css/base.css"></link></head><body style="padding-left:20px;background-image:none;background-color:#FFFFFF;">');
    if (navigator.userAgent.indexOf("Opera")>=0) a.document.write("<div class='float_right r_space_much'><a href='javascript:window.print();window.close();'><img src='"+BASEURL+"images/print.gif'></a></div>"); 
    a.document.write(document.getElementById(div).innerHTML);
    a.document.close();
    if (navigator.userAgent.indexOf("Opera")>=0) { 
        
    } else {
        a.print();
        a.close();
    }
    
}

function sender(link){
    //window.alert(id+ "  " +quant);
    if (navigator.userAgent.indexOf("Opera")>=0) { 
        location.href = BASEURL + 'fogyasztoi/kapcsolatfelvetel';
    } else {
        var url = BASEURL +"send.php?link="+link;
        xmlHttp=GetXmlHttpObject(stateChanged);
        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;
    msg=form.privmsg.value;
    msg = msg.replace(/\n/g, "<br/>");
    valami += "&privmsg="+ msg;
    valami += "&pre="+form.pre.value;
    valami += "&link="+form.link.value;
    valami += "&captcha_code="+form.captcha_code.value;
    xmlHttp=GetXmlHttpObject(stateChanged);
    //xmlHttp.setRequestHeader('Content-Type','multipart/form-data');
    xmlHttp.open("GET", BASEURL +"send.php?"+valami , false);
    xmlHttp.send(null);
}
function send_msg(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 += "&send="+form.send.value;
	valami += "&link="+form.link.value;
    xmlHttp=GetXmlHttpObject(stateChanged);
	//xmlHttp.setRequestHeader('Content-Type','multipart/form-data');
    xmlHttp.open("GET", BASEURL +"send.php?"+valami , false);
	xmlHttp.send(null);
}

function stateChanged() 
{ 
	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';
        document.getElementById('layer_content').innerHTML = res;
        document.getElementById('layer').style.display='block';
		//window.location.reload();
	} 
} 

function GetXmlHttpObject(handler)
{
    var objXmlHttp=null

    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 || navigator.userAgent.indexOf("Opera")>=0 || navigator.userAgent.indexOf("Safari")>=0)
    {
        objXmlHttp=new XMLHttpRequest()
        objXmlHttp.onload=handler
        objXmlHttp.onerror=handler 
        return objXmlHttp
    }
}