function _set_search_form(t,tt){
  
  var b,f;
  
  try {
    f = document.createElement('<input type="text" value="" name="mwshop_fulltext" size="10" id="searchfield" autocomplete="off" />');
    b = document.createElement('<input type="submit" value="' + t + '" title="' + tt + '" id="searchbutton" />');
    
  } catch (e) {
    f = document.createElement("input");
    f.setAttribute("type", "text");
    f.setAttribute("name", "mwshop_fulltext");
    f.setAttribute("value", "");
    f.setAttribute("size", "10");
    f.setAttribute("id", "searchfield");
    f.setAttribute("autocomplete", "off");
    
    b = document.createElement("input");
    b.setAttribute("type", "submit");
    b.setAttribute("value", t);
    b.setAttribute("title", tt);
    b.setAttribute("id", "searchbutton");
   
  }
  
  var p = document.getElementById('search_form');
  
 if(p && f && b){ 
    p.appendChild(f);
    p.appendChild(b);
  }
}

function _set_custom_focus(){
 var f = document.getElementById('searchfield');
 
 if(f){
   f.focus();	
 }
}

function getswf(id,param,w,h,play,loop,bg)
{
 	if (AC_FL_RunContent == 0) {
		alert('Error - script not found');
	} else {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
			'width', w ,
			'height', h ,
			'src', param,
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', play ,
			'loop', loop ,
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', id ,
			'bgcolor', bg,
			'name', id ,
			'menu', 'false',
			'allowScriptAccess','sameDomain',
            'movie', param,
			'salign', ''
			); 
	}

}


/* AJAX */
function setdisplay(str){

	var mySplitResult = str.split(" ");

	for(i = 0; i < mySplitResult.length; i++){
		var row = document.getElementById(mySplitResult[i]);
		if (row.style.display == '') row.style.display = 'none';
		else row.style.display = '';
	}
}


function WEEBO_set_data(xobj){
/*
 var iname = document.getElementsByTagName('input');
 afield = '';
 
 for(i = 0; i<iname.length; i++){
   afield = iname[i].name==fname ? afiled + iname[i].value.';': afield;
 }
 return afield;
}
*/
if(!xobj || xobj.length<1){ obj = document; }else{ obj = document.getElementById(xobj); }

  var getstr = "?";
  for (i=0; i<obj.getElementsByTagName("input").length; i++) {
        if (obj.getElementsByTagName("input")[i].type == "hidden") {
           getstr += obj.getElementsByTagName("input")[i].name + "=" + 
                   obj.getElementsByTagName("input")[i].value + "&";
        }
		if (obj.getElementsByTagName("input")[i].type == "text") {
           getstr += obj.getElementsByTagName("input")[i].name + "=" + 
                   obj.getElementsByTagName("input")[i].value + "&";
        }
        if (obj.getElementsByTagName("input")[i].type == "checkbox") {
           if (obj.getElementsByTagName("input")[i].checked) {
              getstr += obj.getElementsByTagName("input")[i].name + "=" + 
                   obj.getElementsByTagName("input")[i].value + "&";
           } else {
              getstr += obj.getElementsByTagName("input")[i].name + "=&";
           }
        }
        if (obj.getElementsByTagName("input")[i].type == "radio") {
           if (obj.getElementsByTagName("input")[i].checked) {
              getstr += obj.getElementsByTagName("input")[i].name + "=" + 
                   obj.getElementsByTagName("input")[i].value + "&";
           }
     }  
     if (obj.getElementsByTagName("input")[i].tagName == "SELECT") {
        var sel = obj.getElementsByTagName("input")[i];
        getstr += sel.name + "=" + sel.options[sel.selectedIndex].value + "&";
     }
     
  }
  return getstr;
}


/* WEEBO XMLHTTPREQUEST object v 1.2 */         
function xmlhttp(addr, obj, cl_obj, cl_obj_type, formid)
{
/*
@addr - php request address
@obj - dom object id
@cl_obj - value dom object id (search field)
@cl_obj_type - behavior type inner or value, hide cl_obj when not set
*/

    var xhttpRequest;
    try {  
         xhttpRequest = new XMLHttpRequest(); /* Firefox, Opera, Konq... */
        } 
        catch(e){ 
        try 
           { 
            xhttpRequest = new ActiveXObject("Msxml2.XMLHTTP"); /* IE MS XML 2 */
           } 
            catch (e) {
            try { 
                  xhttpRequest = new ActiveXObject("Microsoft.XMLHTTP"); /* IE MS XML */
                } 
                  catch (E) { xhttpRequest = false; 
                }
           } 
        }
    // customize str
	var cachebeat=parseInt(Math.random()*999999);
	var my_request = WEEBO_set_data(formid) + '&weebo_no_chache_param=' + cachebeat;

    xhttpRequest.open("POST", addr, true);
	xhttpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhttpRequest.setRequestHeader("Content-length", my_request.length);
	xhttpRequest.setRequestHeader("Connection", "close");
    xhttpRequest.onreadystatechange= function (){
        processRequest(xhttpRequest, addr, obj, cl_obj, cl_obj_type) 
    };
    xhttpRequest.send(my_request);
}

function processRequest(xhttpRequest, addr, obj, cl_obj, cl_obj_type) 
{
    if(cl_obj_type=='value'){ vl =  document.getElementById(cl_obj).value.length; }
    if (xhttpRequest.readyState == 4){
        if(( xhttpRequest.status >= 200 && xhttpRequest.status < 300 ) || xhttpRequest.status == 304){
            if (typeof obj == 'string'){
                if(cl_obj_type=='value' && vl<1){ document.getElementById(obj).style.display = 'block'; }
                if(obj.length>0){ document.getElementById(obj).innerHTML = xhttpRequest.responseText; }
            }
        }else{
            alert("Chyba adresy " + xhttpRequest.status +" : "+ xhttpRequest.statusText);
        }
		
    }else{
        
		if (typeof addr == 'string' && obj != ''){
             if(obj.length>0){ document.getElementById(obj).innerHTML = '<span class="list_preloader"></span>'; }
        }
    }
	
    if(cl_obj_type=='value' && vl<1 && obj.length>0){ document.getElementById(obj).style.display = 'none'; }
       
}          

