/* WEEBO : CONTENT MADE EASY                                                                          */                                                                        
/* -------------------------------------------------------------------------------------------------- */
/* Original development began in 2001, where a need came about to develop a content management system */
/* that catered for business and not only graphic designers. Weebo has come a long way and this new   */
/* content management system was derived to cater for the small, medium and large enterprise websites */
/* This code is the intellectual property of Gilbert Martin II, anyone attempting to copy, alter or   */
/* modify this code is committing patent fraud. Beyond this you are a miserable human being if you    */
/* are trying to copy somebody else/*s work, because you are not good enough to do your own.          */
/* -------------------------------------------------------------------------------------------------- */
/* Copyright (C) 2000 - 2020 . Gilbert Martin II (www.gilbertmartin.co.za) . All Rights Reserved      */
/* Visit www.gilbertmartin.co.za or www.weebo.co.za for more information regarding this development   */
/* -------------------------------------------------------------------------------------------------- */

/* HIDE CONTENT */
function HideContent(d) {if (d.length < 1) {return;} document.getElementById(d).style.display = "none";document.getElementById("showlink").style.display = "block";}

/* SHOW CONTENT */
function ShowContent(d) {if (d.length < 1) {return;} document.getElementById(d).style.display = "block";document.getElementById("showlink").style.display = "none";}

/* CONFIRM DELETE */
function confirmdelete(url){var message = "Are you sure you want to delete this information?";var return_value = confirm(message);if (return_value == true) {window.navigate(url);} else {}}

/* ROUND NUMBER */
function roundNumber(num, dec) {var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);return result;}

/* CALCULUS FUNCTION */
function calculus() {var value = document.getElementById('Calculate').value;var vat = .14;var qty = document.getElementById('Qty').value;document.getElementById('CalculateVAT').value = roundNumber(value * vat,2);setTimeout(document.getElementById('CalculateVAT').onchange,2000);var tmp = value * vat;tmp = (value*qty)*1.14;document.getElementById('CalculateTOTAL').value = roundNumber(tmp,2);setTimeout(document.getElementById('CalculateTOTAL').onchange,3000);}

/* GET VALUE FOR CONTAINER */
function getValue(num,type) {var result = "";if (num==1) {result = document.getElementById("co1");} if (num==2) {result = document.getElementById("co2");} if (num==3) {result = document.getElementById("co3");} if (type==1) {result = result.options[result.selectedIndex].value;} if (type==2) {result = result.value;}return result;}

/* EXECUTE EMBEDDED SCRIPTS */
function executeEmbeddedScripts(node,theResponse){ 
var bSaf = (myBindexOf(navigator.userAgent,'Safari',0) != -1); 
var bOpera = (myBindexOf(navigator.userAgent,'Opera',0) != -1); 
var bMoz = (navigator.appName == 'Netscape'); 
if (!node) return; 
var myHead=document.getElementsByTagName('head'); 
if ((!bSaf)&&(!bOpera)&&(!bMoz)) node.innerHTML="&nbsp;&nbsp;"+theResponse;
var st = node.getElementsByTagName('SCRIPT'); 
var strExec; 
var scripts = st.length; 
var i = 0; 
for(j = 0; j < scripts; j++){ 
var scriptsAtStart = st.length; 
if (bSaf) {strExec = st[i].innerHTML; st[i].innerHTML = "";} 
else if (bOpera) {strExec = st[i].text; st[i].text = "";} 
else if (bMoz) {strExec = st[i].textContent; st[i].textContent = "";} 
else {strExec = st[i].text; st[i].text = "";} 
try { 
var myScript = document.createElement("script"); 
myHead.item(0).appendChild(myScript); 
myScript.type = "text/javascript"; 
myScript.text=strExec; 
var html = node.innerHTML; 
var endScriptL = '<' + '/script>'; 
var endScriptU = '<' + '/SCRIPT>'; 
var pos2 = myBindexOf(html,strExec,0); 
var pos = myBindexOf(html,endScriptL,pos2) >= 0 ? myBindexOf(html,endScriptL,pos2) : myBindexOf(html,endScriptU,pos2); 
pos += String(endScriptL).length; 
html = html.substr(0,pos) + html.substr(pos); 
node.innerHTML = html; 
if(scriptsAtStart==st.length) i++; 
} catch(e) { 
alert("Script execution error: "+e); 
} 
} 
} 
function myBindexOf(myObject,mySearch,myPos){ 
if (myPos==null) myPos=0; 
if (typeof(myObject)!='object') return -1; 
if(!myObject.indexOf) { 
for(var i=myPos; i < myObject.length; i++) if(myObject[i]==mySearch) return i; 
return -1; 
} else return myObject.indexOf(mySearch,myPos); 
}

/*REFRESH CAPTCHA IMAGE*/
function RefreshImage(valImageId) {
var objImage = document.images[valImageId];
if (objImage == undefined) {
return;
}
var now = new Date();
objImage.src = objImage.src.split('?')[0] + '?x=' + now.toUTCString();
}

