function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}


var http = createRequestObject();

function handleResponse() {
        var error_all=0;
    if(http.readyState == 4){

        var response = http.responseText;
        var update = new Array();
        var form_errors =  new Array();
        if(response.indexOf('|') != -1) {
            update = response.split('|');
            if (response.indexOf('=') != -1){
                                  for (var i = 0; i < update.length; ++i){
                         var values = update[i].split('=');
                                         form_errors[i]=values[1];
                          }
                }else {
                        alert("Hibás adatvisszaadás");
                        }
        }else{
                        alert("Hibás adatvisszaadás");
                }

                if(form_errors[0]==1){
                        document.getElementById('error').innerHTML='Nincs megadva email cím!';
                        document.getElementById('user_email').className='inputmezo_error'
                        error_all=1;
                }else if (form_errors[0]==2){
                        //document.getElementById('error').innerHTML='A megadott e-mail cím már használatban van!';
                        alert('A megadott e-mail cím már használatban van!');
                        document.getElementById('user_email').className='inputmezo_error'
                        error_all=1;
                }else if (form_errors[0]==3){
                        document.getElementById('error').innerHTML='&nbsp;';
                }else{
                        document.getElementById('error').innerHTML='Hiba a visszakért adatokból';
                        error_all=1;
                }
				/*
                if(form_errors[1]==1){
                        document.getElementById('error2').innerHTML='Nincs megadva biztonsági kód!';
                        document.getElementById('captcha').className='inputmezo_error'
                        error_all=1;
                }else if (form_errors[1]==2){
                        document.getElementById('error2').innerHTML='Nem megfelelő biztonsági kód!';
                        document.getElementById('captcha').className='inputmezo_error'
                        error_all=1;
                }else if (form_errors[1]==3){
                        document.getElementById('error2').innerHTML='&nbsp;';
                }else{
                        document.getElementById('error2').innerHTML='Hiba a visszakért adatokból';
                        error_all=1;
                }
				*/

                if(error_all==0){
                        document.getElementById('form').submit();
                }
    }
}


    function newsletterSub() {
    	var email=document.getElementById('newsletterEmail').value;
    	document.location.href='index.php?menu=newsletter&email='+email;
    }

    function show_hide(id) {
        var element = document.getElementById(id);
        if (element.style.display == 'block') {
            element.style.display = 'none';
        }
        else {
            element.style.display = 'block';
        }
    }

   function addcomment(smile) {
    	document.getElementById('comment_text').value+=smile;
    }

    function newsletterSub() {
    	var email=document.getElementById('newsletterEmail').value;
    	document.location.href='index.php?menu=newsletter&email='+email;
    }



function resize_event()
{
		location.href =  document.location.href; 
}

function windowsize2() {
  var width = 0, height = 0;
  
  if( typeof( window.innerWidth ) == 'number' ) {
    width = window.innerWidth;
    height = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    
    width = document.documentElement.clientWidth;
    height = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    width = document.body.clientWidth;
    height = document.body.clientHeight;
  }
  
   if (height <500)
  	{
		document.getElementById('css').href = './css/style3.css';	
	}else if(height <600)
	{
		document.getElementById('css').href = './css/style.css';	
	}
	else
	{
	 	document.getElementById('css').href = './css/style2.css';
	}
	
 
}


