// ======= beginning of pagequery class ======= var window1 = new Array(); function __cf_PageQuery(q) { if (q.length > 1) { this.q = q.substring(1, q.length); } else { this.q = null; } this.keyValuePairs = new Array(); if (q) { for (var i=0; i < this.q.split("&").length; i++) { this.keyValuePairs[i] = this.q.split("&")[i]; } } // getKeyValuePairs method this.getKeyValuePairs = function() { return this.keyValuePairs; } // getValue method this.getValue = function(s) { for (var j=0; j < this.keyValuePairs.length; j++) { if(this.keyValuePairs[j].split("=")[0] == s) { return this.keyValuePairs[j].split("=")[1]; } } return ''; } // getParameters method this.getParameters = function() { var a = new Array(this.getLength()); for (var j=0; j < this.keyValuePairs.length; j++) { a[j] = this.keyValuePairs[j].split("=")[0]; } return a; } this.getLength = function() { return this.keyValuePairs.length; } } // ======= end of pagequery class ======= // ======= beginning of code for transferring data from pages to current page ====== // function that redirects to the selected url in the parameter select function __cf_faq_goto_selecturl(sel) { document.location = sel[sel.selectedIndex].value; return false; } // the class that will check the parameters var __cf_parameters = new __cf_PageQuery(window.location.search); /*var metachar=document.getElementById('charsetenc'); metachar.content="text/html; charset=ISO-8859-1"; var metachar=document.getElementById('charsetenc'); alert(metachar.content);*/ document.write('
loading...
'); // the callback function after loading the page (see also "js_result.js") function __cf_continue() { document.getElementById('__cf_faq').innerHTML = __cf_content; } // callback function for navigation bar function __cf_continuenav() { if (document.getElementById('__cf_faq_nb')) { document.getElementById('__cf_faq_nb').innerHTML = __cf_contentnav; } } // callback function for search bar function __cf_continuesearch() { if (document.getElementById('__cf_faq_search')) { document.getElementById('__cf_faq_search').innerHTML = __cf_contentsearch; } } // callback function for most visited list function __cf_continuemostvisited() { if (document.getElementById('__cf_faq_mostvisited')) { document.getElementById('__cf_faq_mostvisited').innerHTML = __cf_contentmostvisited; } } // callback function for best scored list function __cf_continuebestscored() { if (document.getElementById('__cf_faq_bestscored')) { document.getElementById('__cf_faq_bestscored').innerHTML = __cf_contentbestscored; } } // callback function for latest questions function __cf_continuelatest() { if (document.getElementById('__cf_faq_latest')) { document.getElementById('__cf_faq_latest').innerHTML = __cf_contentlatest; } } // callback function for continue email function __cf_continueemail_field() { if (document.getElementById('__cf_faq_email')) { document.getElementById('__cf_faq_email').innerHTML = __cf_contentemail_field; } } // this function adds a parameter to an url // assumes there is no hash part in the url (as in "page.html#anchor") function __cf_faq_add_urlparam(url, name, value) { if (url.indexOf('?') != -1) { url += '&' + name + '=' + escape(value); } else { url += '?' + name + '=' + escape(value); } return url; } // this function retrieves the base URL of the page, without the hash part and the __cf parameters function __cf_faq_getbaseURL() { baseURL = '' + document.location; baseHash = '' + document.location.hash; baseURL = baseURL.substring(0, baseURL.length - baseHash.length); // strip baseURL __cf* parameters var i = baseURL.indexOf('__cf'); var j = -1; while (i != -1) { // strip the url parameter j = baseURL.indexOf('&', i); if (j != -1) { // this is not the last parameter baseURL = baseURL.substr(0, i) + baseURL.substr(j + 1, baseURL.length); } else { // this is the last parameter baseURL = baseURL.substr(0, i - 1) } i = baseURL.indexOf('__cf'); } return baseURL; } // opens a popup of the specified question function __cf_faq_open_question(qid) { //alert(window1); //alert ('site 1'); if( window1[qid] != null ) { //alert ('site 2'); if( window1[qid].closed ) { //alert ('site 4'); window1[qid] = __cf_openwnd("_cfaq_"+qid, "http://cf.touchmind.com//faq.php?w=loadfaq&id=" + qid, 550, 630, true); } else { //alert ('site 5'); window1[qid].focus(); } }else { //alert ('site 3'); window1[qid] = __cf_openwnd("_cfaq_"+qid, "http://cf.touchmind.com//faq.php?w=loadfaq&id=" + qid, 550, 630, true); } } function __cf_openwnd(u,n,w,h, x) { var top, left, top, features; left = (screen.width - w) / 2; top = (screen.height - h) / 2; features = ",left="+left+",top="+top; winargs="width="+w+",height="+h+",resizable=Yes,scrollbars=Yes,status=Yes,"; dialogargs = "scrollbars=yes,center=yes;dialogHeight="+h+"px;dialogWidth="+w+"px;help=no;status=no;resizable=yes; "; if (n.indexOf("?") != -1) { n += "&"; } else { n += "?"; } n +="rand="+Math.random().toString().substring(3); if (window.showModalDialog && !x) { remote=window.showModelessDialog(n, window, dialogargs + features); if (n.match(/dirbrowser/)) { window._dlg_ = remote; } } else { var newLocation; newLocation = window.location + ''; newLocation = newLocation.replace(/\/[^\/]*$/, ''); if(n.indexOf('./') == 0) { newLocation += n.replace(/^\./, ''); } else if (n.indexOf('http://') == 0) { newLocation = n; } else { newLocation += '/' + n; } remote=window.open(newLocation, u, winargs + features); if(remote){ remote.focus(); } } if (remote != null) { if (remote.opener == null) remote.opener = self; } return remote; } // executes the code when the user presses enter in the associated text field function __cf_checkEnter(e, code){ //e is event object passed from function invocation var characterCode; // literal character code will be stored in this variable if (e && e.which) { //if which property of event object is supported (NN4) e = e; characterCode = e.which; //character code is contained in NN4's which property } else { e = event; characterCode = e.keyCode; //character code is contained in IE's keyCode property } if (characterCode == 13){ // if generated character code is equal to ascii 13 (if enter key) // document.msg.m.value = document.msg.m.value.substr(0, document.msg.m.value.length - 1); /// document.msg.submit(); // submit the form eval(code); e.returnValue = false; // for IE, no enter gets entered in the textarea return false; // for NN, no enter gets entered in the textarea } else { return true; } } // ============== end of helper functions =========== // this function places the call to load a page function __cf_faq_load_content(url, prefix) { if (!prefix) { prefix = ''; } // add the current url to the script called as parameter, without the hash part url = __cf_faq_add_urlparam(url, 'baseURL', __cf_faq_getbaseURL()); url = __cf_faq_add_urlparam(url, 'prefix', prefix); document.write(''); } function __cf_faq_init() { // based on the URL parameters var cid = __cf_parameters.getValue('__cf_cid'); var search_q = __cf_parameters.getValue('__cf_q'); var email_field= __cf_parameters.getValue('__cf_register'); // faq content and navigation bar if (cid) { __cf_faq_load_content('http://cf.touchmind.com/faq.php?w=loadcat&id=' + cid + '&q=' + search_q + '&email_field=' + email_field); __cf_faq_load_content('http://cf.touchmind.com/faq.php?w=navigationbar&id=' + cid, 'nav'); __cf_faq_load_content('http://cf.touchmind.com/faq.php?w=register&bid=2828314&email_field=' + email_field, 'email_field'); } else { // default behaviour (no cid) __cf_faq_load_content('http://cf.touchmind.com/faq.php?w=loadcat&bid=2828314&q=' + search_q); __cf_faq_load_content('http://cf.touchmind.com/faq.php?w=navigationbar&bid=2828314', 'nav'); } // fill search bar if (search_q) { __cf_faq_load_content('http://cf.touchmind.com/faq.php?w=searchbar&bid=2828314&q=' + search_q, 'search'); } else { __cf_faq_load_content('http://cf.touchmind.com/faq.php?w=searchbar&bid=2828314', 'search'); } __cf_faq_load_content('http://cf.touchmind.com/faq.php?w=mostvisited&bid=2828314', 'mostvisited'); __cf_faq_load_content('http://cf.touchmind.com/faq.php?w=bestscored&bid=2828314', 'bestscored'); __cf_faq_load_content('http://cf.touchmind.com/faq.php?w=latest&bid=2828314', 'latest'); } function __cf_faq_search() { searchURL = __cf_faq_getbaseURL(); searchURL = __cf_faq_add_urlparam(searchURL, '__cf_cid', __cf_parameters.getValue('__cf_cid')); searchURL = __cf_faq_add_urlparam(searchURL, '__cf_q', document.getElementById('__cf_q').value); document.location = searchURL; } function is_empty(str) { if(!str) return true; return str.search("^[ \t\n\r]*$") > -1 ? true : false ; } function is_email(str) { //return true; return str.search("^([a-zA-Z0-9_]|\\-|\\.)+@(([a-zA-Z0-9_]|\\-)+\\.)+[a-zA-Z]{2,4}\$") > -1 ? true : false ; } function __cf_faq_email() { if((!is_empty(document.getElementById('__cf_register').value)) && (!is_email(document.getElementById('__cf_register').value))) { alert("Invalid email address!"); return false; } else{ emailURL = "http://cf.touchmind.com//faq.php?w=loadfaq1"; emailURL += "&id="+ __cf_parameters.getValue('__cf_cid'); emailURL += "&email=" + escape(document.getElementById('__cf_register').value); // document.location = emailURL; __cf_openwnd("email_update",emailURL,300,300,true) //window.open("http://cf.touchmind.com//faq.php?w=loadfaq1" ,"_blank"); } }