//------ Date ------
var t = setInterval('date_show()',1000);date_show();
function date_show(){
if(!document.getElementById("date_show")){return;}
var date=new Date(), day=['','Monday','Tuesday','Wednesday','Thrusday','Friday','Saturday','Sunday'], month=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
document.getElementById("date_show").innerHTML = day[date.getDay()] + ", " + month[date.getMonth()] + " " + date.getDate() + " " + date.getFullYear() + " " + (function(){if(date.getHours()<10){return '0'+date.getHours()}else{return date.getHours()}})() + ":" + (function(){if(date.getMinutes()<10){return '0'+date.getMinutes()}else{return date.getMinutes()}})() + ":" + (function(){if(date.getSeconds()<10){return '0'+date.getSeconds()}else{return date.getSeconds()}})();
}
//------ END Date ------
//------ Article Refrence ------
function change_ref(ref){
var ref_no = ref.value;
if(ref_no.length!=6){alert("Incorrect Refrence - Must Be Like 'A00000'"); ref.value=input_ref; return;}
if(ref_no.substr(0,1)!='A'){alert("Incorrect Refrence - Must Be Like 'A00000'"); ref.value=input_ref; return;}
if(!confirm("Are you sure yuo would like to change the Ref?")){ref.value=input_ref; return;}
}
//------ END Article Refrence ------
//------ Article Tags ------
function tag_input(){
var input = document.getElementById('tag_input_box').value;
if(tags.length>=10){return;};
tags.push(input);
place_tags();
}
function place_tags(){
var tag_display=document.getElementById('tags_display'), output_tag=document.getElementById('tag_output'), tag_html='';
for(i=0;i'+tags[i]+'';}
tag_display.innerHTML = tag_html; output_tag.value=tags;
}
var deleted_tags=[];
function delete_tags(id){
deleted_tags.push(tags[id]); document.getElementById('tag_deleted').value=deleted_tags;
tags.splice(id,1);
place_tags();
}
//------ END Article Tags ------
//------ Request From Database ------
function db_request(tbl, name, cons, searcher, conand){
var xmlhttp, query='';
function check_query(){if(query==''){return '?';}else if(query.substring(0,1)=='?'){return '&';}}
if(tbl){query+=check_query()+'tbl='+tbl;}
if(name){query+=check_query()+'name='+name;}
if(cons){query+=check_query()+'cons='+cons;}
if(conand){query+=check_query()+'conand='+conand;}
if(searcher){
if(searcher=='search2'){query+=check_query()+'searcher=2';}else{
query+=check_query()+'searcher=1';}}
if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();} else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
if (typeof XMLHttpRequest == "undefined")
XMLHttpRequest = function () {
try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }
catch (e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); }
catch (e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e) {}
//Microsoft.XMLHTTP points to Msxml2.XMLHTTP.3.0 and is redundant
throw new Error("This browser does not support XMLHttpRequest.");
};
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
//what to do once done - returned text = xmlhttp.responseText;
arr_returned= xmlhttp.responseText.split(', ');
var arr_temp=[[]]; itemnum=name.split(',').length; total=arr_returned.length/itemnum;
for(i=0;i=0&&arrsearch[0][i][2]){
htmlcode+=""
}
if(i0)
htmlcode+=""
resultdiv.innerHTML=htmlcode
}
function search_touch(elm,opt){
if(opt=="del"){if(elm.value=="Search Insight"){elm.value=""}}
if(opt=="blur"){if(elm.value==""){elm.value="Search Insight"}}
}
//------ END Search Feature ------
//------ Archive ------
// onclick="check_display(this,'month')"
function check_display(elm,val){
for(i=1;i=0&&arrsearch[0][i][2]){
htmlcode+=""
htmlcode+="
"+arrsearch[0][i][2]+""
htmlcode+="
"+arrsearch[0][i][1]+""
htmlcode+="
Add"
htmlcode+="
"
}
if(i0)
if (htmlcode!=""){htmlcode+="
"}
resultdiv.innerHTML=htmlcode
}
function get_ad_hub(elm, place){
var letter=elm.id.charAt(elm.id.length-1)
if(elm.value.length<2){document.getElementById(letter+'_search_result').innerHTML=''; return;}
db_request("Home_Ads", "HomeAd_ID, Image", ""+elm.value+"", "search2", place);
setTimeout('return_adhub("'+letter+'")',100)
}
function return_adhub(elm){
var arrsearch = new Array(arr_returned), resultdiv=document.getElementById(elm+'_search_result');
if((!arrsearch[0][0])||(arrsearch[0][0]=='')){return;}
if(!arrsearch[0][arrsearch[0].length-1][0]){arrsearch[0].splice(arrsearch[0].length-1,1)}
var htmlcode=''
var i=arrsearch[0].length; if(i<0){i=0};
if(elm=='f'){elm='fea'}else{elm='edi'}
do{
i--
if(i>=0&&arrsearch[0][i][1]){
htmlcode+=""
htmlcode+="
"+arrsearch[0][i][1]+""
htmlcode+="
Add"
htmlcode+="
"
}
if(i0)
if (htmlcode!=""){htmlcode+="
"}
resultdiv.innerHTML=htmlcode
}
//------ END HUB ------
//------ Extra Image ------
var image=new Image(); img_height=0; img_width=0;
function runimage(img){
var end_code = document.getElementById('code_generated'); image.src=img;
image.onload=function(){
getsize(image, 650);
var inputcode="x
Image Generator
"+
"
Image:
"+
"
"
document.getElementById('img_holder').style.display='block'
var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body
document.getElementById('img_holder').style.top=((document.all? iebody.scrollTop : pageYOffset)+150)+"px"
document.getElementById('img_holder').innerHTML=inputcode
}
}
function getsize(img, maxw){
if (img.width<=maxw){
img_height=img.height
img_width=img.width
} else {
var divid=maxw/img.width
img_height=img.height*divid
img_width=img.width*divid
}
}
function getcode(){
var alt=document.getElementById('alt').value; imglink=document.getElementById('link').value; imgcode=''
if (imglink!=""&&imglink&&imglink!=null){alert("/"+imglink+"/"); imglink="";}else{imglink=""}
imgcode=""
imgcode=imgcode.replace(//g,">")
document.getElementById('code_generated').innerHTML=imgcode
}
function closeimage(){
document.getElementById('img_holder').style.display='none'
document.getElementById('img_holder').innerHTML=''
}
//------ END Extra ------
function checkdate(elm, end, butt){
var failed=false, datehold=elm.value, regex=/(\d{2})\/(\d{2})\/(\d{4})/, datearray=regex.exec(datehold), button= document.getElementById(butt);
function isValidDate(d) {if ( Object.prototype.toString.call(d) === "[object Date]" ) {if (isNaN(d.getTime())){return false;}else{return true;}}else {return false;}}
if(datearray){var dateobj=new Date((+datearray[3]),(+datearray[2])-1,(+datearray[1]),0,0,0)
failed=isValidDate(dateobj)
if (failed){if(dateobj