function hideCookieWarning() { document.getElementById("cookiewarning").style.visibility = "hidden"; document.getElementById("cookiewarning").style.height = 0; document.getElementById("cookiewarning").style.width = 0; document.getElementById("cookiewarning").innerHTML = ""; } var _debugJS = false; function activatetab( tabn ) { if ( !tabn ) tabn = 1; if ( tabn < 1 ) tabn = 1; /* scroll elements 1 to 10 */ for ( i = 1 ; i < 11 ; i++ ) { /* handle top tab */ var productElement = document.getElementById( "mytabbar" + i ); if ( productElement != null ) { /* tab exists */ if ( tabn == i ) { productElement.style.backgroundImage = "url(/images/mytab2.png)"; productElement.style.backgroundColor = "white"; productElement.style.borderBottom = "0px none white"; productElement.style.height = "32px"; } else { productElement.style.backgroundImage = "url(/images/mytab1.png)"; productElement.style.backgroundColor = "#CCCCCC"; productElement.style.borderBottom = "2px solid #808080"; productElement.style.height = "30px"; } /*temp*/ productElement.style.backgroundImage = ""; } /* handle container tab */ var productElement = document.getElementById( "mytab" + i ); if (productElement != null) { if ( tabn == i ) { //productElement.style.visibility = "visible"; productElement.style.display = "block"; //productElement.style.height = '600px'; productElement.style.height = '450px'; productElement.style.width = '960px'; } else { //productElement.style.visibility = "hidden"; productElement.style.display = "none"; productElement.style.height = 0; } } } } // W3C standard if (window.addEventListener) { window.addEventListener( "load", activatetab( 1 ), false ); // NB **not** 'onload' } else // Microsoft if ( window.attachEvent ) { window.attachEvent( "onLoad", activatetab ); } function fieldhelper($input_obj_name, $output_obj_name, $o_max, $input_obj_type, $o_min, $noprint_max) { // $input_obj_type and $o_min are optional // default for $input_obj_type is "text" // default for $o_min is 0 // make text default if ommited if (!($input_obj_type)) $input_obj_type = "text"; if(!($noprint_max)) $noprint_max = 0; // make o_min 0 if ommited if (!($o_min > 0)) $o_min= 0; $ostr = ""; $red = 0; if ( $input_obj_type == "text" ) { $l = document.getElementById($input_obj_name).value.length; if ( $o_max >= $l ) { if ($noprint_max ==0 ) $ostr = $o_max + " characters max, " + ($o_max - $l) + " remaining"; } else { $red=1; if ($noprint_max ==0 ) $ostr = $o_max + " characters max, " + ($l - $o_max) + " too many"; } if ( $l < $o_min ) { $red=1; $ostr = $o_min + " characters min, " + ($o_min - $l) + " missing"; } } if ( $red == 0 ) $ostr = '' + $ostr + ''; else $ostr = '' + $ostr + ''; document.getElementById($output_obj_name).innerHTML = $ostr; } Number.prototype.formatMoney = function(c, d, t){ var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "", i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0; return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : ""); }; // // // Logs in the browser console all arguments given if and only if the global // Javascript variable _debugJS has the logical value of true function consoleLog() { if ( typeof _debugJS !== "undefined" && _debugJS && typeof console !== "undefined" && arguments.length > 0 ) { if ( arguments.length === 1 ) console.log( arguments[ 0 ] ); else if ( arguments.length === 2 ) console.log( arguments[ 0 ], arguments[ 1 ] ); else if ( arguments.length === 3 ) console.log( arguments[ 0 ], arguments[ 1 ], arguments[ 2 ] ); else if ( arguments.length === 4 ) console.log( arguments[ 0 ], arguments[ 1 ], arguments[ 2 ], arguments[ 3 ] ); else console.log( arguments[ 0 ], arguments[ 1 ], arguments[ 2 ], arguments[ 3 ], arguments[ 4 ] ); } } // Performs generic AJAX sync call. Ideally, we should use JQuery or equivalent // because it is more robust across all browsers and situations. // // Arguments: // url: Url to be called. // params: Given parameters to url destination. Note it can be a string or // an object. If string, it is used as it is. If an object, every // string property is URI encoded. // successCalback: Javascript function to be called upon successful AJAX // call completion. // failCallback: Javascript function to be called upon AJAX call failure. // ongoingCallback: Javascript function to be called when XMLHttp has a // state other than 4 (=ready). function ajaxCall( url, params, successCallback, failCallback, ongoingCallback, cfg ) { var xhr; if ( window.XMLHttpRequest ) { // code for IE7+, Firefox, Chrome, Opera, Safari ... xhr = new XMLHttpRequest(); } else { // code for IE6, IE5 ... xhr = new ActiveXObject( "Microsoft.XMLHTTP" ); } xhr.onreadystatechange = function() { if ( xhr.readyState === 4 ) { if ( xhr.status === 200 ) { if ( successCallback ) { consoleLog( xhr.readyState, xhr.status, "Calling successfull callback for:", url ); successCallback( xhr ); } else consoleLog( "AJAX call successful: 200" ); } else { if ( failCallback ) { consoleLog( xhr.readyState, xhr.status, "Calling failing callback for:", url ); failCallback( xhr ); } else consoleLog( xhr.status, xhr.statusText, "AJAX call failed for:", url ); } } else { if ( ongoingCallback ) { consoleLog( xhr.readyState, xhr.status, "Calling ongoing callback for:", url ); ongoingCallback( xhr ); } } }; var paramString = ""; if ( typeof params === "string" ) paramString = params; else if ( params && typeof params === "object" ) { for ( var p in params ) { var pValue = params[ p ]; if ( typeof pValue === "string" ) pValue = encodeURIComponent( pValue ); paramString += "&" + p + "=" + pValue; } if ( paramString.length > 0 ) paramString = paramString.substring( 1 ); } consoleLog( "ajaxCall():", url, paramString, cfg ); xhr.open( "POST", url , true ); if ( cfg ) { if ( cfg.options ) { for( var o in cfg.options ) { if ( o in xhr ) xhr[ o ] = cfg.options[ o ]; } } if ( cfg.headers ) { for( var h in cfg.headers ) { xhr.setRequestHeader( h, cfg.headers[ h ] ); } } } xhr.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" ); if ( paramString.length > 0 ) xhr.setRequestHeader( "Content-length", paramString.length ); xhr.setRequestHeader( "Connection", "close" ); xhr.send( paramString ); } // Detect if browser support CORS in AJAX calls function doesBrowserSupportCORS() { if ( window.XMLHttpRequest ) { var xhr = new XMLHttpRequest(); if ( "withCredentials" in xhr ) return true; } return false; } function setVisible( obj, toggle ) { var obj2, blayer; if (obj == 'layer1') blayer='blayer1'; if (obj == 'layer2') blayer='blayer2'; if (obj == 'layer3') blayer='blayer3'; if ((toggle != 0) && (toggle !=1)) {var toggle = 2;} obj2 = obj; obj = document.getElementById(obj); var left; if(obj.id == 'layer1'){ left = (screen.width - 300) / 2; } if(obj.id == 'layer2'){ left = (screen.width - 600) / 2; } if(obj.id == 'layer3'){ left = (screen.width - 600) / 2; } //obj.style.left = left+'px'; if (toggle == 2) { obj.style.visibility = ( obj.style.visibility == 'visible' ? 'hidden' : 'visible' ); if (obj.style.visibility == 'visible') { // set the blayer visible var body = document.body, html = document.documentElement; var t_height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ); document.getElementById(blayer).style.height= t_height.toString()+"px"; document.getElementById(blayer).style.visibility = 'visible'; } else { // hide the blayer document.getElementById(blayer).style.visibility = 'hidden'; } } else { if (toggle == 1) { var height = document.body.clientHeight; obj.style.visibility = 'visible'; //obj.style.left = left; //set correct height for background semi-transparent layer and make it visible var body = document.body, html = document.documentElement; var t_height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ); document.getElementById(blayer).style.height= t_height.toString()+"px"; document.getElementById(blayer).style.visibility = 'visible'; } else { obj.style.visibility = 'hidden'; document.getElementById(blayer).style.visibility = 'hidden'; } } } // Simplify (and centralize) displaying a uniTender's look and feel pop-up // message box (in one of the layers reserved for this purpose: layer1, ...) function showMsgBox( title, msg, layer, closeButtonLabel ) { if ( !layer ) layer = 1; var layerName = "layer" + layer; var closeBtnHtml = ''; if ( closeButtonLabel ) closeBtnHtml = ''; //TODO: Add popup symbol close var html = '
' + title + '
' + '
' + msg + closeBtnHtml + '
'; document.getElementById( layerName ).innerHTML = html; setVisible( layerName, 1 ); } // Password recovery script function recoverpwd( operation ) { var params = "operation=" + operation; if ( operation == 1 ) { var u_manager = document.getElementById( "u_manager" ); var u_bidder = document.getElementById( "u_bidder" ); if( u_manager != null && u_bidder != null ) { if ( u_manager.checked ) { params += "&u_manager=" + encodeURIComponent( u_manager.value ); } else { params += "&u_bidder=" + encodeURIComponent( u_bidder.value ); } } } if ( operation == 2 ) { params += "&uemail=" + encodeURIComponent( document.getElementById( "uemail" ).value ); params += "&captcha=" + encodeURIComponent( document.getElementById( "captcha" ).value ); } if ( operation == 3 ) { params += "&b_code=" + encodeURIComponent( document.getElementById( "b_code" ).value ); params += "&captcha=" + encodeURIComponent( document.getElementById( "captcha" ).value ); } ajaxCall( "/ajax/recoverpwd.php", params, function( xmlhttp ) { document.getElementById( "layer1" ).innerHTML = xmlhttp.responseText; setVisible( "layer1", 1 ); }, null, function( xmlhttp ) { document.getElementById( "layer1" ).innerHTML = '
Please wait ...


'; setVisible( "layer1", 1 ); } ); } // Upload Files function uploadpopup2( $doctype, $msgid, $uploadertype, $eventid, $eventtype, $ownerid_optional, $optional_call_str , $optional_call_params ) { if ( !$ownerid_optional ) $ownerid_optional = -1; if ( !$optional_call_str ) $optional_call_str = ""; if ( !$optional_call_params ) $optional_call_params = ""; document.getElementById( "layer1" ).innerHTML = "
Please wait while popup loads ...
"; var params = "?doctype=" + $doctype; params += "&msgid=" + $msgid; params += "&uploadertype=" + $uploadertype; params += "&eventid=" + $eventid; params += "&eventtype=" + $eventtype; params += "&ownerid=" + $ownerid_optional; var uploader = new qq.FileUploader( { element: document.getElementById( "layer1" ), action: "/controlpanel/uploader/php.php" + params, debug: true , onComplete: function( id, name, response ) { if ( $optional_call_str ) window[ $optional_call_str ]($optional_call_params); } } ); setVisible( "layer1", 1 ); }