// Add to Favorites function bookmarksite(title,url) { if (/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent)) { window.external.AddFavorite(url, title); } else { alert("Ctrl+D להוספת האתר למועדפים אנא לחצו"); } } // Copy to Clipboard function doact(d) { var doc = eval("document.readme."+d); cp = doc.createTextRange(); doc.focus(); doc.select(); cp.execCommand("Copy"); } // Ajax Voting function updateInner(){ if(xml.readyState == 4){ if(xml.status == 200){ //document.getElementById("responseDiv").innerHTML = xml.responseText; alert(xml.responseText); } } } function gameVote(id,rating){ xmlRequest("post","http://www.kefpo.co.il/content/add_rating.php","id="+id+"&rating="+rating,updateInner); } // My Games function alertGames(){ if(xml.readyState == 4){ if(xml.status == 200){ alert(xml.responseText); } } } function updateGames(){ if(xml.readyState == 4){ if(xml.status == 200){ document.getElementById("gamesDiv").innerHTML = xml.responseText; } } } function addGame(id){ xmlRequest("post","http://www.kefpo.co.il/content/add_game.php","id="+id,alertGames); } function removeGame(id){ xmlRequest("post","http://www.kefpo.co.il/content/remove_game.php","id="+id,updateGames); } // Comments function commentsLoadingAnimation() { document.getElementById("gameComments").style.display = "none"; document.getElementById("ajaxLoader").style.display = "block"; } function reloadComments(){ if(xml.readyState == 4){ if(xml.status == 200){ var msg = xml.responseText.substr(0,xml.responseText.indexOf('~')); document.getElementById("gameComments").innerHTML = xml.responseText.substr(xml.responseText.indexOf('~')+1); document.getElementById("ajaxLoader").style.display = "none"; document.getElementById("gameComments").style.display = "block"; if (msg != 'OK' && xml.responseText.indexOf("~") < xml.responseText.indexOf("<") && xml.responseText.indexOf("~") != -1) alert('שגיאה: ' + msg); } } } function addComment(id){ xmlRequest("post","http://www.kefpo.co.il/add_comment.php","id="+id+"&comment="+document.getElementById("comment").value,reloadComments); commentsLoadingAnimation(); } function commentsPage(id,p){ xmlRequest("post","http://www.kefpo.co.il/comments.php","id="+id+"&page="+p,reloadComments); commentsLoadingAnimation(); } // Ajax definition function makeXml(){ var temp=false; if (window.XMLHttpRequest){ try { temp = new XMLHttpRequest(); } catch(e) { temp = false; } } else if(window.ActiveXObject){ try{ temp = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { try{ temp = new ActiveXObject("Msxml2.HTMLHTTP"); } catch(e) { temp = false; } } } return temp; } function xmlRequest(method, url, toSend,handler){ xml = makeXml(); if(xml){ xml.open(method, url, true); xml.setRequestHeader("content-type","application/x-www-form-urlencoded"); if(handler){ xml.onreadystatechange = handler; } if(method == "GET"){ xml.send(null); }else{ xml.send(toSend); } }else{ alert("Your browser does not seem to support XMLHttpRequest."); } } function isEmail(str) { var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if (!filter.test(str)) return false; return true; } function trimStr(str) { return str.split(" ").join(""); } function clearErrors() { document.getElementById("fullname_error").innerHTML = ""; document.getElementById("email_error").innerHTML = ""; document.getElementById("subject_error").innerHTML = ""; document.getElementById("body_error").innerHTML = ""; document.getElementById("body_error").style.display = "none"; } function sendMsg(frm) { var fullname = trimStr(frm.sender_name.value); var email = trimStr(frm.your_email.value); var subject = trimStr(frm.msg_subject.value); var body = trimStr(frm.msg_body.value); var isBool = true; clearErrors(); if (fullname == "") { document.getElementById("fullname_error").innerHTML = "חובה להזין שם מלא"; isBool = false; } if (subject == "") { document.getElementById("subject_error").innerHTML = "חובה להזין כותרת" isBool = false; } if (email == "") { document.getElementById("email_error").innerHTML = "חובה להזין כתובת דואר אלקטרוני"; isBool = false; } else if (!isEmail(email)) { document.getElementById("email_error").innerHTML = "חובה להזין כתובת דואר אלקטרוני חוקית"; isBool = false; } if (body == "") { document.getElementById("body_error").innerHTML = "חובה להזין תוכן הודעה"; document.getElementById("body_error").style.display = ""; isBool = false; } return isBool; } function setHome() { document.body.style.behavior='url(#default#homepage)'; document.body.setHomePage('http://www.kefpo.co.il'); } function clearValue(obj, s) { if (obj.value == s) obj.value = ''; } function setValue(obj, s) { if (obj.value == '') obj.value = s; } function changeBox(focus) { focus = typeof(focus) != 'undefined' ? focus : true; document.getElementById('fakepass').style.display='none'; document.getElementById('pass').style.display=''; if (focus) document.getElementById('pass').focus(); } function restoreBox() { if(document.getElementById('pass').value=='') { document.getElementById('fakepass').style.display=''; document.getElementById('pass').style.display='none'; } } function loadPage() { if(document.getElementById('pass').value!='') { changeBox(false); } } function isPasswordChanged() { if(document.getElementById('pass').value!='') { changeBox(false); } } function doLogin() { $.post("/ajax.php", { func: "login", username: $("#user").val(), password: $("#pass").val() }, function(data){ var status = data; if(status == "ok") { $("#playerName").html($("#user").val()); $("#loginForm").hide(); $("#lost").hide(); $("#loginMessage").show(); window.location.reload(); } else { alert('הפרטים לא נכונים'); } return false; }, "text"); }