/** * Object PHP_Serializer * JavaScript to PHP serialize / unserialize class. * This class is designed to convert php variables to javascript * and javascript variables to php with a php serialize unserialize * compatible way. * * PARSABLE PHP TO JAVASCRIPT VARIABLES: * [ PHP TYPE ] [ JAVASCRIPT TYPE ] * array Array * class Object (*) * string String * boolean Boolean * undefined or null null * integer / double Number * * PARSABLE JAVASCRIPT TO PHP VARIABLES: * [ JAVASCRIPT TYPE ] [ PHP TYPE ] * Array array * Object class (*) * String string * Boolean boolean * null null * Number int or double * Date class * Error class * Function anything (*) * __class anything (*) * * (*) NOTE: * Any PHP serialized class requires the native PHP class to be used, then it's not a * PHP => JavaScript converter, it's just a usefull serilizer class for each * compatible JS and PHP variable types. * However is possible to change public parameters. * Lambda, Resources or other dedicated PHP variables are not usefull for JavaScript. * (i.e. * $v = create_function('', 'return 1;'); serialize($v); * $conn = mydb_connect(); serialize($conn); * ) * There are same restrictions for javascript functions too then these will not be sent * (but will be filtered / ignored automatically). * _____________________________________________ * * EXAMPLE: * var php = new PHP_Serializer(); * alert(php.unserialize(php.serialize(somevar))); * // should alert the original value of somevar * --------------------------------------------- * @author Andrea Giammarchi * @site www.devpro.it * @date 2005/11/26 * @lastmod 2005/12/07 14:30 [fixed deer Park serialize problem] * @credits Special thanks to Fabio Sutto for some ideas and some debug * Special thanks to kentaromiura for a faster loop idea while unserialize * @version 1.5d, tested on FireFox 1.0.7, FireFox 1.5, IE 6 SP2 and Opera 8 */ function PHP_Serializer() { if(String(Object).indexOf('(') != 16) this.__cut = 9; else this.__cut = 10; } function PHP_Serializer__String(__s) { return ('s:'+__s.length+':"'+__s+'";'); } function PHP_UnSerializer__String() { var sls = this.__s.substr(2,(this.__s.indexOf(':',2)-2)); var sli = parseInt(sls); sls = sls.length + 4; var tmp = this.__s.substr(sls,sli); this.reduce((sli + sls + 2)); return tmp; } function PHP_Serializer__Boolean(__s) { return ('b:'+(__s==false?'0':'1')+';'); } function PHP_UnSerializer__Boolean() { var tmp = (this.__s.substr(2,1)=='1'?true:false); this.reduce(4); return tmp; } function PHP_Serializer__Number(__s) { __s = String(__s); return ((__s.indexOf('.')==-1)?'i:'+__s+';':'d:'+__s+';'); } function PHP_UnSerializer__Number() { var sli = this.__s.indexOf(';',1) - 2; var tmp = Number(this.__s.substr(2,sli)); this.reduce((sli + 3)); return tmp; } function PHP_Serializer__Function() { return ''; } function PHP_Serializer__Undefined() { return 'N;'; } function PHP_UnSerializer__Undefined() { this.reduce(2); return null; } function PHP_Serializer__Common_ArrayObject(__s) { var n; var a = 0; var ser = ''; for(var b in __s) { n = (__s[b] == null); if(n || (__s[b].constructor != Function && b != '__class')) { ser+=(!isNaN(b))?this.__number(b):this.__string(b); ser+=n?this.__undefined():this[__s[b].constructor](__s[b]); ++a; } } return [a,ser]; } function PHP_UnSerializer__Common_ArrayObject(tmp) { var l; var key; var a = this.__s.indexOf(':',2); var k = parseInt(this.__s.substr(2,(a-2))); this.reduce((a+2)); if(k!=0) { do { key = this[this.__s.substr(0,1)](); l = this.__s.substr(0,1); tmp[key] = this[l](); }while(--k); } return tmp; } function PHP_Serializer__Object(__s) { var o = String(__s.constructor); var oname = o.substr(this.__cut,o.indexOf('(')-this.__cut); var ser = this.__common_array_object(__s); return ('O:'+oname.length+':"'+oname+'":'+ser[0]+':{'+ser[1]+'}'); } function PHP_UnSerializer__Object() { var tmp = 's'+this.__s.substr(1,(this.__s.indexOf(':',4)-1))+';'; var a = tmp.substr(2,(tmp.indexOf(':',2)-2)); this.reduce(tmp.length-2); var o = tmp.substr((a.length+4),parseInt(a)); if(eval("typeof("+o+") == 'undefined'")) eval('function '+o+'(){}'); tmp = 'tmp = this.__common(new '+o+'());'; eval(tmp); this.reduce(1); return tmp; } function PHP_Serializer__Array(__s) { var ser = this.__common_array_object(__s); return ('a:'+ser[0]+':{'+ser[1]+'}'); } function PHP_UnSerializer__Array() { var tmp = this.__common(new Array()); this.reduce(1); return tmp; } function PHP_Serializer__serialize(what) { if(what==null) var ser = this.__undefined(); else if(!this[what.constructor]) var ser = this[Object](what); else var ser = this[what.constructor](what); return ser; } function PHP_UnSerializer__Reducer(l) { this.__s = this.__s.substr(l,(this.__s.length-l)); } function PHP_UnSerializer__unserialize(what) { this.__s = what; delete what; return this[this.__s.substr(0,1)](); } PHP_Serializer.prototype[Boolean] = PHP_Serializer__Boolean; PHP_Serializer.prototype[Number] = PHP_Serializer.prototype.__number = PHP_Serializer__Number; PHP_Serializer.prototype[String] = PHP_Serializer.prototype.__string = PHP_Serializer__String; PHP_Serializer.prototype[Function] = PHP_Serializer__Function; PHP_Serializer.prototype[Date] = PHP_Serializer.prototype[Error] = PHP_Serializer.prototype[Object] = PHP_Serializer__Object; PHP_Serializer.prototype[Array] = PHP_Serializer__Array; PHP_Serializer.prototype.__common_array_object = PHP_Serializer__Common_ArrayObject; PHP_Serializer.prototype.__undefined = PHP_Serializer__Undefined; PHP_Serializer.prototype.serialize = PHP_Serializer__serialize; PHP_Serializer.prototype.reduce = PHP_UnSerializer__Reducer; PHP_Serializer.prototype.s = PHP_UnSerializer__String; PHP_Serializer.prototype.b = PHP_UnSerializer__Boolean; PHP_Serializer.prototype.i = PHP_Serializer.prototype.d = PHP_UnSerializer__Number; PHP_Serializer.prototype.N = PHP_UnSerializer__Undefined; PHP_Serializer.prototype.__common = PHP_UnSerializer__Common_ArrayObject; PHP_Serializer.prototype.O = PHP_UnSerializer__Object; PHP_Serializer.prototype.a = PHP_UnSerializer__Array; PHP_Serializer.prototype.unserialize = PHP_UnSerializer__unserialize; function get_element(element_id){ if (document.getElementById){ return document.getElementById(element_id); } else if (document.all){ return document.all[element_id]; } else if (document.layers){ return document.layers[element_id]; } else { return false; } } function innerHTML(element_id,content,do_not_alert){ if(get_element(element_id)){ get_element(element_id).innerHTML = content return true; } else { if(!do_not_alert){ alert ("Can't find element id "+element_id+" to write content: "+content) } return false; } } function ADDinnerHTML(element_id,content){ if(get_element(element_id)){ get_element(element_id).innerHTML += content; return true; } else { alert ("Can't find element id "+element_id+" to write content: "+content) return false; } } function ADDRinnerHTML(element_id,content){ if(get_element(element_id)){ get_element(element_id).innerHTML = content + get_element(element_id).innerHTML; return true; } else { alert ("Can't find element id "+element_id+" to write content: "+content) return false; } } function hide_reveal(hide, reveal){ var targetElement; for(var i=0;i maxlimit){ field.value = field.value.substring(0, maxlimit); } r = maxlimit - field.value.length; } if(get_element(count_inner)){ innerHTML(count_inner,r); } } function trim(inputString) { if (typeof inputString != "string") { return inputString; } var retValue = inputString; var ch = retValue.substring(0, 1); while (ch == " " || ch.charCodeAt(0)==10) { retValue = retValue.substring(1, retValue.length); ch = retValue.substring(0, 1); } ch = retValue.substring(retValue.length-1, retValue.length); while (ch == " " || ch.charCodeAt(0)==10) { retValue = retValue.substring(0, retValue.length-1); ch = retValue.substring(retValue.length-1, retValue.length); } while (retValue.indexOf(" ") != -1) { retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ")+1, retValue.length); } return retValue; } function set_select_box_value(select_box, what){ for (var i = 0; i < select_box.options.length;i++){ select_box.options[i].selected = (select_box.options[i].value == what)?true:false; } } function validateTime(field){ var keycode; if (window.event) keycode = window.event.keyCode; else if (e) keycode = e.which; else alert("no event") if (keycode == 8){ if (field.value.length == 2){ field.value = field.value.substring(0,1); } } var valid = "0123456789:" var temp; for (var i=0; i 2){ field.value = "0" + field.value } } if (field.value.length == 2){ field.value = field.value + ":" if (field.value.substring(0,2) > 23){ field.value = ""; } } if (field.value.length == 5){ if (field.value.substring(3,5) > 60){ field.value = field.value.substring(0,3); } } if (field.value.length > 5){ field.value = field.value.substring(0,5); } if (field.value.substring((field.value.length) -1, (field.value.length)+1)== ":"){ temp = "" + field.value.substring(0, (field.value.length)-1); if (temp.indexOf(":") != "-1") { field.value = field.value.substring(0, (field.value.length) -1); } } } function checkTime(that){ var time_to_check = that.value; vlIsValid = /^([01]?[0-9]|[2][0-3])(:[0-5][0-9])?$/.test(time_to_check); if (!vlIsValid){ alert("ERROR!\nTime MUST be between 00:00 and 23:59\n"); that.focus(); that.select(); return false; } return true; } /** * Deside in what language the value is written * */ function string_gl(value){ //alert(value); var el = value.match(/([αβγδεζηθικλμνξοπρσςτυφχψωάόέίήύώΐϊϋΰ])/ig); el=(el==null)?new Array():el; var ru = value.match(/([абвгдеёжзийклмнопрстуфхцчшщъыьэюя])/ig); ru=(ru==null)?new Array():ru; var en = value.match(/([a-z])/ig); en=(en==null)?new Array():en; return (el.length>ru.length && el.length>en.length)?"el":((ru.length>el.length && ru.length>en.length)?"ru":"en"); } function getElementPosition_old(elemID) { var offsetTrail = get_element(elemID);//document.all(elemID); var offsetLeft = 0; var offsetTop = 0; while (offsetTrail) { offsetLeft += offsetTrail.offsetLeft; offsetTop += offsetTrail.offsetTop; offsetTrail = offsetTrail.offsetParent; } if(navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined"){ offsetLeft += document.body.leftMargin; offsetTop += document.body.topMargin; } // alert(offsetLeft+" "+offsetTop); return {left:offsetLeft, top:offsetTop}; } function getElementPosition_xywh(elemID) { var a = getElementPosition(elemID); return {x:a.left,y:a.top,w:a.width,h:a.height}; } function getElementPosition(elemID) { var offsetTrail = get_element(elemID);//document.all(elemID); if(offsetTrail!=false){ var tmp = getElementPosition_new(offsetTrail) return {left:tmp.x, top:tmp.y, width:tmp.width,height:tmp.height}; } else { return {left:0, top:0, width:0,height:0}; } } function getElementPosition_new(element) { var result = new Object(); result.x = 0; result.y = 0; result.width = 0; result.height = 0; if(element){ if (element.offsetParent) { result.x = element.offsetLeft; result.y = element.offsetTop; var parent = element.offsetParent; // alert("x:"+result.x+" y:"+result.y+" parent:"+parent.id); while (parent) { result.x += parent.offsetLeft; result.y += parent.offsetTop; var parentTagName = parent.tagName.toLowerCase(); if (parentTagName != "table" && parentTagName != "body" && parentTagName != "html" && parentTagName != "div" && parent.clientTop && parent.clientLeft) { result.x += parent.clientLeft; result.y += parent.clientTop; } // alert("x:"+result.x+" y:"+result.y+" parent:"+parent.id); parent = parent.offsetParent; } } else if (element.left && element.top) { result.x = element.left; result.y = element.top; } else { if (element.x) { result.x = element.x; } if (element.y) { result.y = element.y; } } if (element.offsetWidth && element.offsetHeight) { result.width = element.offsetWidth; result.height = element.offsetHeight; } else if (element.style && element.style.pixelWidth && element.style.pixelHeight) { result.width = element.style.pixelWidth; result.height = element.style.pixelHeight; } } return result; } function hide(srcElementId){ var srcElement; if(srcElement = get_element(srcElementId)){ srcElement.style.display = "none"; } } function show(srcElementId,left,top){ var element_to_reveal; if(element_to_reveal = get_element(srcElementId)){ if(left){ element_to_reveal.style.left = left +"px"; } if(top){ element_to_reveal.style.top = top + "px"; } element_to_reveal.style.display = ""; } } function check_radio_box(radio_box,what){ for (var i = 0; i < radio_box.length;i++){ if(radio_box[i].value == what){ radio_box[i].checked = true; break; } } } // this function returns an element of content array for the fill_select_box function function new_content(id,text,color){ var toret = new Array(); toret["id"]=id; toret["text"]=text; toret["color"]=color; return toret; } function fill_select_box(select_box, content, chosen, use_color, zero_length){ var selected = false; if(typeof(select_box)=="undefined"){ alert("Undefined select_box"); return false; } if(zero_length==0){ select_box.options.length=0; for( var i in content ){ selected = (content[i]['id']==chosen)?true:false; var option = document.createElement("OPTION"); option.value = content[i]['id']; option.text = content[i]['text']; option.selected = selected; select_box.options[select_box.options.length]= option; if(use_color && content[i]['color']){ select_box.options[(select_box.options.length-1)].style.backgroundColor='#DE4A4C'; } else { select_box.options[(select_box.options.length - 1)].style.backgroundColor=''; } } } else { for(var i=0;i0)){ select_box.options[i].style.backgroundColor='#DE4A4C'; } else { select_box.options[i].style.backgroundColor=''; } } } for(var i = 0; i =min && x<=max){ return true; } } return false; } var alphabet=new Array(); alphabet[0] = new RegExp("[αάa]","i"); alphabet[1] = new RegExp("[βbv]","i"); alphabet[2] = new RegExp("[γg]","i"); alphabet[3] = new RegExp("[δd]","i"); alphabet[4] = new RegExp("[εέe]","i"); alphabet[5] = new RegExp("[ζz]","i"); alphabet[6] = new RegExp("[ιίηήυύiy]","i"); alphabet[7] = new RegExp("[θ]","i"); alphabet[8] = new RegExp("[κk]","i"); alphabet[9] = new RegExp("[λl]","i"); alphabet[10] = new RegExp("[μm]","i"); alphabet[11] = new RegExp("[νn]","i"); alphabet[12] = new RegExp("[ξ]","i"); alphabet[13] = new RegExp("[οόωώo]","i"); alphabet[14] = new RegExp("[πp]","i"); alphabet[15] = new RegExp("[ρr]","i"); alphabet[16] = new RegExp("[σςs]","i"); alphabet[17] = new RegExp("[τt]","i"); alphabet[18] = new RegExp("[φf]","i"); alphabet[19] = new RegExp("[χxh]","i"); alphabet[20] = new RegExp("[ψ]","i"); function make_pattern(text){ var text1=''; for(var i=0; i0){ text = '^'+make_pattern(text); //alert(text); re = new RegExp(text,'i'); for(var i = 0; i ]*?>.*?<\/script>/gi,""); text = text.replace(/]*?>.*?<\/style>/gi,""); text = text.replace(/
/gi,"\n"); text = text.replace(/<[\/\!]*?[^<>]*?>/gi,""); text = text.replace(/([\r\n])[\s]+/gi," "); text = text.replace(/&(quot|#34);/gi,"\""); text = text.replace(/&(amp|#38);/gi,"&"); text = text.replace(/&(lt|#60);/gi,"<"); text = text.replace(/&(gt|#62);/gi,">"); text = text.replace(/&(nbsp|#160);/gi," "); text = text.replace(/&#(\d+);/gi,""); return text; } function make_http_link(text){ text = text.replace(/(http:\/\/[a-z0-9._=&?\-\/]*)/gi,"link"); return text; } function safe_text(text){ var regex = /[^0-9a-zA-ZΑΆΒΓΔΕΈΖΗΉΘΙΊΪΚΛΜΝΞΟΌΠΡΣΤΥΫΦΧΨΩΏαάβγδεέζηήθιίϊΐκλμνξοόπρσςτυύϋΰφχψωώ@\[\]{-}'\" \-_\/,.;:=\n!@#$^&*()|<>]/g; // var regex = /[() -]+/g; return text.replace(regex, ""); } function esc(text){ // var regex = /[^0-9a-zA-Z@\[\]{-}'\" \-_\/,.;:=\n!@#$^&*()|<>]/g; // var regex = /[() -]+/g; // return text.replace(regex, ""); return text; } function make_name(name){ var regex = /[.\[\]]+/g; return name.replace(regex,"_"); } function nl2br(text){ var regex = /[\n\r]/g; return text.replace(regex,"
"); } var e = window.encodeURIComponent ? encodeURIComponent : escape; var d = window.decodeURIComponent ? decodeURIComponent : unescape; var my_objects = new Array(); function mouseCoords(ev){ if(ev.pageX || ev.pageY){ return {x:ev.pageX, y:ev.pageY}; } return { x:ev.clientX + document.body.scrollLeft - document.body.clientLeft, y:ev.clientY + document.body.scrollTop - document.body.clientTop }; } document.onmousemove = mouseMove; //document.onmouseup = mouseUp; var popupWindowOldEventListener1 = document.onmouseup; if (window.popupWindowOldEventListener1 != null) { //alert("there is old listener 1"); document.onmouseup = function(e){ //alert("on mouse up 1"); popupWindowOldEventListener1(e); mouseUp(e); } } else { // alert("there is NO old listener 1"); document.onmouseup = mouseUp; } var dragObject = null; var mouseOffset = null; function getMouseOffset(target, ev){ ev = ev || window.event; var docPos = getPosition(target); var mousePos = mouseCoords(ev); return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y}; } function getPosition(e){ var left = 0; var top = 0; while (e.offsetParent){ left += e.offsetLeft; top += e.offsetTop; e = e.offsetParent; } left += e.offsetLeft; top += e.offsetTop; return {x:left, y:top}; } function mouseMove(ev){ if(dragObject){ ev = ev || window.event; var mousePos = mouseCoords(ev); dragObject.style.position = 'absolute'; dragObject.style.top = mousePos.y - mouseOffset.y; dragObject.style.left = mousePos.x - mouseOffset.x; if(dragObject && dragObject.otec){ dragObject.otec.mouse_move(mousePos,mouseOffset); } return false; } } function mouseUp(ev){ //alert("mouse UP"); if(dragObject && dragObject.otec){ ev = ev || window.event; var mousePos = mouseCoords(ev); dragObject.otec.mouse_release(mousePos, mouseOffset); } dragObject = null; mouseOffset = null; } /** * Makes the item draggable, wile if parent is set then wile mouse move prent.mouse_move is fired * and when the mouse is Up the parent.mouse_release method is run * */ function makeDraggable(item,parent){ if(!item) return; if(typeof(parent)=="object"){ item.otec = parent; } item.onmousedown = function(ev){ dragObject = this; if(typeof(this.otec)=="object"){ dragObject.otec = this.otec; dragObject.otec.original_position = getPosition(this); } mouseOffset = getMouseOffset(this, ev); return false; } item.onmouseup = mouseUp; } /** * this function make parent element draggable and its drag is cotroled by item element */ function makeDraggableParent(item,parent){ if(!item) return; if(typeof(parent)=="object"){ item.otec = parent; } item.onmousedown = function(ev){ if(typeof(this.otec)=="object"){ dragObject = this.otec; } else { dragObject = this; } mouseOffset = getMouseOffset(this, ev); return false; } item.onmouseup = mouseUp; } function getWindowSize() { var myWidth = 0, myHeight = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; } return {x: myWidth, y: myHeight}; } function getScrollXY() { var scrOfX = 0, scrOfY = 0; if( typeof( window.pageYOffset ) == 'number' ) { //Netscape compliant scrOfY = window.pageYOffset; scrOfX = window.pageXOffset; } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { //DOM compliant scrOfY = document.body.scrollTop; scrOfX = document.body.scrollLeft; } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { //IE6 standards compliant mode scrOfY = document.documentElement.scrollTop; scrOfX = document.documentElement.scrollLeft; } return {x: scrOfX, y: scrOfY}; } function Info(name){ if (!this.listenerAttached) { this.listenerAttached = true; my_objects[my_objects.length] = this; } this.name = name; this.inner = make_name(this.name)+"_inner"; this.show = info_show; this.draw = info_draw; this.hide = info_hide; } function info_show(that_id,tekst){ if(innerHTML(this.inner,this.draw(tekst))){ var p = getElementPosition(that_id); var b = getWindowSize(); var o = getScrollXY(); var left = p.left+p.width-5; left = ((b.x-(left+220))>10)?((left<0)?1:left):b.x-220; var top = p.top-15; //show(this.inner,(p.left+p.width),p.top); show(this.inner,left,top); } } function info_draw(tekst){ var t = ""; t += "
"+tekst+"
"; return t; } function info_hide(e){ var is_clicked_inside = false; var p = getElementPosition(this.inner); var c = mouseCoords(e); var offset = 10 is_clicked_inside = ((c.x > p.left-offset) && (c.x < p.left+p.width+offset) && (c.y > p.top-offset) && (c.y < p.top+p.height+offset))?true:false; if(!is_clicked_inside){ hide(this.inner) } } function draw_analized_object(obj){ var toret = ""; toret += "" if(typeof(obj)=="object"){ for(var property in obj){ toret += ""; toret += ""; toret += ""; if(typeof(obj[property])=="object"){ toret += ""; } else if(typeof(obj[property])!="function"){ toret += ""; } else { toret += ""; } toret += ""; } } else { toret += ""; } toret += "
"+property+""+typeof(obj[property])+""+draw_analized_object(obj[property])+""+(obj[property])+"
Not object
"; return toret; } //This method will allow you to insert an element anywhere within an array bounds. function insertAt( index, value ){ var part1 = this.slice( 0, index ); var part2 = this.slice( index ); part1.push( value ); return( part1.concat( part2 ) ); } //Array.prototype.insertAt = insertAt; function removeAt( index ){ var part1 = this.slice( 0, index ); var part2 = this.slice( index ); part1.pop(); return( part1.concat( part2 ) ); } //Array.prototype.removeAt = removeAt; function _highlightClose(that){ if(that.src.indexOf('over')>=0){ that.src = 'images/close.gif'; }else{ that.src = 'images/close_over.gif'; } } function _highlightAddNewDown(that){ if(that.src.indexOf('over')>=0){ that.src = 'images/addnewdown_a.gif'; }else{ that.src = 'images/addnewdown_b.gif'; } } function _highlightAddNewRight(that){ if(that.src.indexOf('over')>=0){ that.src = 'images/addnewright_b.gif'; }else{ that.src = 'images/addnewright_a.gif'; } } function main_draw_paging(){ var table=""; if(typeof(this.count)!="undefined" && typeof(this.limit1)!="undefined" && typeof(this.limit2)!="undefined" && this.count>0){ table += " "; table += " "; if(this.limit1<=0){ this.limit1=0; table += " "; } else { table += " "; } table += " "; if((this.limit1+this.limit2)>=this.count){ table += " "; } else { table += " "; } table += " "; table += "
«("+(this.limit1+1)+"-"+(this.limit1+this.limit2)+")/"+this.count+"»
"; } return table; } var MONTH_NAMES=new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); var DAY_NAMES=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat'); var DAY_NAMES=new Array('Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο','Sun','Mon','Tue','Wed','Thu','Fri','Sat'); function LZ(x) {return(x<0||x>9?"":"0")+x} // ------------------------------------------------------------------ // formatDate (date_object, format) // Returns a date in the output format specified. // The format string uses the same abbreviations as in getDateFromFormat() // ------------------------------------------------------------------ function formatDate(date,format) { format=format+""; var result=""; var i_format=0; var c=""; var token=""; var y=date.getYear()+""; var M=date.getMonth()+1; var d=date.getDate(); var E=date.getDay(); var H=date.getHours(); var m=date.getMinutes(); var s=date.getSeconds(); var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k; // Convert real date parts into formatted versions var value=new Object(); if (y.length < 4) {y=""+(y-0+1900);} value["y"]=""+y; value["yyyy"]=y; value["yy"]=y.substring(2,4); value["M"]=M; value["MM"]=LZ(M); value["MMM"]=MONTH_NAMES[M-1]; value["NNN"]=MONTH_NAMES[M+11]; value["d"]=d; value["dd"]=LZ(d); value["E"]=DAY_NAMES[E+7]; value["EE"]=DAY_NAMES[E]; value["H"]=H; value["HH"]=LZ(H); if (H==0){value["h"]=12;} else if (H>12){value["h"]=H-12;} else {value["h"]=H;} value["hh"]=LZ(value["h"]); if (H>11){value["K"]=H-12;} else {value["K"]=H;} value["k"]=H+1; value["KK"]=LZ(value["K"]); value["kk"]=LZ(value["k"]); if (H > 11) { value["a"]="PM"; } else { value["a"]="AM"; } value["m"]=m; value["mm"]=LZ(m); value["s"]=s; value["ss"]=LZ(s); while (i_format < format.length) { c=format.charAt(i_format); token=""; while ((format.charAt(i_format)==c) && (i_format < format.length)) { token += format.charAt(i_format++); } if (value[token] != null) { result=result + value[token]; } else { result=result + token; } } return result; } // ------------------------------------------------------------------ // Utility functions for parsing in getDateFromFormat() // ------------------------------------------------------------------ function _isInteger(val) { var digits="1234567890"; for (var i=0; i < val.length; i++) { if (digits.indexOf(val.charAt(i))==-1) { return false; } } return true; } function _getInt(str,i,minlength,maxlength) { for (var x=maxlength; x>=minlength; x--) { var token=str.substring(i,i+x); if (token.length < minlength) { return null; } if (_isInteger(token)) { return token; } } return null; } // ------------------------------------------------------------------ // getDateFromFormat( date_string , format_string ) // // This function takes a date string and a format string. It matches // If the date string matches the format string, it returns the // getTime() of the date. If it does not match, it returns 0. // ------------------------------------------------------------------ function getDateFromFormat(val,format) { val=val+""; format=format+""; var i_val=0; var i_format=0; var c=""; var token=""; var token2=""; var x,y; var now=new Date(); var year=now.getYear(); var month=now.getMonth()+1; var date=1; var hh=now.getHours(); var mm=now.getMinutes(); var ss=now.getSeconds(); var ampm=""; while (i_format < format.length) { // Get next token from format string c=format.charAt(i_format); token=""; while ((format.charAt(i_format)==c) && (i_format < format.length)) { token += format.charAt(i_format++); } // Extract contents of value based on format token if (token=="yyyy" || token=="yy" || token=="y") { if (token=="yyyy") { x=4;y=4; } if (token=="yy") { x=2;y=2; } if (token=="y") { x=2;y=4; } year=_getInt(val,i_val,x,y); if (year==null) { return 0; } i_val += year.length; if (year.length==2) { if (year > 70) { year=1900+(year-0); } else { year=2000+(year-0); } } } else if (token=="MMM"||token=="NNN"){ month=0; for (var i=0; i11)) { month=i+1; if (month>12) { month -= 12; } i_val += month_name.length; break; } } } if ((month < 1)||(month>12)){return 0;} } else if (token=="EE"||token=="E"){ for (var i=0; i12)){return 0;} i_val+=month.length;} else if (token=="dd"||token=="d") { date=_getInt(val,i_val,token.length,2); if(date==null||(date<1)||(date>31)){return 0;} i_val+=date.length;} else if (token=="hh"||token=="h") { hh=_getInt(val,i_val,token.length,2); if(hh==null||(hh<1)||(hh>12)){return 0;} i_val+=hh.length;} else if (token=="HH"||token=="H") { hh=_getInt(val,i_val,token.length,2); if(hh==null||(hh<0)||(hh>23)){return 0;} i_val+=hh.length;} else if (token=="KK"||token=="K") { hh=_getInt(val,i_val,token.length,2); if(hh==null||(hh<0)||(hh>11)){return 0;} i_val+=hh.length;} else if (token=="kk"||token=="k") { hh=_getInt(val,i_val,token.length,2); if(hh==null||(hh<1)||(hh>24)){return 0;} i_val+=hh.length;hh--;} else if (token=="mm"||token=="m") { mm=_getInt(val,i_val,token.length,2); if(mm==null||(mm<0)||(mm>59)){return 0;} i_val+=mm.length;} else if (token=="ss"||token=="s") { ss=_getInt(val,i_val,token.length,2); if(ss==null||(ss<0)||(ss>59)){return 0;} i_val+=ss.length;} else if (token=="a") { if (val.substring(i_val,i_val+2).toLowerCase()=="am") {ampm="AM";} else if (val.substring(i_val,i_val+2).toLowerCase()=="pm") {ampm="PM";} else {return 0;} i_val+=2;} else { if (val.substring(i_val,i_val+token.length)!=token) {return 0;} else {i_val+=token.length;} } } // If there are any trailing characters left in the value, it doesn't match if (i_val != val.length) { return 0; } // Is date valid for month? if (month==2) { // Check for leap year if ( ( (year%4==0)&&(year%100 != 0) ) || (year%400==0) ) { // leap year if (date > 29){ return 0; } } else { if (date > 28) { return 0; } } } if ((month==4)||(month==6)||(month==9)||(month==11)) { if (date > 30) { return 0; } } // Correct hours value if (hh<12 && ampm=="PM") { hh=hh-0+12; } else if (hh>11 && ampm=="AM") { hh-=12; } var newdate=new Date(year,month-1,date,hh,mm,ss); return newdate.getTime(); } function is_enter(e){ var keycode; if (window.event) keycode = window.event.keyCode; else if (e) keycode = e.which; else return false; if(keycode==13){ return true; } return false; } function submitenter(myfield,e) { if (is_enter(e)){ myfield.form.submit(); return false; } else return true; } function count(ar){ var r = -1; if(ar && typeof(ar)=="object"){ r=0; for(var i in ar){r++;} } return r; } function get_link(id,gl,name,type,limit1){ var r = type+id+gl+((limit1)?limit1:"")+"_"+strip_html(translate_el_en(name)).replace(/[() -]+/g,"").toLowerCase()+".html"; return r; } function get_img_link(id,w,h){ var r = "http://img1.mixgrill.gr/imgs/img"+id+((w)?"_"+w+((h)?"_"+h:""):"")+".jpg"; return r; } function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function eraseCookie(name) { createCookie(name,"",-1); } var isIE = navigator.appName.toLowerCase().indexOf('internet explorer')+1; var isMac = navigator.appVersion.toLowerCase().indexOf('mac')+1; function SoundManager(container) { // DHTML-controlled sound via Flash var self = this; this.movies = []; // movie references this.container = container; this.unsupported = 0; // assumed to be supported this.defaultName = 'default'; // default movie this.FlashObject = function(url) { var me = this; this.o = null; this.loaded = false; this.isLoaded = function() { if (me.loaded) return true; if (!me.o) return false; me.loaded = ((typeof(me.o.readyState)!='undefined' && me.o.readyState == 4) || (typeof(me.o.PercentLoaded)!='undefined' && me.o.PercentLoaded() == 100)); return me.loaded; } this.mC = document.createElement('div'); this.mC.className = 'movieContainer'; with (this.mC.style) { // "hide" flash movie position = 'absolute'; left = '-256px'; width = '64px'; height = '64px'; } var html = ['','']; if (navigator.appName.toLowerCase().indexOf('microsoft')+1) { this.mC.innerHTML = html[0]; this.o = this.mC.getElementsByTagName('object')[0]; } else { this.mC.innerHTML = html[1]; this.o = this.mC.getElementsByTagName('embed')[0]; } document.getElementsByTagName('div')[0].appendChild(this.mC); } this.addMovie = function(movieName,url) { self.movies[movieName] = new self.FlashObject(url); } this.checkMovie = function(movieName) { movieName = movieName||self.defaultName; if (!self.movies[movieName]) { self.errorHandler('checkMovie','Exception: Could not find movie',arguments); return false; } else { return (self.movies[movieName].isLoaded())?self.movies[movieName]:false; } } this.errorHandler = function(methodName,message,oArguments,e) { writeDebug('
soundManager.'+methodName+'('+self.getArgs(oArguments)+'): '+message+(e?' ('+e.name+' - '+(e.message||e.description||'no description'):'')+'.'+(e?')':'')+'
'); } this.play = function(soundID,loopCount,noDebug,movieName) { if (self.unsupported) return false; movie = self.checkMovie(movieName); if (!movie) return false; if (typeof(movie.o.TCallLabel)!='undefined') { try { self.setVariable(soundID,'loopCount',loopCount||1,movie); movie.o.TCallLabel('/'+soundID,'start'); if (!noDebug) writeDebug('soundManager.play('+self.getArgs(arguments)+')'); } catch(e) { self.errorHandler('play','Failed: Flash unsupported / undefined sound ID (check XML)',arguments,e); } } } this.stop = function(soundID,movieName) { if (self.unsupported) return false; movie = self.checkMovie(movieName); if (!movie) return false; try { movie.o.TCallLabel('/'+soundID,'stop'); writeDebug('soundManager.stop('+self.getArgs(arguments)+')'); } catch(e) { // Something blew up. Not supported? self.errorHandler('stop','Failed: Flash unsupported / undefined sound ID (check XML)',arguments,e); } } this.getArgs = function(params) { var x = params?params.length:0; if (!x) return ''; var result = ''; for (var i=0; i'); } } } var ods = new Array(); function kd(url,ld,ob,md,nd){ var found = false; var _i_ = 0; //current i for(var i in ods){ if(typeof(ods[i])=="object"){ if(ods[i].finished){ _i_ = i; ods[_i_].finished = false; found = true; break; } } } if(!found){ _i_ = ods.length; ods[_i_]=new Object(); ajax_debug("Adding objects to ods current_i (_i_):"+_i_); //var od; if(window.XMLHttpRequest){ ods[_i_].od=new XMLHttpRequest(); } else if(window.ActiveXObject){ try{ ods[_i_].od=new ActiveXObject("Msxml2.XMLHTTP"); } catch(e){ try{ ods[_i_].od=new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){} } } else{throw'Can not create XMLHTTP-instance';} try{ ods[_i_].od.i=_i_; } catch(e){} /* ods[_i_].od.onload = function(){ ajax_debug("od "+this.i+"; recieved " + this.responseText); try{ ld(this.responseText,ob); } catch(err){ ajax_debug("od "+this.i+"; Caught error " + err + ": Could not eval " + this.responseText ); } ods[this.i].finished = true; ajax_debug("od "+this.i+"; finished: "+ods[this.i].finished); } */ ods[_i_].od.onreadystatechange=function(){ if(this.readyState==4){ if(this.status==200 || this.status==206){ var pd=this.getResponseHeader('Content-Type'); pd=pd.substr(0,pd.indexOf(';')); try{ switch(pd){ case 'application/json': ajax_debug("od "+this.i+"; recieved " + this.responseText); ods[this.i].ld((this.responseText==''?null:eval('('+this.responseText+')')),ods[this.i].ob); break; case 'text/plain':case 'text/html': ajax_debug("od "+this.i+"; recieved " + this.responseText); ods[this.i].ld(this.responseText,ods[this.i].ob); break; default: ajax_debug("od "+this.i+"; Illegal content type " + pd); throw'Illegal content type'; } } catch(err){ ajax_debug("od "+this.i+"; Caught error " + err + ": Could not eval " + this.responseText ); } } else{ ajax_debug("od "+this.i+"; An error has occurred during request; status return: "+this.status); throw 'An error has occurred during request'; } ods[this.i].finished = true; ajax_debug("od "+this.i+"; finished: "+ods[this.i].finished); } else { ajax_debug("od "+this.i+"; still waiting... readyState="+this.readyState); } }; } url = "http://game.mixgrill.gr/"+url; if(md===undefined){ md='GET'; } ods[_i_].ld=ld; ods[_i_].ob=ob; ajax_debug("od "+_i_+"; uri = " + url + " / ld = " + ld); ods[_i_].od.open(md,url,true); if(md=='POST'){ ods[_i_].od.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=utf-8'); var qd=rd(nd); } else{ var qd=null; } ods[_i_].od.send(qd); ajax_debug("od "+_i_+"; waiting... "); } function rd(sd){ var td='';var ud=true; for(var vd in sd){ td+=(ud?'':'&')+vd+'='+window.encodeURI(sd[vd]); if(ud){ ud=false; } } return td; } // WebTicker by Mioplanet // www.mioplanet.com //TICKER_CONTENT = document.getElementById("TICKER").innerHTML; TICKER_CONTENT = ""; TICKER_RIGHTTOLEFT = false; TICKER_SPEED = 3; TICKER_STYLE = "font-family:Arial; font-size:12px;"; TICKER_PAUSED = false; //ticker_start(true); function ticker_start(trigger_tick) { var tickerSupported = false; TICKER_WIDTH = document.getElementById("TICKER").style.width; var img = ""; // Firefox if (navigator.userAgent.indexOf("Firefox")!=-1 || navigator.userAgent.indexOf("Safari")!=-1) { //document.getElementById("TICKER").innerHTML = "
"+img+" "+img+"
"; document.getElementById("TICKER").innerHTML = "
 
"; tickerSupported = true; } // IE if (navigator.userAgent.indexOf("MSIE")!=-1 && navigator.userAgent.indexOf("Opera")==-1) { //document.getElementById("TICKER").innerHTML = "
"+img+""+img+"
"; document.getElementById("TICKER").innerHTML = "
"; tickerSupported = true; } if(!tickerSupported) document.getElementById("TICKER").outerHTML = ""; else { document.getElementById("TICKER").scrollLeft = TICKER_RIGHTTOLEFT ? document.getElementById("TICKER").scrollWidth - document.getElementById("TICKER").offsetWidth : 0; document.getElementById("TICKER_BODY").innerHTML = TICKER_CONTENT; document.getElementById("TICKER").style.display="block"; document.getElementById("TICKER").style.overflow="hidden"; if(trigger_tick){ TICKER_tick(); } } } function TICKER_tick() { //alert('b'); if(!TICKER_PAUSED) document.getElementById("TICKER").scrollLeft += TICKER_SPEED * (TICKER_RIGHTTOLEFT ? -1 : 1); if(TICKER_RIGHTTOLEFT && document.getElementById("TICKER").scrollLeft <= 0) document.getElementById("TICKER").scrollLeft = document.getElementById("TICKER").scrollWidth - document.getElementById("TICKER").offsetWidth; if(!TICKER_RIGHTTOLEFT && document.getElementById("TICKER").scrollLeft >= document.getElementById("TICKER").scrollWidth - document.getElementById("TICKER").offsetWidth) document.getElementById("TICKER").scrollLeft = 0; window.setTimeout("TICKER_tick()", 40); } var images = new Array(); if (document.images){ images["mg_monomaxies_background"] = new Image(); images["mg_monomaxies_background"].src="images/in_game_"+this.gl+".jpg"; /* images["mg_monomaxies_logo_big_el"] = new Image(); images["mg_monomaxies_logo_big_el"].src="images/mg_monomaxies_logo_big_el.gif"; images["mg_monomaxies_logo_big_en"] = new Image(); images["mg_monomaxies_logo_big_en"].src="images/mg_monomaxies_logo_big_en.gif"; images["mg_monomaxies_logo_small_el"] = new Image(); images["mg_monomaxies_logo_small_el"].src="images/mg_monomaxies_logo_small_el.gif"; images["mg_monomaxies_logo_small_en"] = new Image(); images["mg_monomaxies_logo_small_en"].src="images/mg_monomaxies_logo_small_en.gif"; images["mg_clock_backround"] = new Image(); images["mg_clock_backround"].src="images/mg_clock_backround.gif"; images["mg_score_backgroung_a"] = new Image(); images["mg_score_backgroung_a"].src="images/mg_score_backgroung_a.gif"; images["mg_score_backgroung_b"] = new Image(); images["mg_score_backgroung_b"].src="images/mg_score_backgroung_b.gif"; images["mg_chat_dialog_backround"] = new Image(); images["mg_chat_dialog_backround"].src="images/mg_chat_dialog_backround.gif"; images["mg_chat_text_inpt"] = new Image(); images["mg_chat_text_inpt"].src="images/mg_chat_text_inpt.gif"; images["mg_chat_send_bttn"] = new Image(); images["mg_chat_send_bttn"].src="images/mg_chat_send_bttn.gif"; images["mg_diff_lvl_backround_a"] = new Image(); images["mg_diff_lvl_backround_a"].src="images/mg_diff_lvl_backround_a.gif"; images["mg_diff_lvl_backround_b"] = new Image(); images["mg_diff_lvl_backround_b"].src="images/mg_diff_lvl_backround_b.gif"; images["mg_bet_backround_a"] = new Image(); images["mg_bet_backround_a"].src="images/mg_bet_backround_a.gif"; images["mg_bet_backround_b"] = new Image(); images["mg_bet_backround_b"].src="images/mg_bet_backround_b.gif"; images["bttn"] = new Image(); images["bttn"].src="images/bttn.gif"; images["bttn_300"] = new Image(); images["bttn_300"].src="images/bttn_300.gif"; images["bttn_109"] = new Image(); images["bttn_109"].src="imabttn_109.gif"; images["bttn_170"] = new Image(); images["bttn_170"].src="images/bttn_170.gif"; */ images["loading"] = new Image(); images["loading"].src="images/loading.gif"; } //var a = new PHP_Serializer(); if(typeof(a)!="object"){ var a = new PHP_Serializer(); } var crrnt_dff_lvl = null; var crrnt_qstn = null; var crrnt_bttp = null; var crrnt_btvl = null; var crrnt_answr = null; var crrnt_ctgr = null; function Monomaxia(name, parent){ this.name = name; this.parent = parent; this.inner_container = make_name(this.name)+"_inner_container"; this.inner = make_name(this.name)+"_inner"; this.status_inner = make_name(this.name)+"_status_inner"; this.game_inner = make_name(this.name)+"_game_inner"; this.online_inner = make_name(this.name)+"_online_inner"; this.chat_inner = make_name(this.name)+"_chat_inner"; this.chat_dialog_transactions_inner = make_name(this.name)+"_chat_dialog_transactions_inner"; this.popup_inner = make_name(this.name)+"_popup_inner"; this.state_inner = make_name(this.name)+"_state_inner"; this.kategories_inner = make_name(this.name)+"_kategories_inner"; this.difficulty_level_inner = make_name(this.name)+"_difficulty_level_inner"; this.erwtiseis_inner = make_name(this.name)+"_erwtiseis_inner"; this.question_inner = make_name(this.name)+"_question_inner"; this.bet_inner = make_name(this.name)+"_bet_inner"; this.invitation_timer_inner = make_name(this.name)+"_invitation_timer_inner"; this.step1_timer_inner = make_name(this.name)+"_step1_timer_inner"; this.step2_timer_inner = make_name(this.name)+"_step2_timer_inner"; this.step3_timer_inner = make_name(this.name)+"_step3_timer_inner"; this.step4_timer_inner = make_name(this.name)+"_step4_timer_inner"; this.step5_timer_inner = make_name(this.name)+"_step5_timer_inner"; this.wait_inner = make_name(this.name)+"_wait_inner"; this.counter_inner = make_name(this.name)+"_counter_inner"; this.score_inner = make_name(this.name)+"_score_inner"; this.round_inner = make_name(this.name)+"_round_inner"; this.forma = make_name(this.name)+"_forma"; this.auth = new Auth_monomaxiews(this.name+".auth",this); this.auth.after_login = function(){this.parent.init();this.parent.show();setTimeout(this.name+".beacon()",60000);}; this.auth.show_for_monomaxies = function(){ if(this.parent.fb_iframe == ""){ style = "normal"; } else { style="none"; } //this.show() if(get_element(this.parent.inner)){ if(innerHTML(this.parent.inner,"
"+this.draw()+"
Για να παίξετε το παιχνίδι πρέπει να είστε μέλος του Mix Grill. Κάντε την εγγραφή πατώντας εδώ.
")){ show(this.parent.inner); } } }; this.gl = "el"; this.kategories = new Array(); this.kategories[116] = new Object(); this.kategories[116].id = 116; this.kategories[116].selected = true; this.kategories[116].onoma = new Array(); this.kategories[116].onoma["el"] = "Μουσικη - 60s, 70s"; this.kategories[116].onoma["en"] = "Music - 60s, 70s"; this.kategories[110] = new Object(); this.kategories[110].id = 110; this.kategories[110].selected = true; this.kategories[110].onoma = new Array(); this.kategories[110].onoma["el"] = "Μουσικη 80s"; this.kategories[110].onoma["en"] = "Music 80s"; this.kategories[111] = new Object(); this.kategories[111].id = 111; this.kategories[111].selected = true; this.kategories[111].onoma = new Array(); this.kategories[111].onoma["el"] = "Μουσικη 90s"; this.kategories[111].onoma["en"] = "Music 90s"; this.kategories[112] = new Object(); this.kategories[112].id = 112; this.kategories[112].selected = true; this.kategories[112].onoma = new Array(); this.kategories[112].onoma["el"] = "Μουσικη 00s, 10s"; this.kategories[112].onoma["en"] = "Music 00s, 10s"; this.kategories[118] = new Object(); this.kategories[118].id = 118; this.kategories[118].selected = true; this.kategories[118].onoma = new Array(); this.kategories[118].onoma["el"] = "Ελληνικη Μουσικη"; this.kategories[118].onoma["en"] = ""; this.kategories[113] = new Object(); this.kategories[113].id = 113; this.kategories[113].selected = true; this.kategories[113].onoma = new Array(); this.kategories[113].onoma["el"] = "Cinema - Θέατρο - Πολιτισμός - TV - Comics"; this.kategories[113].onoma["en"] = "Cinema - Theatre - Culture - TV - Comics"; this.kategories[115] = new Object(); this.kategories[115].id = 115; this.kategories[115].selected = true; this.kategories[115].onoma = new Array(); this.kategories[115].onoma["el"] = "Αθλητικα"; this.kategories[115].onoma["en"] = "Sports"; this.kategories[114] = new Object(); this.kategories[114].id = 114; this.kategories[114].selected = true; this.kategories[114].onoma = new Array(); this.kategories[114].onoma["el"] = "Γενικα (Ιστορια, Πολιτικη, Επιστημες, Γεωγραφία κ.α.)"; this.kategories[114].onoma["en"] = "General (History, Politics, Geography etc)"; /* this.kgs = new Katigories(this.name+".kgs",this); this.kgs.type = "erwtisi"; this.kgs.after_get = function(){ this.parent.kategories = new Array(); var tmp = this.get_liner_set(); for(var i in tmp){ this.parent.kategories[i] = new Object(); this.parent.kategories[i].id = i; this.parent.kategories[i].onoma = new Array(); this.parent.kategories[i].onoma["el"] = this.draw_by_id(i, "el",false); this.parent.kategories[i].onoma["en"] = this.draw_by_id(i, "en",false); this.parent.kategories[i].selected = true; } //this.parent.show(); this.parent.auth.login(); } */ //this.gm_id = ; this.online = new Object(); this.online.name = this.name+".online"; this.online.parent = this; this.online.set = new Array(); this.online.count = 0; this.online.limit1 = 0; this.online.limit2 = 10; this.online.draw_paging = main_draw_paging; this._last_get_anakoinwseis = 0; //methods this.A_xr = function(value){ if(value!=null && typeof(value)!="undefined"){ this._A_xr = value; this.show_debug_info(); } return (this._A_xr!=null && typeof(this._A_xr)!="undefined")?this._A_xr:""; } this.A_xr_gl = function(value){ if(value!=null && typeof(value)!="undefined"){ if(value=="" || value=="el" || value=="en"){ this._A_xr_gl = value; } this.show_debug_info(); } return (this._A_xr_gl!=null && typeof(this._A_xr_gl)!="undefined")?this._A_xr_gl:this.gl; } this.B_xr = function(value){ if(value!=null && typeof(value)!="undefined"){ this._B_xr = value; this.show_debug_info(); } return (this._B_xr!=null && typeof(this._B_xr)!="undefined")?this._B_xr:""; } this.B_xr_gl = function(value){ if(value!=null && typeof(value)!="undefined"){ if(value=="" || value=="el" || value=="en"){ this._B_xr_gl = value; } this.show_debug_info(); } return (this._B_xr_gl!=null && typeof(this._B_xr_gl)!="undefined")?this._B_xr_gl:this.gl; } this.gm_id = function(value){ if(value!=null && typeof(value)!="undefined"){ var prev = this.gm_id(); this._gm_id = value; this.show_debug_info(); if(prev!=this.gm_id()){this.get_anakoinwseis();} } return (this._gm_id!=null && typeof(this._gm_id)!="undefined")?parseInt(this._gm_id):-1; } this.gm = function(value){ if(value!=null && typeof(value)!="undefined"){ this._gm = value; } var pattern=/^([a-zA-Z0-9_.-])+'%40'([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/; if(this._gm!=null && typeof(this._gm)!="undefined" && pattern.test(this._gm)) { return this.fb_name; } return (this._gm!=null && typeof(this._gm)!="undefined")?(this._gm):""; } this.gm_description = function(value){ if(value!=null && typeof(value)!="undefined"){ this._gm_description = value; } return (this._gm_description!=null && typeof(this._gm_description)!="undefined")?(this._gm_description):""; } this.gs_id = function(value){ if(value!=null && typeof(value)!="undefined"){ var prev = this.gs_id(); this._gs_id = value; if((prev<=0 && value>0) || (value<=0 && prev>0)){ this.show(); } this.show_debug_info(); } return (this._gs_id!=null && typeof(this._gs_id)!="undefined")?parseInt(this._gs_id):-1; } this.change_auth_inner = true; this.init = function(){ if(this.change_auth_inner){ this.auth.inner = this.inner; } this.A_xr(""); this.A_xr_gl(this.gl); this.B_xr(""); this.B_xr_gl(this.gl); this.gs_id(-1); this.state("free"); // free,playing,waiting,deciding. The player state this.mode("attack"); //attack defense, the mode of the player. When the state of the player is "playing" he can be in one of the two mode, either attacl or defense. this.step(1); // attack or defence step (step) this.chat_channel("monomaxia"); this.gms = new Array(); this.score(""); this.round(0); this.round_init(); } this.round_init = function() { this.kategoria(""); this.difficulty_level(""); this.erwtiseis=new Array(); this.erwtisi(""); this.apantiseis=new Array(); this.answer(""); this.defense_win(""); this.bet_type(""); this.bet_value(""); this.bet_answer(""); this.bet_win(""); } this.do_heartbeat = function(value, init){ if(value!=null && typeof(value)!="undefined"){ this._do_heartbeat = (value)?true:false; if(this._do_heartbeat){ this.heartbeat(this._tmp_bc_id,init); } } return this._do_heartbeat; } this.heartbeat = function(bc_id,init){ innerHTML(this.status_inner,"function: heartbeat(bc_id="+bc_id+",init="+init+")"); if(this.do_heartbeat()){ var tosend = new Array(); tosend["xr_id"] = this.auth.xr.id; tosend["session"] = this.auth.session(); if(bc_id!=null && typeof(bc_id)!="undefined"){ tosend["bc_id"] = bc_id; } if(init!=null && typeof(init)!="undefined"){ tosend["init"] = true; } if(this.gs_id()>0){ tosend["gs_id"] = this.gs_id; } kd("mf.php?f=heartbeat&p="+a.serialize(tosend),function(g,aaa){aaa.process_heartbeat(g);},this); } else { this._tmp_bc_id = null; if(bc_id!=null && typeof(bc_id)!="undefined"){ this._tmp_bc_id = bc_id; } } } this.process_heartbeat = function(what){ innerHTML(this.status_inner,"function: process_heartbeat("+what+")"); var bc_id = null; //bc_id invoked the process of the beat if(what!=""){ eval("what="+what); if(what!=false && typeof(what)=="object"){ bc_id = what["bc_id"]; switch(what["meaning"]){ case "monomaxia_invitation": if(this.state()=="free" || this.state()=="creating"){ this.state("deciding"); if(parseInt(what["eis"])>0){ this.eis(parseInt(what["eis"])); /* this.timer(true); this.set_reverse_timer(this.invitation_timer_inner,(new Date().getTime()+parseInt(what["eis"])*1000),this.name+".decline_invitation("+bc_id+","+what["data"]["gs_id"]+");"); */ } this.show_monomaxia_invitation(bc_id,what["data"]); } break; case "monomaxia_invitation_accepted": if(this.state()=="waiting"){ this.B_xr(what["data"]["B_xr_nickname"]); this.B_xr_gl(what["data"]["B_xr_gl"]); this.state("playing"); this.mode("attack"); this.step(1); this.chat_channel("gs_id_"+this.gs_id()); if(parseInt(what["eis"])>0){ this.eis(parseInt(what["eis"])); } this.show_game(); this.round(1); } this.extinguish_beacon(bc_id); break; case "monomaxia_invitation_declined": if(this.state()=="waiting"){ this.B_xr(""); this.state("creating"); } this.extinguish_beacon(bc_id); break; case "monomaxia_rotate": what["data"]["score"]["A_xr"] = this.A_xr(); what["data"]["score"]["B_xr"] = this.B_xr(); this.score(what["data"]["score"]); this.show_score(); this.extinguish_beacon(bc_id); this.round_init(); this.get_monomaxia(); break; case "monomaxia_attack": this.step(what["data"]["step"]); if(what["data"]["kg_id"]){ this.kategoria(what["data"]["kg_id"]); } if(what["data"]["roll_back_to_step"]){ alert("Παρουσιάστηκε πρόβλημα, δεν βρέθηκε περιεχόμενο, υποχώρηση στο βήμα {step}".replace(/{step}/ig,what["data"]["roll_back_to_step"])); } this.extinguish_beacon(bc_id); this.get_monomaxia(); break; case "monomaxia_defense": this.step(what["data"]["step"]); this.difficulty_level(what["data"]["difficulty_level"]); this.extinguish_beacon(bc_id); this.get_monomaxia(); break; case "monomaxia_end": what["data"]["score"]["A_xr"] = this.A_xr(); what["data"]["score"]["B_xr"] = this.B_xr(); this.score(what["data"]["score"]); this.extinguish_beacon(bc_id); this.gs_us(""); this.show_finale_score(); this.init(); this.show_game(); break; case "monomaxia_new_chat_message": this.extinguish_beacon(bc_id); this.get_chat(); break; default: break; } } } setTimeout(this.name+".heartbeat("+bc_id+")",1000); } this.extinguish_beacon = function(bc_id){ var tosend = new Array(); tosend["bc_id"] = bc_id; kd("mf.php?f=extinguish_beacon&p="+a.serialize(tosend),function(g,aaa){},this); } this.show_debug_info = function(){ if(get_element(this.state_inner)){ innerHTML(this.state_inner,"gm_id: "+this.gm_id()+" state: "+this.state()+" A_xr: "+this.A_xr()+" "+this.A_xr_gl()+" B_xr: "+this.B_xr()+" "+this.B_xr_gl()+" gs_id: "+this.gs_id()+" gs_us: "+this.gs_us()+" session: "+this.auth.session()+" mode: "+this.mode()+" step: "+this.step()+" answer: "+this.answer()+" defense_win: "+this.defense_win()+" bet_type: "+this.bet_type()+" bet_value: "+this.bet_value()+" bet_answer: "+this.bet_answer()+" bet_win: "+this.bet_win()+" timer: "+this.timer()+" automatic_action: "+this.automatic_action()+" chat_channel: "+this.chat_channel()+" round: "+this.round()+""); } } this.state = function(value){ if(value!=null && typeof(value)!="undefined"){ switch(value){ case "free": case "creating":case "playing": case "waiting": case "deciding": this._state = value; break; default: innerHTML(this.state_inner,"state: "+this._state+" ERROR tried passing value to state that is not accepted"); innerHTML(this.status_inner,"function: state() ERROR tried passing value to state that is not accepted"); break; } this.show_debug_info(); } return this._state; } this.mode = function(value){ if(value!=null && typeof(value)!="undefined"){ switch(value){ case "attack":case "defense": this._mode = value; break; default: innerHTML(this.status_inner,"function: mode() ERROR tried passing value to mode that is not accepted"); break; } this.show_debug_info(); } return this._mode; } this.step = function(value){ if(value!=null && typeof(value)!="undefined"){ if(value==1 || value==2 || value==3 || value==4 || value==5 || value==6){ this._step = value; } else { innerHTML(this.status_inner,"function: step() ERROR tried passing value to step that is not accepted"); } this.show_debug_info(); } return this._step; } this.score = function(value){ if(value!=null && typeof(value)!="undefined"){ this._score = value; } return (this._score!=null && typeof(this._score)!="undefined")?this._score:""; } this.eis = function(value){ if(value!=null && typeof(value)!="undefined"){ this._eis = value; } return (this._eis!=null && typeof(this._eis)!="undefined")?this._eis:0; } this.chat_channel = function(value){ if(value!=null && typeof(value)!="undefined"){ this._chat_channel = value; if(get_element(this.chat_dialog_transactions_inner)){ innerHTML(this.chat_dialog_transactions_inner,""); } this.chat_dialog_transactions = new Array(); this.last_dialog_transactions_id = "-1"; this.show_debug_info(); } return (this._chat_channel!=null && typeof(this._chat_channel)!="undefined")?this._chat_channel:"monomaxia"; } this.new_game = function() { this.state("creating"); this.mode("attack"); this.get_game("create"); } this.get_game = function(action) { var tosend = new Array(); tosend["xr_id"] = this.auth.xr.id; tosend["session"] = this.auth.session(); tosend["gs_us"] = this.gs_us(); tosend["gm_id"] = this.gm_id(); if(action){ tosend["action"] = action; } this.show_wait(this.game_inner); kd("mf.php?f=get_monomaxia&gl="+this.gl+"&p="+a.serialize(tosend),function(g,aaa){aaa.load(g);aaa.show_game();aaa.get_chat();},this); } this.get_monomaxia = function(){ var tosend = new Array(); tosend["gs_id"] = this.gs_id(); tosend["xr_id"] = this.auth.xr.id; //needed to determine what xr_id the below session is tosend["session"] = this.auth.session(); //just in case the session is changed this.show_wait(this.game_inner); kd("mf.php?f=get_monomaxia&gl="+this.gl+"&p="+a.serialize(tosend),function(g,aaa){aaa.load(g);aaa.show_game();aaa.get_chat();},this); } this.load = function (what){ if(what!=""){ eval("what="+what); if(what!=false && typeof(what)=="object"){ if(what["gs_us"]){ this.gs_us(what["gs_us"]); } if(what["gm_id"]){ this.gm_id(what["gm_id"]); } if(what["gm"]){ this.gm(what["gm"]); } if(what["gm_description"]){ this.gm_description(what["gm_description"]); } if(what["gs_id"]){this.gs_id(what["gs_id"]);this.chat_channel("gs_id_"+this.gs_id());} if(what["A_xr"]){this.A_xr(what["A_xr"]);} if(what["B_xr"]){this.B_xr(what["B_xr"]);} if(what["status"]){ var tmp_status_to_state_map = new Array(); tmp_status_to_state_map["live"]="playing"; tmp_status_to_state_map["start"]="creating"; tmp_status_to_state_map["end"]="free"; if(tmp_status_to_state_map[what["status"]]){ this.state(tmp_status_to_state_map[what["status"]]); } if(this.state()=="creating" && this.B_xr()!="" && this.A_xr()!=""){ if(what["A_xr_id"] && what["A_xr_id"]==this.auth.xr.id){ this.state("waiting"); } else { this.state("deciding"); } } } if(what["data"] && typeof(what["data"])=="object"){ if(what["data"]["A_xr_mode"]){ if(what["A_xr_id"] && what["A_xr_id"]==this.auth.xr.id){ this.mode(what["data"]["A_xr_mode"]); } } if(what["data"]["B_xr_mode"]){ if(what["B_xr_id"] && what["B_xr_id"]==this.auth.xr.id){ this.mode(what["data"]["B_xr_mode"]); } } if(what["data"]["A_xr_gl"]){ this.A_xr_gl(what["data"]["A_xr_gl"]); } if(what["data"]["B_xr_gl"]){ this.B_xr_gl(what["data"]["B_xr_gl"]); } if(what["data"]["step"]){ this.step(what["data"]["step"]); } if(what["data"]["kg_id"]){ this.kategoria(what["data"]["kg_id"]); } if(what["data"]["difficulty_level"]){ this.difficulty_level(what["data"]["difficulty_level"]); } if(what["data"]["erwtiseis"]){ this.erwtiseis=new Array(); for(var i in what["data"]["erwtiseis"]){ this.erwtiseis[what["data"]["erwtiseis"][i]["id"]] = what["data"]["erwtiseis"][i]["show_string_"+this.gl]; } } if(what["data"]["er_id"]){ this.erwtisi(what["data"]["er_id"]); } if(what["data"]["apantiseis"]){ this.apantiseis=new Array(); for(var i in what["data"]["apantiseis"]){ this.apantiseis[what["data"]["apantiseis"][i]["id"]] = {"show_string":what["data"]["apantiseis"][i]["show_string_"+this.gl],"correctness_percentage":what["data"]["apantiseis"][i]["correctness_percentage"]}; } } if(what["data"]["ap_id"]){ this.answer(what["data"]["ap_id"]); } if(what["data"]["defense_win"] || typeof(what["data"]["defense_win"])=="boolean" ){ this.defense_win(what["data"]["defense_win"]); } if(what["data"]["correct_ap_id"]){ this.correct_ap_id(what["data"]["correct_ap_id"]); } if(what["data"]["bet_type"]){ this.bet_type(what["data"]["bet_type"]); } if(what["data"]["bet_value"]){ this.bet_value(what["data"]["bet_value"]); } if(what["data"]["bet_ap_id"]){ this.bet_answer(what["data"]["bet_ap_id"]); } if(what["data"]["bet_win"] || typeof(what["data"]["bet_win"])=="boolean"){ this.bet_win(what["data"]["bet_win"]); } if(what["data"]["round"]){ this.round(what["data"]["round"]); } } if(what["eis"]){this.eis(parseInt(what["eis"]));} if(what["gms"] && typeof(what["gms"])=="object"){ this.gs_us(""); this.init(); for(var i in what["gms"]){ this.gms[this.gms.length] = what["gms"][i]; } } } else { this.gs_us(""); this.init(); //alert("Did not saved or retrieve the game session"); } } else { alert("Παρουσιάστηκε πρόβλημα, προσπαθήστε να ξαναφορτώσετε την σελίδα"); } } this.online.get = function(){ var tosend = new Array(); tosend["gm_id"] = this.parent.gm_id(); tosend["limit1"] = this.limit1; tosend["limit2"] = this.limit2; this.parent.show_wait(this.parent.online_inner); kd("mf.php?f=get_online_xr&gl="+this.parent.gl+"&p="+a.serialize(tosend),function(g,aaa){aaa.load(g);aaa.parent.show_online()},this); } this.online.load = function(what){ this.set = new Array(); if(what!=""){ eval("what="+what); for(var i in what["data"]){ this.set[i] = new Object(); this.set[i].xr_id = what["data"][i]["xr_id"]; this.set[i].xr_session = what["data"][i]["xr_session"]; this.set[i].nickname = what["data"][i]["nickname"];" " this.set[i].busy = what["data"][i]["busy"]; this.set[i].total_score = what["data"][i]["total_score"]; this.set[i].total_games = what["data"][i]["total_games"]; } this.count = what["count"]; } } this.invite = function(xr_id){ innerHTML(this.status_inner,"function: invite("+xr_id+")"); if(this.state()=="creating"){ this.show_wait(this.game_inner); this.state("waiting"); var tosend = new Array(); tosend["gs_id"] = this.gs_id(); tosend["B_xr_id"] = xr_id; this.tmp_B_xr_id = xr_id; kd("mf.php?f=monomaxia_invite&p="+a.serialize(tosend),function(g,aaa){aaa.after_invite(g);},this); } } this.after_invite = function(what){ innerHTML(this.status_inner,"function: after_invite()"); this.show_game(); if(what!=""){ eval("what="+what); if(what==false){ alert("η πρόκληση απέτυχε, ανανέωσε την σελίδα και δοκίμασε ξανά"); } else if(what>0){ //what is seconds the invitation to last this.timer(true); this.set_reverse_timer(this.invitation_timer_inner,(new Date().getTime()+(parseInt(what)+10)*1000),this.name+".get_monomaxia();");// we add 10 seconds to be sure that the beacon died } } } this.show = function(){ if(this.auth.is_logged_in){ innerHTML(this.inner,this.draw()); if(!this.do_heartbeat()){ this.do_heartbeat(true, true); } this.get_game(); } else { this.auth.show_for_monomaxies(); } } this.draw = function(){ if(this.fb_iframe == ""){ style = "normal"; } else { style="none"; } var r = ""; r += "
"; r += ""; r += ""; r += ""; r += " "; r += ""; r += "
"+""+"
"+this.gm()+"
"+""+"
"; r += " "; r += " "; if(this.gs_id()<=0){ r += " "; } else { r += " "; r += " "; } r += " "; r += "
"+""+"
"+""+"
"+this.draw_score()+"
"+this.draw_chat()+"
"; r += "
"; r += "
"; if(!get_element(this.popup_inner)){ r += "
"; } return r; } this.show_game = function(){if(this.state()=="playing"){show(this.inner_container);}innerHTML(this.game_inner,this.draw_game());this.automate();} this.draw_game = function() { this.automatic_action(""); var r = ""; r += ""; //r += ""; if(this.gs_id()<=0){ document.getElementById('main').style.backgroundImage = "url(images/arxiki_"+this.gl+".jpg)"; r += ""; var disp_name = (this.auth.psevdonim != "")?this.auth.psevdonim:this.auth.fb_first_name; r += ""; r += ""; if(this.score()!=""){ r += ""; r += " "; r += ""; r += ""; r += " "; r += ""; } } else if (this.state()=="creating"){ document.getElementById('main').style.backgroundImage = "url(images/in_game_"+this.gl+".jpg)"; r += "" r += ""; r += " "; r += ""; r += ""; r += " "; r += ""; this.automatic_action("get_online"); } else if (this.state()=="waiting"){ document.getElementById('main').style.backgroundImage = "url(images/in_game_"+this.gl+".jpg)"; r += ""; r += " "; r += ""; r += ""; r += " "; r += ""; } else if (this.state()=="playing"){ document.getElementById('main').style.backgroundImage = "url(images/in_game_"+this.gl+".jpg)"; if(this.mode()=="attack"){ if(this.step()==1){ r += ""; r += ""; r += ""; r += ""; r += ""; r += " "; r += ""; r += ""; r += " "; r += ""; this.automatic_action("set_timer_for_attack_step_1"); } else if(this.step()==2){ r += ""; r += " "; r += ""; r += ""; r += " "; r += ""; } else if(this.step()==3){ if(this.erwtiseis.length==0){//den vrethikan ervtiseis kane roll back sto step 1 (epilogi allis katigorias) this.automatic_action("roll_back_to_step_1"); } else { r += ""; r += "" r += " "; r += ""; r += ""; r += ""; r += " "; r += ""; r += ""; r += " "; r += " "; r += ""; r += ""; r += ""; r += ""; this.automatic_action("set_timer_for_attack_step_3"); } } else if(this.step()==4){ r += ""; r += " "; r += ""; r += ""; r += " "; r += ""; } else if(this.step()==5){ if((this.defense_win() && this.bet_type()=="loose") || (!this.defense_win() && this.bet_type()=="win")){ //this means attacker loose the bet so he has a chance to replay r += ""; r += "" r += ""; r += ""; r += ""; r += ""; r += " "; r += ""; r += ""; r += " "; r += ""; this.automatic_action("set_timer_for_attack_step_5"); } else if (this.bet_type()==""){ r += ""; r += " "; r += ""; r += ""; r += " "; r += ""; this.automatic_action("rotate"); } else { r += ""; r += " "; r += ""; r += ""; r += " "; r += ""; this.automatic_action("rotate"); } } else if(this.step()==6){ r += ""; r += " "; r += ""; if(this.bet_win()){ soundManager.play('correct_answer'+(parseInt(Math.random()*1000)%15)); r += ""; r += " "; r += ""; } else { soundManager.play('wrong_answer'+(parseInt(Math.random()*1000)%5)); r += ""; r += " "; r += ""; } r += ""; r += " "; r += ""; this.automatic_action("rotate"); } } else if (this.mode()=="defense"){ if(this.step()==1){ r += ""; r += " "; r += ""; r += ""; r += " "; r += ""; } else if(this.step()==2){ r += ""; r += " "; r += " "; r += ""; r += " "; r += " "; r += ""; r += ""; r += " "; r += " "; r += ""; r += ""; r += " "; r += " "; r += ""; this.automatic_action("set_timer_for_defense_step_2"); } else if(this.step()==3){ r += ""; r += " "; r += ""; r += ""; r += " "; } else if(this.step()==4){ r += ""; r += "" r += " "; r += ""; r += ""; r += ""; r += " "; r += ""; r += ""; r += " "; r += ""; this.automatic_action("set_timer_for_defense_step_4"); } else if(this.step()==5){ r += ""; r += " "; r += ""; r += ""; if(this.defense_win()){ soundManager.play('correct_answer'+(parseInt(Math.random()*1000)%7)); r += " "; } else{ soundManager.play('wrong_answer'+(parseInt(Math.random()*1000)%5)); r += " "; } r += ""; } else if(this.step()==6){ r += ""; r += " "; r += ""; r += ""; r += " "; r += ""; } } } r += "
"+this.auth.draw()+"
"+"
Λοιπόν μονομάχε {username},
Πάμε κατευθείαν στο ψητό. Εδώ μάχονται αυτοί που δεν φοβούνται. Οι κανόνες είναι απλοί, κάνεις την επίθεση μετά αμύνεσαι, μετά μπορείς να σταματήσεις, ή, αν νιώθεις δυνατός, συνεχίζεις και ξανά-μανά. Μπορείς να ξεκινήσεις τον «καβγά» πρώτος, μπορείς και να περιμένεις να σε προκαλέσει κάποιος. Α, ναι μπορείς και να λάβεις μέρος σε πρωτάθλημα, ο καλύτερος κάτι θα πάρει.
ο Άρης να είναι μαζί σου!
".replace(/{username}/gi,disp_name)+"
" for(var i in this.gms){ r += ""; if(i>2){break;} } r += "
"+""+"
\n\n\nΤέλος της μονομαχίας (ουφ…), έλα να δεις τι έκανες (παρακάτω)
"+this.draw_score()+"
Προσκάλεσε κάποιον σε μονομαχία!
Παρακάτω εμφανίζονται μονομάχοι που έχουν το θάρρος να βρίσκονται, αυτή την στιγμή, στο παιχνίδι. Αυτοί, που έχουν το όνομα τους γραμμένο με γκρίζο χρώμα ήδη μονομαχούν και δεν είναι σε θέση να σου δώσουν την ικανοποίηση. Διάλεξε ένα μονομάχο (από τους διαθέσιμους) \n
"+this.draw_online()+"
"+"τώρα περιμένουμε να δούμε αν ο {opponent} έχει το θάρρος να απαντήσει\n\n\n".replace(/{opponent}/gi,((this.online.set[this.tmp_B_xr_id])?this.online.set[this.tmp_B_xr_id].nickname:"..."))+"
Διάλεξε την κατηγορία ερωτήσεων στην οποία θα κάνεις την επίθεση
"+this.draw_kategories()+"
"; r += " "; r += " "; r += " "; r += ""; r += " "; r += "
"; r += "
περίμενε ο αντίπαλος σου να αμυνθεί, διαλέγοντας το επίπεδο δυσκολίας της ερώτησης \n\n
Διάλεξε την ερώτηση την οποία θα πρέπει να απαντήσει ο αντίπαλος σου
"+this.draw_erwtiseis()+"
"+this.draw_bet()+"
"; r += " "; r += ""; r += " "; r += ""; r += " "; r += " "; r += "
Επίθεση
ακύρωση στοιχήματος
"; r += "
περίμενε ο αντίπαλος σου να απαντήσει
Έχασες το στοίχημα, αλλά σου δίνετε η δυνατότητα να αναιρέσεις την ζημιά που έπαθες, αν απαντήσεις σωστά την ερώτηση
"+this.draw_question("bet_answer")+"
"; r += " "; r += " "; r += " "; r += " "; r += " "; r += "
Απάντηση
"; r += "
Ο γύρος τελείωσε, σε λίγο θα γίνεις εσύ ο αμυνόμενος, αν δεν γίνετε καμία αλλαγή για ένα λεπτό ανανέωσε την σελίδα.
Κέρδισες το στοίχημα. Ο γύρος τελείωσε, σε λίγο θα γίνεις εσύ ο αμυνόμενος, αν δεν γίνετε καμία αλλαγή για ένα λεπτό ανανέωσε την σελίδα.
Απάντησες σωστά, το χαμένο στοίχημα αναιρείται.
Απάντησες λάθος, θα χρεωθείς το χαμένο σου στοίχημα.
Ο γύρος τελείωσε, σε λίγο θα γίνεις εσύ ο αμυνόμενος, αν δεν γίνετε καμία αλλαγή για ένα λεπτό ανανέωσε την σελίδα.
βρίσκεσαι σε άμυνα, περίμενε ο αντίπαλος σου να κάνει την επίθεση του, να διαλέξει την κατηγορία ερωτήσεων στην οποία θα γίνει ο γύρος της μονομαχίας\n\n
"+"Διάλεξε επίπεδο δυσκολίας"+"
Κατηγορία ερώτησης που θα πρέπει να απαντήσεις είναι {category}, διάλεξε το επίπεδο δυσκολίας της ".replace(/{category}/gi,this.kategories[this.kategoria()].onoma[this.gl])+"
"+this.draw_difficulty_level()+"
περίμενε ο αντίπαλος σου να κάνει την επίθεση του, διαλέγοντας την ερώτηση που θα πρέπει να απαντήσεις\n\n
Έγινε η κύρια επίθεση, απάντησε την παρακάτω ερώτηση
"+this.draw_question()+"
"; r += " "; r += " "; r += " "; r += " "; r += " "; r += "
Απάντηση
"; r += "
Αυτό πάει να πει άμυνα. Απάντησες σωστά!
Απάντησες λάθος. πρέπει να πόνεσε. Η σωστή απάντηση ήταν: "; if(this.apantiseis[this.correct_ap_id()]){ r+=this.apantiseis[this.correct_ap_id()].show_string; } r += "
Ο γύρος τελείωσε, περίμενε σε λίγο θα είσαι εσύ ο επιτιθέμενος, αν δεν γίνεται καμία αλλαγή για ένα λεπτό ανανέωσε την σελίδα.
"; return r; } this.show_online = function(){if(get_element(this.online_inner)){innerHTML(this.online_inner,this.draw_online());}} this.draw_online = function() { var r = ""; r +="
" for(var i in this.online.set){ var disp_name = this.online.set[i].nickname; if(this.online.set[i].xr_id!=this.auth.xr.id){ var add = "class='huge bold brown_text link' onclick='"+this.name+".invite("+this.online.set[i].xr_id+");' onmouseover=\"this.firstChild.src='imgs/yellow_star.gif'\" onmouseout=\"this.firstChild.src='imgs/brown_star.gif'\""; var img = " "; if(this.online.set[i].busy){ add = "class='huge bold darkgrey'"; var img = " "; } r += "
"+img+disp_name+"
"; // r += ""+this.online.set[i].nickname+"
"; } } r += "
"; if(this.online.count>this.online.limit2){ r += this.online.draw_paging(); } r += "
"; return r; } this.show_score = function(){innerHTML(this.score_inner,this.draw_score());} this.draw_score = function() { var r = ""; var tmp_A_xr = this.A_xr(); var tmp_A = " "; var tmp_lastA = " "; var tmp_B_xr = " "; var tmp_B = " "; var tmp_lastB = " "; if(typeof(this.score())=="object"){ tmp_A_xr = this.score().A_xr; tmp_A = this.score().A; tmp_lastA = this.score().lastA; tmp_B_xr = this.score().B_xr; tmp_B = this.score().B; tmp_lastB = this.score().lastB; } r += ""; r += ""; r += ""; r += "
"; r += " "; r += " "; r += "
"; r += " "; r += " "; r += " "; r += "
"+tmp_A_xr+"
"+tmp_B_xr+"
"; r += "
"; r += " "; r += " "; r += " "; r += "
"+tmp_A+"
"+tmp_B+"
"; r += "
"; /* if(typeof(this.score())=="object"){ r += "
"+this.score().A_xr+": "+this.score().A+""+this.score().B_xr+": "+this.score().B+"
" } */ r += "
"; //alert(r) return r; } this.show_chat = function(){innerHTML(this.chat_inner,this.draw_chat());} this.draw_chat = function() { var r = ""; r += ""; r += ""; r += ""; r += ""; r += "" // //mg_chat_send_bttn.gif //mg_chat_text_inpt.gif r += "
" + this.draw_chat_dialog_transactions() + "
 
"; r += ""; r += " "; r += " "; r += "
"; r += "
"; return r; } this.get_chat = function(){ var tosend = new Array(); tosend["channel"] = this.chat_channel(); tosend["lct_id"] = this.last_dialog_transactions_id; kd("cf.php?f=get_chat&p="+a.serialize(tosend),function(g,aaa){aaa.load_chat_dialog_transactions(g);aaa.show_chat_dialog_transactions();},this); } this.load_chat_dialog_transactions = function(what){ if(what!=""){ eval("what="+what); if(what!=false && typeof(what)=="object"){ for(var i in what){ this.chat_dialog_transactions[i] = what[i] } this.last_dialog_transactions_id = (typeof(i)=="undefined")?this.last_dialog_transactions_id:i; } } } this.show_chat_dialog_transactions = function(){/*innerHTML(this.chat_dialog_transactions_inner,this.draw_chat_dialog_transactions());*/ADDRinnerHTML(this.chat_dialog_transactions_inner,this.draw_chat_dialog_transactions());} this.draw_chat_dialog_transactions = function() { var r = "";r1= ""; /* r += ""; var cl = ""; for(var i in this.chat_dialog_transactions){ cl = (cl=="")?"bg_lightgrey":""; r1 = ""+""+r1; } r += r1; r += "
"+this.chat_dialog_transactions[i].xr+": "+this.chat_dialog_transactions[i].msg+"
"; */ var chat_dialog_transactions_cl = ""; for(var i in this.chat_dialog_transactions){ chat_dialog_transactions_cl = "darkgrey"; r1 = "
"+this.chat_dialog_transactions[i].xr+": "+this.chat_dialog_transactions[i].msg+"
"+""+r1; } r=r1; this.chat_dialog_transactions = new Array(); return r; } this.send_chat_msg = function(that){ this.send_msg_ctl = that; this.send_msg_ctl.disabled = true; var msg = ""; if(that.form){ msg = e(trim(that.form[make_name(this.name)+'_chat_message'].value)); that.form[make_name(this.name)+'_chat_message'].value = ""; } innerHTML(this.counter_inner," "); var tosend = new Array(); tosend["channel"] = this.chat_channel(); tosend["gs_id"] = this.gs_id(); tosend["A_xr_id"] = this.auth.xr.id; tosend["msg"] = msg; kd("cf.php?f=add_msg&p="+e(a.serialize(tosend)),function(g,aaa){aaa.show_chat_dialog_transactions();aaa.send_msg_ctl.disabled=false;},this); } this.show_monomaxia_invitation = function(bc_id,what){ soundManager.play('invite'+(parseInt(Math.random()*1000)%1)); if(window.focus()){ innerHTML(this.popup_inner,this.draw_monomaxia_invitation(bc_id,what)); show(this.popup_inner,100,61); } else{ var time_of_invite = (new Date().getTime()); var time_of_expiration = (new Date().getTime()+this.eis()*1000); if(confirm(strip_html("\nΟ μονομάχος {user} σε προκαλεί σε μια δικαία μάχη, τι λες;\n".replace(/{user}/gi,what["A_xr_nickname"])))){ if((new Date().getTime())>time_of_expiration){ alert(strip_html("Η πρόσκληση έγινε στις {time_of_invite} και έχει λήξη εδώ και {time_of_expiration} δευτερόλεπτα.".replace(/{time_of_invite}/gi, formatDate(new Date(time_of_invite),"HH:mm:ss") ).replace(/{time_of_expiration}/,parseInt(((new Date().getTime())-time_of_expiration)/1000)))); this.state("free"); } else { this.accept_invitation(bc_id,what["gs_id"]); } } else { this.decline_invitation(bc_id,what["gs_id"]); } } } this.draw_monomaxia_invitation = function(bc_id,what) { var r = ""; r += ""; r += ""; r += " "; r += ""; r += "
"; r += " "; r += " "; r += " "; r += " "; r += " " r += "
"+"\nΟ μονομάχος {user} σε προκαλεί σε μια δικαία μάχη, τι λες;\n".replace(/{user}/gi,what["A_xr_nickname"])+"
"+"δευτερόλεπτα που έχεις  για να αποδεχτείς την πρόκληση ".replace(/{t}/gi,"")+"
"; r += "
"; return r; } this.accept_invitation = function(bc_id,gs_id){ this.timer(false); this.show_wait(this.game_inner); this.step(1); var tosend = new Array(); tosend["bc_id"] = bc_id; tosend["gs_id"] = gs_id; tosend["B_xr_id"] = this.auth.xr.id; tosend["xr_B_session"] = this.auth.session(); kd("mf.php?f=monomaxia_accept_invitation&gl="+this.gl+"&p="+a.serialize(tosend),function(g,aaa){show(aaa.inner_container,10,10);aaa.load(g);aaa.chat_channel("gs_id_"+aaa.gs_id());aaa.mode("defense");aaa.show_game();hide(aaa.popup_inner);},this); } this.decline_invitation = function(bc_id,gs_id){ this.timer(false); if(this.state()=="deciding"){ var tosend = new Array(); tosend["bc_id"] = bc_id; tosend["gs_id"] = gs_id; tosend["B_xr_id"] = this.auth.xr.id; kd("mf.php?f=monomaxia_decline_invitation&p="+a.serialize(tosend),function(g,aaa){aaa.state("free");hide(aaa.popup_inner);},this); } } this.kategoria = function(value){ if(value!=null && typeof(value)!="undefined"){ this._kg_id = value; } return this._kg_id; } this.show_kategories = function(){innerHTML(this.kategories_inner,this.draw_kategories()); } this.draw_kategories = function(){ var r =""; r += ""; r += ""; r += ""; r += ""; r += "
"; // r += "
κατηγορίες ερωτήσεων "; r += " "; r += " "; var cats = 0; for(var i in this.kategories){ if(trim(this.kategories[i].onoma[this.A_xr_gl()])!="" && trim(this.kategories[i].onoma[this.B_xr_gl()])!=""){ r += ""; if (cats %2 != 0) { r+= ""; } cats++; } } r += ""; r += "
"; // r += "
"; r += "
"; return r; } this.difficulty_level = function(value){ if(value!=null && typeof(value)!="undefined"){ this._difficulty_level = value; this.show_debug_info(); } return this._difficulty_level; } this.show_difficulty_level = function(){innerHTML(this.difficulty_level_inner,this.draw_difficulty_level());} this.draw_difficulty_level = function(){ var r = ""; r += ""; r += ""; r += ""; r += ""; r += "
επίπεδο δυσκολίας
"; r += " " for(var i=1;i<=5;i++){ r += " "; } r += "
"+i+"
"; r += "
"; return r; } this.erwtisi = function(value){ if(value!=null && typeof(value)!="undefined"){ this._er_id = value; this.show_debug_info(); } return this._er_id; } this.show_erwtiseis = function(){innerHTML(this.erwtiseis_inner,this.draw_erwtiseis());} this.draw_erwtiseis = function(){ var r = ""; r += "" r += " "; r += "
"; r += " "; var img = ""; for(var i in this.erwtiseis){ r += ""; } r += "
"; r += "
"; return r; } this.answer = function(value){ if(value!=null && typeof(value)!="undefined"){ this._ap_id = value; this.show_debug_info(); } return (this._ap_id!=null && typeof(this._ap_id)!="undefined")?this._ap_id:""; } this.defense_win = function(value){ if(value!=null && typeof(value)!="undefined"){ this._defense_win = value; this.show_debug_info(); } return (this._defense_win!=null && typeof(this._defense_win)!="undefined")?this._defense_win:""; } this.correct_ap_id = function(value){ if(value!=null && typeof(value)!="undefined"){ this._correct_ap_id = value; this.show_debug_info(); } return (this._correct_ap_id!=null && typeof(this._correct_ap_id)!="undefined")?this._correct_ap_id:""; } this.show_question = function(onclick_function){innerHTML(this.question_inner,this.draw_question(onclick_function));} this.draw_question = function(onclick_function){ var r = ""; onclick_function = (typeof(onclick_function)=="undefined")?"answer":onclick_function; r += "" r += ""; r += " "; r += "
"+this.erwtiseis[this.erwtisi()]+"
"; var img = " "; r += ""; for(var i in this.apantiseis){ r += ""; } r += "
"; r += "
"; return r; } this.bet_type = function(value){ if(value!=null && typeof(value)!="undefined"){ if(value=="win" || value=="loose" || value==""){ this._bet_type = value; } else { innerHTML(this.status_inner,"function: bet_type() ERROR tried passing value to bet_type that is not accepted"); } this.show_debug_info(); } return (this._bet_type!=null && typeof(this._bet_type)!="undefined")?this._bet_type:""; } this.bet_value = function(value){ if(value!=null && typeof(value)!="undefined"){ this._bet_value = value; this.show_debug_info(); } return (this._bet_value!=null && typeof(this._bet_value)!="undefined")?this._bet_value:""; } this.bet_answer = function(value){ if(value!=null && typeof(value)!="undefined"){ this._bet_ap_id = value; this.show_debug_info(); } return (this._bet_ap_id!=null && typeof(this._bet_ap_id)!="undefined")?this._bet_ap_id:""; } this.bet_win = function(value){ if(value!=null && typeof(value)!="undefined"){ this._bet_win = value; this.show_debug_info(); } return (this._bet_win!=null && typeof(this._bet_win)!="undefined")?this._bet_win:""; } this.show_bet = function(){innerHTML(this.bet_inner,this.draw_bet());} this.draw_bet = function(){ var r = "";r1 = "";r2 = ""; r += ""; r += ""; r += ""; r += "
Βάλε στοίχημα
"; r += " " r += " "; r += " "; r += "
"; r += "
νικήσει
"; r += "
χάσει
"; r += "
"; r += " " for(var i=1;i<=5;i++){ r += " "; } r += "
"+i+"
"; r += "
"; r += "
"; return r; } this.attack = function(){ this.timer(false); this.show_wait(this.game_inner); var tosend = new Array(); tosend["gs_id"] = this.gs_id(); tosend["step"] = this.step(); if(this.step()==1){ if(this.kategoria()==""){ alert("Δεν διαλέξατε κάποια κατηγορία. Διαλέξτε μια κατηγορία και ξανακάντε επίθεση"); this.show_game(); return; } tosend["kg_id"] = this.kategoria(); } else if(this.step()==3){ if(this.erwtisi()==""){ alert("Δεν επιλέξτε κάποια ερώτηση. Παρακαλώ επιλέξτε μια ερώτηση και ξαναεπιτεθείτε"); this.show_game(); return; } tosend["er_id"] = this.erwtisi(); tosend["bet_type"] = this.bet_type(); tosend["bet_value"] = this.bet_value(); } else if(this.step()==5){ tosend["bet_ap_id"] = this.bet_answer(); } kd("mf.php?f=monomaxia_attack&p="+a.serialize(tosend),function(g,aaa){aaa.step(aaa.step()+1);aaa.get_monomaxia();},this); } this.defense = function(){ this.timer(false); this.show_wait(this.game_inner); var tosend = new Array(); tosend["gs_id"] = this.gs_id(); tosend["step"] = this.step(); if(this.step()==2){ tosend["difficulty_level"] = this.difficulty_level(); } else if(this.step()==4){ tosend["ap_id"] = this.answer(); } kd("mf.php?f=monomaxia_defense&p="+a.serialize(tosend),function(g,aaa){aaa.step(aaa.step()+1);aaa.get_monomaxia();},this); } this.automatic_action = function(value){ if(value!=null && typeof(value)!="undefined"){ if(value=="" || value=="rotate" || value=="set_timer_for_attack_step_1" || value=="set_timer_for_defense_step_2" || value=="set_timer_for_attack_step_3" || value=="set_timer_for_defense_step_4" || value=="set_timer_for_attack_step_5" || value=="get_online" || value=="roll_back_to_step_1"){ this._automatic_action = value; } this.show_debug_info(); } return (this._automatic_action!=null && typeof(this._automatic_action)!="undefined")?this._automatic_action:""; } this.automate = function(){ if(this.automatic_action()=="rotate"){ this.rotate(); } else if(this.automatic_action()=="set_timer_for_attack_step_1"){ this.timer(true); this.set_reverse_timer(this.step1_timer_inner,(new Date().getTime()+this.eis()*1000),this.name+".end();"); } else if(this.automatic_action()=="set_timer_for_defense_step_2"){ this.timer(true); this.set_reverse_timer(this.step2_timer_inner,(new Date().getTime()+this.eis()*1000),this.name+".difficulty_level('1');"+this.name+".defense()"); } else if(this.automatic_action()=="set_timer_for_attack_step_3"){ this.timer(true); this.set_reverse_timer(this.step3_timer_inner,(new Date().getTime()+this.eis()*1000),this.name+".end();"); } else if(this.automatic_action()=="set_timer_for_defense_step_4"){ this.timer(true); this.set_reverse_timer(this.step4_timer_inner,(new Date().getTime()+this.eis()*1000),this.name+".answer(-1);"+this.name+".defense()"); } else if(this.automatic_action()=="set_timer_for_attack_step_5"){ this.timer(true); this.set_reverse_timer(this.step5_timer_inner,(new Date().getTime()+this.eis()*1000),this.name+".bet_answer(-1);"+this.name+".attack()"); } else if(this.automatic_action()=="get_online"){ this.online.get(); } else if(this.automatic_action()=="roll_back_to_step_1"){ alert("roll back to step 1"); this.roll_back(1); } } this.rotate = function(){ var tosend = new Array(); tosend["gs_id"] = this.gs_id(); kd("mf.php?f=monomaxia_rotate&p="+a.serialize(tosend),function(g,aaa){},this); } this.end = function(){ //only attacker can launch this action this.timer(false); this.show_wait(this.game_inner); var tosend = new Array(); tosend["gs_id"] = this.gs_id(); kd("mf.php?f=end_monomaxia&p="+a.serialize(tosend),function(g,aaa){},this); } this.timer = function(value){ if(typeof(value)=="boolean"){ this._timer = value; this.show_debug_info(); } return (this._timer==null || typeof(this._timer)=="undefined")?false:this._timer; } this.set_reverse_timer = function(where_element_id, time, action){ if(this.timer()){ var now = new Date().getTime(); if(get_element(where_element_id)){ innerHTML(where_element_id, Math.round((time - now)/1000)); } //alert(now+" "+time+" "+action); if(now60){ var tosend = new Array(); tosend["gm_id"] = this.gm_id(); kd("mf.php?f=get_anakoinwseis&gl="+this.gl+"&p="+a.serialize(tosend),function(g,aaa){aaa.load_anakoinwseis(g);},this); } } this.load_anakoinwseis = function (what){ if(what!=""){ eval("what="+what); if(what!=false && typeof(what)=="string"){ this._last_get_anakoinwseis = (new Date().getTime()); TICKER_CONTENT=what; ticker_start(true); } } } this.gs_us = function(value){ if(value!=null && typeof(value)!="undefined"){ this._gs_us = value; var date = new Date(); date.setTime(date.getTime()+(10*365*24*60*60*1000)); document.cookie="us="+this.gs_us()+"; expires="+date.toGMTString()+"; path=/"; this.show_debug_info(); } return (this._gs_us!=null && typeof(this._gs_us)!="undefined")?this._gs_us:""; } this.show_finale_score = function(){ //soundManager.play('invite'+(parseInt(Math.random()*1000)%1)); if(window.focus()){ innerHTML(this.popup_inner,this.draw_finale_score()); show(this.popup_inner,100,61); } else{ var r = ""; if(typeof(this.score())=="object"){ if(this.score().A_xr && this.score().A && this.score().B_xr && this.score().B){ if(this.score().A_without_bonus && this.score().B_without_bonus){ r += "Η μάχη έληξε με βαθμολογία  "+this.score().A_xr+": "+this.score().A_without_bonus+" "+this.score().B_xr+": "+this.score().B_without_bonus+"\n"; if(this.score().A==this.score().B){ r += "Ισοπαλία, κανένας δεν λαμβάνει μπόνους\n"; } else { r += "Ο νικητής {winner} λαμβάνει μπόνους {bonus}".replace(/{winner}/gi,((this.score().A>this.score().B)?this.score().A_xr:this.score().B_xr)).replace(/{bonus}/gi,this.score().bonus)+"\n"; } } r += "Τελική βαθμολογία "+this.score().A_xr+": "+this.score().A+" "+this.score().B_xr+": "+this.score().B; } } if(r!=""){ alert(strip_html(r)); } } } this.draw_finale_score = function() { var r = ""; var tmp_A_xr = this.A_xr(); var tmp_A = " "; var tmp_lastA = " "; var tmp_B_xr = " "; var tmp_B = " "; var tmp_lastB = " "; if(typeof(this.score())=="object"){ tmp_A_xr = this.score().A_xr; tmp_A = this.score().A; tmp_lastA = this.score().lastA; tmp_B_xr = this.score().B_xr; tmp_B = this.score().B; tmp_lastB = this.score().lastB; } r += ""; r += ""; r += ""; r += ""; r += "
"; r += " "; r += " "; r += "
"; r += " "; r += " "; r += " "; r += " "; r += "
Συνολικό Σκορ
"+tmp_A_xr+"
"+tmp_B_xr+"
"; r += "
"; r += " "; r += " "; r += " "; r += " "; r += "
 
"+tmp_A+"
"+tmp_B+"
"; r += "
"; r += "
"; //alert(r) return r; } this.round = function(value){ if(value!=null && typeof(value)!="undefined"){ var prev_value = this.round(); this._round = value; this.show_debug_info(); if(prev_value0){ r += "γύρος "+this.round()+""; } return r; } //this.gs_us(e("")); } if(typeof(a)!="object"){ var a = new PHP_Serializer(); } function Auth_monomaxiews(name, parent){ this.name = name; this.parent = parent; this.inner = make_name(this.name)+"_inner"; this.forma = make_name(this.name)+"_forma"; this.inner_status = make_name(this.name)+"_inner_status"; this.xr_inner = make_name(this.name)+"_xr_inner"; this.is_logged_in = false; this.psevdonim = ""; this.parol = ""; this.fb_email = ""; this.fb_name = ""; this.fb_first_name = ""; this.fb_last_name = ""; this.xr = new Object(this.name+".xr");//new Atomo(this.name+".xr",this); this.xr.inner_status = this.inner_status; this.xr.inactive_inner = "inactive_inner"; this.xr.parent = this; this.xr.init = function() { this.id = "new"; this.email = ""; this.un = ""; this.pw = ""; this.status = "pending"; this.type = "reader"; this.set = new Array(); for(var i in gls){ this.set[i] = new Object(); this.set[i].eponymo = ""; this.set[i].onoma = ""; this.set[i].nickname = ""; this.set[i].gl = gls[i].digramma; if(gls[i].digramma == 'el'){ this.default_gl_i=i; } } this.eponymo = ""; //same as for this.default_gl_i this.onoma = "";//same as for this.default_gl_i this.nickname = "";//same as for this.default_gl_i } this.xr.load = function(what) { this.id = e(what["id"]); this.email = e(what["email"]); this.un = e(what["un"]); this.pw = e(what["pw"]); this.status = e(what["status"]); this.type = e(what["type"]); for(var i in this.set){ this.set[i].eponymo = e(what["eponymo_"+this.set[i].gl]); this.set[i].onoma = e(what["onoma_"+this.set[i].gl]); this.set[i].nickname = e(what["nickname_"+this.set[i].gl]); } this.eponymo = e(what["eponymo"]); this.onoma = e(what["onoma"]); this.nickname = e(what["nickname"]); var pattern = /^([a-zA-Z0-9_.-])+%40([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/; if(pattern.test(this.un)) { this.un=(this.parent.fb_name!="")?this.parent.fb_name:this.un; this.nickname = (this.parent.fb_name!="")?this.parent.fb_name:this.nickname; this.onoma = (this.parent.fb_first_name!="")?this.parent.fb_first_name:this.onoma; this.eponymo = (this.parent.fb_last_name!="")?this.parent.fb_last_name:this.eponymo; } } this.xr.after_get_by_id = function(){} this.xr.draw_titlos = function(){return ""+d(this.un)+" "+d(this.eponymo)+" "+d(this.onoma)+" ["+d(this.email)+"]";} this.xr.show_profile = function(){} this.xr.init(); this.to_show = ""; //methods this.init = function(){ var date = new Date(); date.setTime(date.getTime()+(10*365*24*60*60*1000)); document.cookie="psevdonim=; expires="+date.toGMTString()+"; path=/; domain=mixgrill.gr"; document.cookie="parol=; expires="+date.toGMTString()+"; path=/; domain=mixgrill.gr"; document.cookie="seans_a=; expires="+date.toGMTString()+"; path=/; domain=mixgrill.gr"; } this.to_send = function(){ var toret = new Array(); toret["psevdonim"] = this.psevdonim; toret["parol"] = this.parol; toret["session"] = this.session(); toret["meaning"] = "online_monomaxies"; toret["gl"] = "el"; return toret; } this.to_send_fb = function(){ var toret = new Array(); toret["session"] = this.session(); toret["email"] = this.fb_email; return toret; } this.show = function(){ if(get_element(this.inner)){ if(innerHTML(this.inner,this.draw())){ show(this.inner); } } if(this.is_logged_in){ setTimeout(this.name+".beacon()",60000); } } this.draw = function(){ var r = ""; if(this.is_logged_in){ r += ""; r += " "; r += " "; r += " "; r += " "; r += " "; r += "
"; r += "
"; } else { if(this.parent.fb_iframe == "") { style = "normal"; } else { style="none"; } r += "
"; r += "
"; r += ""; r += ""; r += ""; r += " "; r += " "; r += ""; r += "
"; r += " "; r += " "; r += " "; r += " "; r += " "; r += " "; r += " "; r += " "; r += " "; r += " "; r += " "; r += ""; r += " "; r += "
Όνομα χρήστη:
Συνθηματικό :
"; r += "
"; r += "
"; r += "
"; } r += ""; return r; } this.get = function(that){this.login(that);} this.login = function(that){ if(typeof(that)!="undefined"){ this.psevdonim = e((document.forms[this.forma][make_name(this.name)+"_psevdonim"].value)); this.parol = e((document.forms[this.forma][make_name(this.name)+"_parol"].value)); } if(this.psevdonim!="" && this.parol!=""){ if(get_element(this.inner)){innerHTML(this.inner,"
Γίνετε έλεγχος των στοιχείων σας, παρακαλώ περιμένετε...
")}; kd("mf.php?f=mm_auth&p="+e(a.serialize(this.to_send())),function(g,aaa){aaa.load(g);},this); } else { this.after_login(); } (function() { var e = document.createElement('script'); e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; e.async = true; document.getElementById('login_form').appendChild(e); }()); } this.load = function(that){ var date = new Date(); date.setTime(date.getTime()+(10*365*24*60*60*1000)); eval("that="+that); this.is_logged_in = (that["status"]==1)?true:false; if(this.is_logged_in){ document.cookie="psevdonim="+this.psevdonim+"; expires="+date.toGMTString()+"; path=/; domain=mixgrill.gr"; document.cookie="parol="+this.parol+"; expires="+date.toGMTString()+"; path=/; domain=mixgrill.gr"; this.xr.load(that["data"]); this.to_show = this.xr.draw_titlos(); // this.show(); } else { document.cookie="psevdonim=; expires="+date.toGMTString()+"; path=/; domain=mixgrill.gr"; document.cookie="parol=; expires="+date.toGMTString()+"; path=/; domain=mixgrill.gr"; this.mesg = that["mesg"]; } switch(that["status"]){ case 0: alert("Τα στοιχεία που εισάγατε αντιστοιχούν σε χρήστη που είναι σε κατάσταση αναμονής, δεν μπορείτε να εισέλθετε στο σύστημα διαχείρισης "); break; case 2: kd("mf.php?f=mm_fb_auth&p="+e(a.serialize(this.to_send_fb())),function(g,aaa){aaa.load(g);},this); break; case -1: alert("Ο λογαριασμός σας απενεργοποιήθηκε, δεν μπορείτε να εισέλθετε στο σύστημα διαχείρισης \nδεν έχετε εισέλθει
"); break; case -2: alert(""+that["mesg"]+"\nδεν έχετε εισέλθει
"); break; case -3: alert("Λάθος στοιχεία"); break; case -4: var answer = confirm("Χρειάζετε να είσαι μέλος του Mixgrill προκειμένου να συμμετάσχεις στο παιχνίδι. Θέλεις να δημιουργήσεις νέο λογαριασμό;
"); if (answer) { var to_send = new Array(); to_send["email"] = this.fb_email; kd("mf.php?f=mm_fb_register&p="+e(a.serialize(to_send)),function(g,aaa){aaa.load(g);},this); alert("Ευχαριστούμε που επέλεξες να γίνεις μέλος!Καλή διασκέδαση!
"); } else { alert("Λυπούμαστε που δεν επέλεξες να γίνεις μέλος.
"); } break; default: break; } this.after_login(); } this.logout = function(){ var to_send = new Array(); to_send["xr_id"] = this.xr.id to_send["psevdonim"] = this.psevdonim; to_send["session"] = this.session(); to_send["meaning"] = "online_monomaxies"; kd("mf.php?f=mm_logout&p="+e(a.serialize(to_send)),function(that,aaa){aaa.after_login();},this); var date = new Date(); date.setTime(date.getTime()+(10*365*24*60*60*1000)); document.cookie="psevdonim=; expires="+date.toGMTString()+"; path=/; domain=mixgrill.gr"; document.cookie="parol=; expires="+date.toGMTString()+"; path=/; domain=mixgrill.gr"; this.xr.init(); this.to_show= ""; this.is_logged_in=false; (function () { var e = document.createElement('script'); e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; e.async = true; document.getElementById('login_form').appendChild(e); }()); //this.after_login(); // this.show(); } this.cancel = function(){;}; this.after_login = function(){this.show();}; this.beacon = function(){ if(this.is_logged_in){ var to_send = new Array(); to_send["xr_id"] = this.xr.id to_send["psevdonim"] = this.psevdonim; to_send["type"] = this.xr.type; to_send["session"] = this.session(); to_send["meaning"] = "online_monomaxies"; kd("mf.php?f=mm_auth_beacon&p="+e(a.serialize(to_send)),function(that,aaa){setTimeout(aaa.name+".beacon()",60000); },this); } } this.session = function(value){ if((value==null || typeof(value)=="undefined") && (this._session==null || typeof(this._session)=="undefined")){ value = (new Date().getTime())%1000000000; } if(value!=null && typeof(value)!="undefined"){ this._session = value; } return this._session; } }