// JavaScript Document// *******************// * SHOPIX // * Moonlake.cz// * Petr Sládek// *******************// Rating system// -------------function select_innerHTML(objeto,innerHTML) {/******* select_innerHTML - corrige o bug do InnerHTML em selects no IE* Veja o problema em: http://support.microsoft.com/default.aspx?scid=kb;en-us;276228* Versão: 2.1 - 04/09/2007* Autor: Micox - Náiron José C. Guimarães - micoxjcg@yahoo.com.br* @objeto(tipo HTMLobject): o select a ser alterado* @innerHTML(tipo string): o novo valor do innerHTML*******/    objeto.innerHTML = ""    var selTemp = document.createElement("micoxselect")    var opt;    selTemp.id="micoxselect1"    document.body.appendChild(selTemp)    selTemp = document.getElementById("micoxselect1")    selTemp.style.display="none"    if(innerHTML.toLowerCase().indexOf("<option")<0){//se não é option eu converto        innerHTML = "<option>" + innerHTML + "</option>"    }    innerHTML = innerHTML.toLowerCase().replace(/<option/g,"<span").replace(/<\/option/g,"</span")    selTemp.innerHTML = innerHTML              for(var i=0;i<selTemp.childNodes.length;i++){  var spantemp = selTemp.childNodes[i];          if(spantemp.tagName){                 opt = document.createElement("OPTION")       if(document.all){ //IE    objeto.add(opt)   }else{    objeto.appendChild(opt)   }              //getting attributes   for(var j=0; j<spantemp.attributes.length ; j++){    var attrName = spantemp.attributes[j].nodeName;    var attrVal = spantemp.attributes[j].nodeValue;    if(attrVal){     try{      opt.setAttribute(attrName,attrVal);      opt.setAttributeNode(spantemp.attributes[j].cloneNode(true));     }catch(e){}    }   }   //getting styles   if(spantemp.style){    for(var y in spantemp.style){     try{opt.style[y] = spantemp.style[y];}catch(e){}    }   }   //value and text   opt.value = spantemp.getAttribute("value")   opt.text = spantemp.innerHTML   //IE   opt.selected = spantemp.getAttribute('selected');   opt.className = spantemp.className;  }  }     document.body.removeChild(selTemp) selTemp = null}var RatingStarToSend = 0;                               function RatingViewStar(num) {  document.getElementById('star_select').className = "s" + num;}function RatingChangeStarToSend(num) {  RatingStarToSend = num;  RatingWrite('p_id_rate');  document.getElementById('id_rate').options[num].selected = 'selected';}         function RatingWrite(kam) {  var inner = '<option value="" label="- Vyberte -" selected="selected">- Vyberte -</option> <option value="1" label="*">*</option> <option value="2" label="**">**</option> <option value="3" label="***">***</option> <option value="4" label="****">****</option> <option value="5" label="*****">*****</option>';                 if(document.getElementById(kam)) {             document.getElementById(kam).innerHTML  = '<label for="id_rate" class="optional">Hodnoceni:</label>';    document.getElementById(kam).innerHTML += '<select class="hide" name="id_rate" id="id_rate"></select>';     select_innerHTML(document.getElementById("id_rate"),inner);    document.getElementById(kam).innerHTML += '<span class="outter"><span id="star_select" class="s'+RatingStarToSend+'">'                                           +  '  <span onmouseover="RatingViewStar(1);" onmouseout="RatingViewStar(' + RatingStarToSend + ');" onclick="RatingChangeStarToSend(1)"></span>'                                           +  '  <span onmouseover="RatingViewStar(2);" onmouseout="RatingViewStar(' + RatingStarToSend + ');" onclick="RatingChangeStarToSend(2)"></span>'                                           +  '  <span onmouseover="RatingViewStar(3);" onmouseout="RatingViewStar(' + RatingStarToSend + ');" onclick="RatingChangeStarToSend(3)"></span>'                                           +  '  <span onmouseover="RatingViewStar(4);" onmouseout="RatingViewStar(' + RatingStarToSend + ');" onclick="RatingChangeStarToSend(4)"></span>'                                           +  '  <span onmouseover="RatingViewStar(5);" onmouseout="RatingViewStar(' + RatingStarToSend + ');" onclick="RatingChangeStarToSend(5)"></span>'                                           +  '</span></span>';  }      }// Contact Setting// ---------------function SettingDeliveryAsk() {  if (document.getElementById('custom_delivery').checked == true) {    document.getElementById('fieldset-contactform').style.display = "";  } else {    document.getElementById('fieldset-contactform').style.display = "none";  }}function SettingLoad() {  if (document.getElementById('custom_delivery').checked == true) {    document.getElementById('fieldset-contactform').style.display = "";  } else {    document.getElementById('fieldset-contactform').style.display = "none";  }} function checkMail(mail){  re = /^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$/;  return mail.search(re) == 0;}function checkForm(el){  if (!checkMail(el.email.value)){    alert("Není vyplňěn správný email!");    return false;  } else if(el.name.value == ""){    alert("Není vyplňěno jméno!");    return false;  } else if(el.tel.value == ""){    alert("Není vyplňěn telefon!");    return false;  } else if(el.question.value == ""){    alert("Není vyplňěn dotaz!");    return false;  }}/****  URL encode / decode*  http://www.webtoolkit.info/***/ var Url = { 	// public method for url encoding	encode : function (string) {		return escape(this._utf8_encode(string));	}, 	// public method for url decoding	decode : function (string) {		return this._utf8_decode(unescape(string));	}, 	// private method for UTF-8 encoding	_utf8_encode : function (string) {		string = string.replace(/\r\n/g,"\n");		var utftext = ""; 		for (var n = 0; n < string.length; n++) { 			var c = string.charCodeAt(n); 			if (c < 128) {				utftext += String.fromCharCode(c);			}			else if((c > 127) && (c < 2048)) {				utftext += String.fromCharCode((c >> 6) | 192);				utftext += String.fromCharCode((c & 63) | 128);			}			else {				utftext += String.fromCharCode((c >> 12) | 224);				utftext += String.fromCharCode(((c >> 6) & 63) | 128);				utftext += String.fromCharCode((c & 63) | 128);			} 		} 		return utftext;	}, 	// private method for UTF-8 decoding	_utf8_decode : function (utftext) {		var string = "";		var i = 0;		var c = c1 = c2 = 0; 		while ( i < utftext.length ) { 			c = utftext.charCodeAt(i); 			if (c < 128) {				string += String.fromCharCode(c);				i++;			}			else if((c > 191) && (c < 224)) {				c2 = utftext.charCodeAt(i+1);				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));				i += 2;			}			else {				c2 = utftext.charCodeAt(i+1);				c3 = utftext.charCodeAt(i+2);				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));				i += 3;			} 		} 		return string;	} }var test = 0;function showResult(str){	if (str.length==0){	  document.getElementById("livesearch_inner").innerHTML="";	  document.getElementById("livesearch_cont").style.display="none";	  return;	}	if (window.XMLHttpRequest){ // code for IE7+, Firefox, Chrome, Opera, Safari		xmlhttp=new XMLHttpRequest();	} else { // code for IE6, IE5		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");	}	xmlhttp.onreadystatechange=function(){	  if (xmlhttp.readyState==4 && xmlhttp.status==200){	    document.getElementById("livesearch_inner").innerHTML=xmlhttp.responseText;	    if(xmlhttp.responseText != ""){	    	document.getElementById("livesearch_cont").style.display="block";	    } else {	    	document.getElementById("livesearch_cont").style.display="none";	    }	  }	}	xmlhttp.open("GET","/asearch?q="+Url.encode(str),true);    if(test == 0){        xmlhttp.send();        test = 1;        setTimeout(function(){            test = 0;        },600)    } else {        setTimeout(function(){            xmlhttp.send();            test = 1;           },700)    }	}function hideResult(){   	setTimeout(function(){ document.getElementById("livesearch_cont").style.display = "none";},300);}function focusResult(str){	if (str.length>=0 && str != "Hledaný výraz" && document.getElementById("livesearch_inner").innerHTML != ""){  	  document.getElementById("livesearch_cont").style.display = "block";	} }function checkMail(mail){  re = /^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$/;  return mail.search(re) == 0;}function checkEnewsLogoutForm(el){  if (!checkMail(el.email.value)){    alert("Není vyplňěn správný email!");    return false;  }	}function checkQuestionForm(el){  if (!checkMail(el.email.value)){    alert("Není vyplňěn správný email!");    return false;  } else if(el.name.value == ""){    alert("Není vyplňěno jméno!");    return false;  } else if(el.surname.value == ""){    alert("Není vyplňěno příjmení!");    return false;  }  else if(el.tel.value == ""){    alert("Není vyplňěn telefon!");    return false;  } else if(el.question.value == ""){    alert("Není vyplňěn dotaz!");    return false;  }}function checkKatalogyForm(el){  if (!checkMail(el.email.value)){    alert("Není vyplňěn správný email!");    return false;  } else if(el.jmeno.value == ""){    alert("Není vyplňěno jméno!");    return false;  } else if(el.prijmeni.value == ""){    alert("Není vyplňěno příjmení!");    return false;  } else if(el.ulice.value == ""){    alert("Není vyplňěna ulice a čp.!");    return false;  }  else if(el.mesto.value == ""){    alert("Není vyplňěno město!");    return false;  }  else if(el.psc.value == ""){    alert("Není vyplňěno PSČ!");    return false;  }  else if(el.tel.value == ""){    alert("Není vyplňěn telefon!");    return false;  }}var inputbox = document.getElementById('hledat'); $('#hledat').keypress(function(el){ alert('test');} );/* 	inputbox.onkeypress 	= function(ev){ alert('test'); return p.onKeyPress(ev); };	inputbox.onkeyup 		= function(ev){ alert('test'); return p.onKeyUp(ev); };  */
