// $Id: framework.js 4 2008-07-20 16:35:51Z fedot $ var $ = function(){ return $.init.call(arguments[0],arguments[0]); }; var Utils = Utils || {}; var isIE = 0 //@cc_on+1; var Browser = { Version: function() { var version = 999; // we assume a sane browser if (navigator.appVersion.indexOf("MSIE") != -1) // bah, IE again, lets downgrade version number version = parseFloat(navigator.appVersion.split("MSIE")[1]); return version; } } //use background cache in IE6 if (isIE) try{document.execCommand("BackgroundImageCache", false, true);}catch(err){} $.init = function(el){ for (var i in SigMagic){ var callfunc = SigMagic[i]; el[i] = function (){return callfunc.apply(el,arguments);} } return el; } $.ready = function(func){ if (typeof func=='function') set_evt(window,'load',func); } /** * Some nice magic... * NOTE: Since IE doesn't support extending of Node and Element prototypes we wrap this functionality with a trick... */ SigMagic = { _data: function(data_name,data_val){ //clog(this,arguments); var data_name = 'data-'+data_name; var data_val = data_val || null; if (data_val==null){ return this.getAttribute(data_name) || null; } else return this.setAttribute(data_name,data_val); } } function hasClass(elm,cls){ var classy = cls || ''; var re = new RegExp(' '+classy+' '); return re.test(' '+elm.className+' '); } function delClass(elm,cls){ if (hasClass(elm,cls)){ elm.className = (' '+(elm.className || '')+' ').replace(' '+cls+' ','').trim(); } } function addClass(elm,cls){ if (!hasClass(elm,cls)) elm.className = (elm.className || '')+' '+cls; } function val_constructor(){ for(i=0;i1){ //clog(arguments); for (i=1;i645) { url = url + '&bmw=' + bmw; } } var tw=document.getElementById(to_where); var ch1=tw.offsetHeight; var ch2=tw.offsetWidth; tw.innerHTML = '
Loading...
'; setTimeout(function(){ var http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari, ... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); // See note below about this line } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { alert('Giving up :( Cannot create an XMLHTTP instance'); return false; } http_request.onreadystatechange = function() { applyContents(http_request,to_where,on_compl); }; http_request.open('GET', url, true); http_request.send(null); },50); } function xmlreq_put_silent(url,to_where) { var argv = xmlreq_put.arguments; var on_compl = ''; if (argv != null) on_compl = on_compl + argv[2]; if (to_where=='basket') { var bmw = d('bmw').value; if (bmw>645) { url = url + '&bmw=' + bmw; } } var tw=document.getElementById(to_where); var ch1=tw.offsetHeight; var ch2=tw.offsetWidth; //tw.innerHTML = '
 
'; //tw.style.opacity = 50; //tw.style.filter = "alpha(opacity=0.5)"; setTimeout(function(){ var http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari, ... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); // See note below about this line } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { alert('Giving up :( Cannot create an XMLHTTP instance'); return false; } http_request.onreadystatechange = function() { applyContents(http_request,to_where,on_compl); }; http_request.open('GET', url, true); http_request.send(null); },50); } function xmlreq_load(url,to_where,on_compl_f) { //alert('load: url=('+url+') target=('+to_where+') run=('+on_compl_f+')'); setTimeout(function(){ var http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari, ... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); // See note below about this line } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { alert('Giving up :( Cannot create an XMLHTTP instance'); return false; } http_request.onreadystatechange = function() { applyContents(http_request,to_where,on_compl_f); }; http_request.open('GET', url, true); http_request.send(null); },50); } function applyContents(http_request,where,on_complete_func) { if (http_request.readyState == 4) { if (http_request.status == 200) { //alert(http_request.responseText); var dest = d(where) || {}; if (dest.nodeType) dest.innerHTML = http_request.responseText; if (typeof on_complete_func!='function'){ eval(on_complete_func); } else { on_complete_func.call(dest,http_request.responseText); } } else { //alert('There was a problem with the request.'); } } } */ // rightclick /* var message; message = "The content of this web site may not be copied,\n"; message = message + "replaced, distributed, published, displayed, modified,\n"; message = message + "or transferred in any form or by any means except\n"; message = message + "with the prior permission of Signature IT Ltd.\n\n"; message = message + "Copyright infringement is a violation of federal law\n"; message = message + "and subject to criminal and civil penalties.\n\n"; message = message + "(C) 2007, Signature IT Ltd.\n\n"; function clickIE4(){ if (event.button==2){ alert(message); return false; } } function clickNS4(e){ if (document.layers||document.getElementById&&!document.all){ if (e.which==2||e.which==3){ alert(message); return false; } } } if (document.layers){ document.captureEvents(Event.MOUSEDOWN); document.onmousedown=clickNS4; } else if (document.all&&!document.getElementById){ document.onmousedown=clickIE4; } document.oncontextmenu=new Function("alert(message);return false"); */ // This is variable for storing callback function var ae_cb = null; // this is a simple function-shortcut // to avoid using lengthy document.getElementById function ae$(a) { return document.getElementById(a); } // This is a main ae_prompt function // it saves function callback // and sets up dialog function ae_prompt(cb, q, a) { ae_cb = cb; ae$('aep_t').innerHTML = document.domain + ' question:'; ae$('aep_prompt').innerHTML = q; ae$('aep_text').value = a; ae$('aep_ovrl').style.display = ae$('aep_ww').style.display = ''; ae$('aep_text').focus(); ae$('aep_text').select(); } // This function is called when user presses OK(m=0) or Cancel(m=1) button // in the dialog. You should not call this function directly. function ae_clk(m) { // hide dialog layers ae$('aep_ovrl').style.display = ae$('aep_ww').style.display = 'none'; if (!m) ae_cb(null); // user pressed cancel, call callback with null else ae_cb(ae$('aep_text').value); // user pressed OK } // This is a main ae_popup function // it saves function callback // and sets up dialog function ae_popup(popup_title, popup_contents) { ae$('aep2_t').innerHTML = popup_title; ae$('aep2_text').innerHTML = popup_contents; ae$('aep2_ovrl').style.display = ae$('aep2_ww').style.display = ''; } // This function is called when user presses OK(m=0) or Cancel(m=1) button // in the dialog. You should not call this function directly. function ae_popup_close() { // hide dialog layers ae$('aep2_ovrl').style.display = ae$('aep2_ww').style.display = 'none'; } var prompt_w_retval = null; function prompt_w (quest, answ) { ae_prompt( prompt_wcb , quest , answ ); var retval = prompt_w_retval; return (retval); } function prompt_wcb (user_inp) { prompt_w_retval = user_inp; } function get_html_translation_table(table, quote_style) { // Returns the internal translation table used by htmlspecialchars and htmlentities // // version: 903.1614 // discuss at: http://phpjs.org/functions/get_html_translation_table // + original by: Philip Peterson // + revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + bugfixed by: noname // + bugfixed by: Alex // + bugfixed by: Marco // + bugfixed by: madipta // % note: It has been decided that we're not going to add global // % note: dependencies to php.js. Meaning the constants are not // % note: real constants, but strings instead. integers are also supported if someone // % note: chooses to create the constants themselves. // % note: Table from http://www.the-art-of-web.com/html/character-codes/ // * example 1: get_html_translation_table('HTML_SPECIALCHARS'); // * returns 1: {'"': '"', '&': '&', '<': '<', '>': '>'} var entities = {}, histogram = {}, decimal = 0, symbol = ''; var constMappingTable = {}, constMappingQuoteStyle = {}; var useTable = {}, useQuoteStyle = {}; useTable = (table ? table.toUpperCase() : 'HTML_SPECIALCHARS'); useQuoteStyle = (quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT'); // Translate arguments constMappingTable[0] = 'HTML_SPECIALCHARS'; constMappingTable[1] = 'HTML_ENTITIES'; constMappingQuoteStyle[0] = 'ENT_NOQUOTES'; constMappingQuoteStyle[2] = 'ENT_COMPAT'; constMappingQuoteStyle[3] = 'ENT_QUOTES'; // Map numbers to strings for compatibilty with PHP constants if (!isNaN(useTable)) { useTable = constMappingTable[useTable]; } if (!isNaN(useQuoteStyle)) { useQuoteStyle = constMappingQuoteStyle[useQuoteStyle]; } if (useTable == 'HTML_SPECIALCHARS') { // ascii decimals for better compatibility entities['38'] = '&'; if (useQuoteStyle != 'ENT_NOQUOTES') { entities['34'] = '"'; } if (useQuoteStyle == 'ENT_QUOTES') { entities['39'] = '''; } entities['60'] = '<'; entities['62'] = '>'; } else if (useTable == 'HTML_ENTITIES') { // ascii decimals for better compatibility entities['38'] = '&'; if (useQuoteStyle != 'ENT_NOQUOTES') { entities['34'] = '"'; } if (useQuoteStyle == 'ENT_QUOTES') { entities['39'] = '''; } entities['60'] = '<'; entities['62'] = '>'; entities['160'] = ' '; entities['161'] = '¡'; entities['162'] = '¢'; entities['163'] = '£'; entities['164'] = '¤'; entities['165'] = '¥'; entities['166'] = '¦'; entities['167'] = '§'; entities['168'] = '¨'; entities['169'] = '©'; entities['170'] = 'ª'; entities['171'] = '«'; entities['172'] = '¬'; entities['173'] = '­'; entities['174'] = '®'; entities['175'] = '¯'; entities['176'] = '°'; entities['177'] = '±'; entities['178'] = '²'; entities['179'] = '³'; entities['180'] = '´'; entities['181'] = 'µ'; entities['182'] = '¶'; entities['183'] = '·'; entities['184'] = '¸'; entities['185'] = '¹'; entities['186'] = 'º'; entities['187'] = '»'; entities['188'] = '¼'; entities['189'] = '½'; entities['190'] = '¾'; entities['191'] = '¿'; entities['192'] = 'À'; entities['193'] = 'Á'; entities['194'] = 'Â'; entities['195'] = 'Ã'; entities['196'] = 'Ä'; entities['197'] = 'Å'; entities['198'] = 'Æ'; entities['199'] = 'Ç'; entities['200'] = 'È'; entities['201'] = 'É'; entities['202'] = 'Ê'; entities['203'] = 'Ë'; entities['204'] = 'Ì'; entities['205'] = 'Í'; entities['206'] = 'Î'; entities['207'] = 'Ï'; entities['208'] = 'Ð'; entities['209'] = 'Ñ'; entities['210'] = 'Ò'; entities['211'] = 'Ó'; entities['212'] = 'Ô'; entities['213'] = 'Õ'; entities['214'] = 'Ö'; entities['215'] = '×'; entities['216'] = 'Ø'; entities['217'] = 'Ù'; entities['218'] = 'Ú'; entities['219'] = 'Û'; entities['220'] = 'Ü'; entities['221'] = 'Ý'; entities['222'] = 'Þ'; entities['223'] = 'ß'; entities['224'] = 'à'; entities['225'] = 'á'; entities['226'] = 'â'; entities['227'] = 'ã'; entities['228'] = 'ä'; entities['229'] = 'å'; entities['230'] = 'æ'; entities['231'] = 'ç'; entities['232'] = 'è'; entities['233'] = 'é'; entities['234'] = 'ê'; entities['235'] = 'ë'; entities['236'] = 'ì'; entities['237'] = 'í'; entities['238'] = 'î'; entities['239'] = 'ï'; entities['240'] = 'ð'; entities['241'] = 'ñ'; entities['242'] = 'ò'; entities['243'] = 'ó'; entities['244'] = 'ô'; entities['245'] = 'õ'; entities['246'] = 'ö'; entities['247'] = '÷'; entities['248'] = 'ø'; entities['249'] = 'ù'; entities['250'] = 'ú'; entities['251'] = 'û'; entities['252'] = 'ü'; entities['253'] = 'ý'; entities['254'] = 'þ'; entities['255'] = 'ÿ'; } else { throw Error("Table: "+useTable+' not supported'); return false; } // ascii decimals to real symbols for (decimal in entities) { symbol = String.fromCharCode(decimal); histogram[symbol] = entities[decimal]; } return histogram; } function htmlspecialchars (string, quote_style) { // Convert special characters to HTML entities // // version: 812.3017 // discuss at: http://phpjs.org/functions/htmlspecialchars // + original by: Mirek Slugen // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + bugfixed by: Nathan // + bugfixed by: Arno // + revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // - depends on: get_html_translation_table // * example 1: htmlspecialchars("Test", 'ENT_QUOTES'); // * returns 1: '<a href='test'>Test</a>' var histogram = {}, symbol = '', tmp_str = '', entity = ''; tmp_str = string.toString(); if (false === (histogram = get_html_translation_table('HTML_SPECIALCHARS', quote_style))) { return false; } for (symbol in histogram) { entity = histogram[symbol]; tmp_str = tmp_str.split(symbol).join(entity); } return tmp_str; } function htmlspecialchars_decode(string, quote_style) { // Convert special HTML entities back to characters // // version: 901.714 // discuss at: http://phpjs.org/functions/htmlspecialchars_decode // + original by: Mirek Slugen // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + bugfixed by: Mateusz "loonquawl" Zalega // + input by: ReverseSyntax // + input by: Slawomir Kaniecki // + input by: Scott Cariss // + input by: Francois // + bugfixed by: Onno Marsman // + revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // - depends on: get_html_translation_table // * example 1: htmlspecialchars_decode("

this -> "

", 'ENT_NOQUOTES'); // * returns 1: '

this -> "

' var histogram = {}, symbol = '', tmp_str = '', entity = ''; tmp_str = string.toString(); if (false === (histogram = get_html_translation_table('HTML_SPECIALCHARS', quote_style))) { return false; } // & must be the last character when decoding! delete(histogram['&']); histogram['&'] = '&'; for (symbol in histogram) { entity = histogram[symbol]; tmp_str = tmp_str.split(entity).join(symbol); } return tmp_str; } function user_login(){ var login_box = d('userlogin_box'), start_h=0,total=20; if (login_box && login_box.style.display=='none') { login_box.style.overflow = 'hidden'; login_box.style.display = ''; timers.add(function(){ login_box.style.height = start_h+'px'; start_h+=2; if (start_h > total) { login_box.style.overflow = ''; //login_box.style.height = ''; var uname = dd.call(login_box,'input','login_field')[0] || {focus:function(){}}; uname.focus(); return false; } }); } else { if (login_box) { login_box.style.display = 'none'; login_box.style.height = 0; } } } function open_in_popup (popup_title, req_url) { document.getElementById('spop').style.left='30px'; document.getElementById('t_win1').style.width='750px'; document.getElementById('spop').style.width='750px'; document.getElementById('popup_content').style.height='400px'; document.getElementById('popup_title').innerHTML=popup_title; document.getElementById('spop').style.visibility='visible'; xmlreq_put(req_url,'popup_content'); } /** * AJAX */ function _map_get_args(obj){ var res = ''; for (i in obj) res += '&'+encodeURIComponent(i)+'='+encodeURIComponent(obj[i]); return res.replace(/^\&/,'?'); } function do_ajax(url, vars, callbackFunction) { var request = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("MSXML2.XMLHTTP.3.0"); request.open("POST", url, true); request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); request.onreadystatechange = function(){ if (request.readyState == 4 && request.status == 200){ if (request.responseText){ callbackFunction(request.responseText); } } }; request.send(vars); } /** * Traversing */ function nodeText(n){return n.textContent || n.innerText} /** * Dimensions, Styling */ function rewriteCssName(cssName){ var rewriten = cssName.split('-'); // NOTE: first word are leaved lowercased as in CSS Specs for(var i=1;i Loading...'; return xmlreq_put_silent.apply(this,arguments); } else { window.status = 'Some kind of an error occured.'; } } xmlreq_load = function(uri,el,callback){ var tgt = d(el); var postcall = function(){ _put_html(tgt,msg); }; if (typeof callback == 'string' && callback.length){ var eval_callback = callback; postcall = function(msg){ _put_html(tgt,msg); eval(eval_callback); } } else if(typeof callback=='function'){ var callback_func = callback; postcall = function(msg){ if ($j(tgt).length) _put_html(tgt,msg); callback_func.call($j(tgt)[0],msg); } } return $j.ajax({ url:uri, success:postcall }); } function _put_html(tgt,msg){ if (tgt && tgt.innerHTML) { tgt.innerHTML = msg; } else { $j(tgt).html(msg); } } function getElementsByClassName(classname, node) { if(!node) node = document.getElementsByTagName("body")[0]; var a = []; var re = new RegExp('\\b' + classname + '\\b'); var els = node.getElementsByTagName("*"); for(var i=0,j=els.length; i Loading...'; return do_req.apply(this,arguments); } */