//----------functions for frames only, called by <script language="JavaScript1.2" src="bundyframe.js"></script>
//----check to see if has been loaded without parent. if so, load in original, using split location
if (
    (window.location.href.indexOf('employee-time-clocks.php')>-1) &&
    (window.top==window.self)
    )
    {
        window.location='http://www.bundyspecialists.com.au/time-clocks.php';
    }



function safepop(theURL,winName,features) 
{
window.open(theURL,winName,features);
}



function validate(thisform)
{ //-----start function validate(this)

if (document.contactform.name.value=="") {alert('Please enter a contact name         ');document.contactform.name.focus();return false;}

if (document.contactform.phone.value=="" && document.contactform.email.value=="") {alert('Please enter your phone number or email address.          ');document.contactform.email.focus();return false;}

if (document.contactform.subject.value=="" && document.contactform.machine.value=="") {alert('Please select your machine or enter a subject.          ');document.contactform.machine.focus();return false;}

if (document.contactform.message.value=="Message: ") {alert('Please enter a short message.         ');document.contactform.message.focus();return false;}

if (document.contactform.phone.value!="") {return dv(thisform);}
if (document.contactform.email.value!="") {return ev(thisform);}

//-----------alert('validation done');

//-----ok - it works tight, but the form still ditches out here - proved by putting the alert in. it ignores anything else after the 'return dv...'. 
//-----removing the 'returns' just above lets it go through to the alert, but it doesn't validate either? so maybe i need to do a similar line like XXX below??

} //-----end function validate()


 
function ev(thisform)
{
with (thisform)
{
if (emailvalidation(email,'Please enter your correct email address         ')==false) {email.focus();return false;} //---------XXX like this line?
}
}

function dv(thisform)
{
with (thisform)
{
if (digitvalidation(phone, 10, 12,'Please re-enter phone number.\nArea code (ie. NSW = 02)            \nand numbers only - no spaces.            ','')==false) {phone.focus();return false;}
}
}


//----phone number validator, calledd on by dv(thisform)

function digitvalidation(entered, min, max, alertbox, datatype)
{
with (entered)
{
checkvalue=parseFloat(value);
if (datatype)
  {smalldatatype=datatype.toLowerCase();
   if (smalldatatype.charAt(0)=="i") {checkvalue=parseInt(value);if (value.indexOf(".")!=-1) {checkvalue=checkvalue+1}};
  }
if ((parseFloat(min)==min && value.length<min) || (parseFloat(max)==max && value.length>max) || value!=checkvalue)
{if (alertbox!="") {alert(alertbox);}return false;}
else {return true;}
}
}


//----email validator, called on by ev(thisform) 

function emailvalidation(entered, alertbox)
{
with (entered)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
lastpos=value.length-1;
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
{if (alertbox) {alert(alertbox);}return false;}
else {return true;}
}
}

function validatecontact(thisform)
{ //-----start function validate(this)

if (document.contactform.name.value=="") {alert('Please enter a contact name         ');document.contactform.name.focus();return false;}

if (document.contactform.phone.value=="" && document.contactform.email.value=="") {alert('Please enter your phone number or email address.          ');document.contactform.email.focus();return false;}

if (document.contactform.subject.value=="" && document.contactform.machine.value=="") {alert('Please select your machine or enter a subject.          ');document.contactform.machine.focus();return false;}

if (document.contactform.message.value=="Message: ") {alert('Please enter a short message.         ');document.contactform.message.focus();return false;}

if (document.contactform.phone.value!="") {return dv(thisform);}
if (document.contactform.email.value!="") {return ev(thisform);}
}


function validaterepair(thisform)
{ //-----start function validate(this)

if (!document.repairform.repair[0].checked && !document.repairform.repair[1].checked) {alert('Please choose either On-site Service Call or Workshop Repairs.             ');document.repairform.repair[0].focus();return false;}
if (document.repairform.company.value=="") {alert('Please enter your company name         ');document.repairform.company.focus();return false;}
if (document.repairform.name.value=="") {alert('Please enter a contact name         ');document.repairform.name.focus();return false;}

if (document.repairform.phone.value=="" && document.repairform.email.value=="") {alert('Please enter your phone number or email address.          ');document.repairform.phone.focus();return false;}
if (document.repairform.address.value=="") {alert('Please enter your street address.          ');document.repairform.address.focus();return false;}

if (document.repairform.subject.value=="") {alert('Please enter your machine make and model.          ');document.repairform.subject.focus();return false;}

if (document.repairform.message.value=="Message: ") {alert('Please enter a detailed description of the problem.         ');document.repairform.message.focus();return false;}

if (document.repairform.phone.value!="") {return dv(thisform);}
if (document.repairform.email.value!="") {return ev(thisform);}
}

// Extra employees
function addSpecialtocart(catbutton,descbutton,pricebutton,empcount)
{
	alert(catbutton + ' ' + descbutton + ' ' + pricebutton + ' ' + parseInt(empcount));
	// Call addtocart with updated price.
	addtocart(catbutton,descbutton,parseInt(empcount));
}
// Standard Cart
function addtocart(catbutton,descbutton,pricebutton)
{
	//alert(catbutton + ' ' + descbutton + ' ' + pricebutton);

	parent.document.carton='on';
	parent.document.cartnumber++;
	if (parent.document.cartnumber>8)
	{
	alert('You already have 8 items in your cart.\n\nYour cart is full. Please click Checkout...');
	}
	else
	{
	parent.document.cat[parent.document.cartnumber]=catbutton;
	parent.document.desc[parent.document.cartnumber]=descbutton;
	parent.document.price[parent.document.cartnumber]=pricebutton;
	parent.document.x=1;
	while (parent.document.cartnumber>=parent.document.x)
	{
		parent.document.cartcontents[parent.document.x]='<tr class="cart"><td bgcolor="eeeeee" width="120">'+parent.document.cat[parent.document.x]+'</td><td  bgcolor="eeeeee" width="120">'+parent.document.desc[parent.document.x]+'</td><td bgcolor="eeeeee" width="120">$'+parent.document.price[parent.document.x].toFixed(2)+'</td></tr>';parent.document.x++;
	}
/*
	while (cartnumber>=y)
	{
	}subtotal=subtotal+price[y] ; freight= XXXXXX .toFixed(2); total= XXXXXXX .toFixed(2);
*/
	parent.document.cartcontentsstring=parent.document.cartcontents+',';parent.document.cartcontentsstring=replace(parent.document.cartcontentsstring,',','');
	parent.document.subtotal=0;parent.document.discount=0;parent.document.z=1;
	while (parent.document.cartnumber>=parent.document.z)	{parent.document.subtotal=parent.document.subtotal+parseFloat(parent.document.price[parent.document.z]);parent.document.z++;};
	parent.document.discount=parent.document.subtotal*.05;
	parent.document.getElementById('cart').innerHTML='<div class="topmost"><table width="470" height="auto" border="1" rules="none" class="cart"><tr><td align="left" valign="top"><strong style="font-size: 12px;">Shopping cart contents:</strong></td></tr><tr><td valign="top"><table>'+parent.document.cartcontentsstring+'</table></td><td width="100" valign="top" align="right" style="padding-right: 5px;"><a href="checkout.htm" target="shopframe"><img src="checkout.gif" border="none" width="80" height="27" alt="Proceed to checkout..." /></a><br />Sub-total: $'+parent.document.subtotal.toFixed(2)+'<br /><span style="color: red;">Discount: $'+parent.document.discount.toFixed(2)+'</span><br />Freight: $'+parent.document.freight+'<br />Total: $'+parent.document.totalex+'<br /><span style="color: rgb(190,190,190)">(ex GST)</span><br /><br /><img src="sp.gif" alt="" width="20"/><img class="hand" src="empty.gif" border="none" alt="Empty shopping cart" onclick="emptycart();" /><br /></td></tr></table></div>';
	if (parent.document.freight!='TBA') {totalup();}
} //end else on full cart if
} //end addtocart


// addfreight() and totalup() are copied in bundy.js for emptycart() to use...
function addfreight() {
	if (document.checkoutform.state.value=='N.S.W.') {parent.document.freight=12} else {parent.document.freight=20};
	parent.document.getElementById('cart').innerHTML='<div class="topmost"><table width="470" height="auto" border="1" rules="none" class="cart"><tr><td align="left" valign="top"><strong style="font-size: 12px;">Shopping cart contents:</strong></td></tr><tr><td valign="top"><table>'+parent.document.cartcontentsstring+'</table></td><td width="100" valign="top" align="right" style="padding-right: 5px;"><a href="checkout.htm" target="shopframe"><img src="checkout.gif" border="none" width="80" height="27" alt="Proceed to checkout..." /></a><br />Sub-total: $'+parent.document.subtotal.toFixed(2)+'<br /><span style="color: red;">Discount: $'+parent.document.discount.toFixed(2)+'</span><br />Freight: $'+parent.document.freight+'.00'+'<br />Total: $'+parent.document.totalex+'<br /><span style="color: rgb(190,190,190)">(ex GST)</span><br /><br /><img src="sp.gif" alt="" width="20"/><img class="hand" src="empty.gif" border="none" alt="Empty shopping cart" onclick="emptycart();" /><br /></td></tr></table></div>';
	totalup();
}

function totalup() {
	parent.document.totalex=(parent.document.subtotal+parent.document.freight-parent.document.discount).toFixed(2);
	parent.document.getElementById('cart').innerHTML='<div class="topmost"><table width="470" height="auto" border="1" rules="none" class="cart"><tr><td align="left" valign="top"><strong style="font-size: 12px;">Shopping cart contents:</strong></td></tr><tr><td valign="top"><table>'+parent.document.cartcontentsstring+'</table></td><td width="100" valign="top" align="right" style="padding-right: 5px;"><a href="checkout.htm" target="shopframe"><img src="checkout.gif" border="none" width="80" height="27" alt="Proceed to checkout..." /></a><br />Sub-total: $'+parent.document.subtotal.toFixed(2)+'<br /><span style="color: red;">Discount: $'+parent.document.discount.toFixed(2)+'</span><br />Freight: $'+parent.document.freight+'.00'+'<br />Total: $'+parent.document.totalex+'<br /><span style="color: rgb(190,190,190)">(ex GST)</span><br /><br /><img src="sp.gif" alt="" width="20"/><img class="hand" src="empty.gif" border="none" alt="Empty shopping cart" onclick="emptycart();" /><br /></td></tr></table></div>';
	parent.document.total=parent.document.totalex*1.1;
	if (document.getElementById('totalbox')) {document.getElementById('totalbox').innerText=parent.document.total.toFixed(2);document.getElementById('totalbox').textContent=parent.document.total.toFixed(2)};
}


function replace(string,text,by) {
// Replaces text with by in string from http://www.irt.org/articles/js037/index.htm
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}


﻿function emptyF() {
	if (!confirm('Do you want to remove all items from your shopping cart?')) {
		return false;
	}
	else
	{
		document.shopform.empty.value='empty';
		document.shopform.submit();
		return false;
	}
}

function remF(rem)
{
	document.shopform.rem.value=rem;
	document.shopform.submit();
	//return false;
}
function checkoutF() {

	document.topaypal.checkout.value='yes';
	document.topaypal.submit();
	//return false;
}
function pay7F() {
	df=document.topaypal;gopp=true;
	if (df.first_name.value.length<2) {alert('Please enter your name.');df.first_name.focus();gopp=false;} else {df.first_name.value=df.first_name.value.toLowerCase().replace(/\b(\w)/g,
function (w, p1) {return p1.toUpperCase();});}; //capitalise
	if (df.last_name.value.length<2) {alert('Please enter your surname.');df.last_name.focus();gopp=false;} else {df.last_name.value=df.last_name.value.toLowerCase().replace(/\b(\w)/g,
function (w, p1) {return p1.toUpperCase();});}; //capitalise
	if (df.address1.value.length<7) {alert('Please enter your Delivery address.');df.address1.focus();gopp=false;} else {df.address1.value=df.address1.value.replace(/\b(\w)/g,
	function (w, p1) {return p1.toUpperCase();});}; //capitalise
	if (df.city.value.length<3) {alert('Please enter your Delivery address suburb.');df.city.focus();gopp=false;} else {df.city.value=df.city.value.toUpperCase();};
	df.zip.value=df.zip.value.replace(/\D/g,'');
	if (df.zip.value.length<4) {alert('Please enter 4-digit or more Delivery address postcode.');df.zip.focus();gopp=false;};
	if (df.state.value=='') {alert('Please select your Delivery address state.');df.state.focus();gopp=false;};
	df.night_phone_b.value=df.night_phone_b.value.replace(/\D/g,'');
	if (
		(df.night_phone_b.value.length!=9 && df.night_phone_b.value.length!=10 && df.state.value=='Other') ||
		(df.night_phone_b.value.length!=10 && df.night_phone_b.value!='Other') ||
		(df.night_phone_b.value.substr(0,1)!='0' && df.night_phone_b.value.substr(0,1)!='1')
	) { // break
		alert('Please enter your Delivery phone number correctly (including area code).\n\nMobile or site phone is acceptable.');df.night_phone_b.focus();gopp=false;
	}
	if (df.email.value.length<6 || df.email.value.lastIndexOf('@')<2 || (df.email.value.length-df.email.value.lastIndexOf('@'))<6 || (df.email.value.length-df.email.value.lastIndexOf('.'))<3 || df.email.value.lastIndexOf('.')==-1) {alert('Please enter your email address correctly.');df.email.focus();gopp=false;};
	if (gopp) {
		document.topaypal.action='http://www.bundyspecialists.com.au/checkout.php?account';
		document.topaypal.submit();
	}
}

function payF(box) {
	// val address form
	df=document.topaypal;gopp=true;
	if (df.first_name.value.length<2) {alert('Please enter your name.');df.first_name.focus();gopp=false;} else {df.first_name.value=df.first_name.value.toLowerCase().replace(/\b(\w)/g,
function (w, p1) {return p1.toUpperCase();});}; //capitalise
	if (df.last_name.value.length<2) {alert('Please enter your surname.');df.last_name.focus();gopp=false;} else {df.last_name.value=df.last_name.value.toLowerCase().replace(/\b(\w)/g,
function (w, p1) {return p1.toUpperCase();});}; //capitalise
	if (df.address1.value.length<7) {alert('Please enter your Delivery address.');df.address1.focus();gopp=false;} else {df.address1.value=df.address1.value.replace(/\b(\w)/g,
	function (w, p1) {return p1.toUpperCase();});}; //capitalise
	if (df.city.value.length<3) {alert('Please enter your Delivery address suburb.');df.city.focus();gopp=false;} else {df.city.value=df.city.value.toUpperCase();};
	df.zip.value=df.zip.value.replace(/\D/g,'');
	if (df.zip.value.length<4) {alert('Please enter 4-digit or more Delivery address postcode.');df.zip.focus();gopp=false;};
	if (df.state.value=='') {alert('Please select your Delivery address state.');df.state.focus();gopp=false;};
	df.night_phone_b.value=df.night_phone_b.value.replace(/\D/g,'');
	if (
		(df.night_phone_b.value.length!=9 && df.night_phone_b.value.length!=10 && df.state.value=='Other') ||
		(df.night_phone_b.value.length!=10 && df.night_phone_b.value!='Other') ||
		(df.night_phone_b.value.substr(0,1)!='0' && df.night_phone_b.value.substr(0,1)!='1')
	) { // break
		alert('Please enter your Delivery phone number correctly (including area code).\n\nMobile or site phone is acceptable.');df.night_phone_b.focus();gopp=false;
	}

	if (df.email.value.length<6 || df.email.value.lastIndexOf('@')<2 || (df.email.value.length-df.email.value.lastIndexOf('@'))<6 || (df.email.value.length-df.email.value.lastIndexOf('.'))<3 || df.email.value.lastIndexOf('.')==-1) {alert('Please enter your email address correctly.');df.email.focus();gopp=false;};


	if (gopp) {
		box.style.opacity=.3;document.getElementById('paynowL').innerText='Please wait...';
		document.topaypal.submit();
	}
}

function subF() {
	if (document.instform.SearchP.value=='') {
		alert('Please enter your Postcode or choose the State list on the right.');document.instform.SearchP.focus();
	} else {
		document.instform.submit();
	}
}

// Martin addition for bundy products, save hitting the database
function buyItem(prodtype, prodid, prodname, prodPrice)
{
	//alert(prodtype+'-PW-'+prodid+'-PW-'+prodname+'-PW-'+prodPrice+'-P-W-');
	if(prodPrice > 0){
		document.buyform.product_holder.value=prodtype+'-PW-'+prodid+'-PW-'+prodname+'-PW-'+prodPrice+'-PW-'+1+'-P-W-';
	}
	parent.document.body.scrollTop=0;
	document.buyform.submit();
}
function pressF(dump) { // for some reason style.top and cssText were blank, maybe because of negatives or partial/fragmented css? currentStyle is IE, getComputedStyle is MOZ
	if (window.getComputedStyle) {
		Top=window.getComputedStyle(dump,null).top;
		Left=window.getComputedStyle(dump,null).left;
	} else if (dump.currentStyle) {
		Top=dump.currentStyle.top;
		Left=dump.currentStyle.left;
	}
	dump.style.top=parseInt(Top)+2+'px';dump.style.left=parseInt(Left)+2+'px';
}
function unpressF(undump) {
	if (window.getComputedStyle) {Top=window.getComputedStyle(undump,null).top;} else if (undump.currentStyle) {Top=undump.currentStyle.top;}
	if (window.getComputedStyle) {Left=window.getComputedStyle(undump,null).left;} else if (undump.currentStyle) {Left=undump.currentStyle.left;}
	undump.style.top=parseInt(Top)-2+'px';undump.style.left=parseInt(Left)-2+'px';
}

function linkonF(linkon) {
	linkon.getElementsByTagName('a')[1].style.color='rgb(255,215,106)';
}
function linkoutF(linkout) {
	linkout.getElementsByTagName('a')[1].style.color='rgb(255,255,255)';
}



function validatecheckout(thisform)
{ //-----start function validate(this)
parent.document.orderform.email.value=document.checkoutform.email.value;

if (parent.document.total!='TBA') {
parent.document.y=1;parent.document.ordercontents=new Array();
while (parent.document.cartnumber>=parent.document.y) {parent.document.ordercontents[parent.document.y]=parent.document.cat[parent.document.y]+'                '+parent.document.desc[parent.document.y]+'                $'+parent.document.price[parent.document.y].toFixed(2)+'\n';parent.document.y++;}
document.checkoutform.order.value=parent.document.ordercontents+',';document.checkoutform.order.value=replace(document.checkoutform.order.value,',','');
}

if (parent.document.total!='TBA') {
	document.checkoutform.total.value=parent.document.total.toFixed(2);
	document.checkoutform.freight.value=parent.document.freight.toFixed(2);
	document.checkoutform.discount.value=parent.document.discount.toFixed(2);
	document.checkoutform.gst.value=(parent.document.total/11).toFixed(2);
	// parent.document.totalex;
}

if (parent.document.subtotal==0) {alert('Your shopping cart is empty!\n\nPlease click on a Recorder or Accessories link above,         \nselect your purchase, and click \'Add to cart.\'');return false;}

if (document.checkoutform.name.value=="") {alert('Please enter a contact name         ');document.checkoutform.name.focus();return false;}
if (document.checkoutform.company.value=="") {alert('Please enter your company name         ');document.checkoutform.company.focus();return false;}

if (document.checkoutform.phone.value=="" && document.checkoutform.email.value=="") {alert('Please enter your phone number or email address.          ');document.checkoutform.email.focus();return false;}

if (document.checkoutform.address.value=="") {alert('Please enter your delivery address.         ');document.checkoutform.address.focus();return false;}
if (document.checkoutform.suburb.value=="") {alert('Please enter your suburb.         ');document.checkoutform.suburb.focus();return false;}
if (document.checkoutform.state.value=="der") {alert('Please select your state.         ');document.checkoutform.state.focus();return false;}
if (document.checkoutform.postcode.value=="") {alert('Please enter your postcode.         ');document.checkoutform.postcode.focus();return false;}

if (document.checkoutform.phone.value!="") {return dv(thisform);}
if (document.checkoutform.email.value!="") {return ev(thisform);}

//-----------alert('validation done');

//-----ok - it works tight, but the form still ditches out here - proved by putting the alert in. it ignores anything else after the 'return dv...'.
//-----removing the 'returns' just above lets it go through to the alert, but it doesn't validate either? so maybe i need to do a similar line like XXX below??

} //-----end function validate()


// online time clock functions

function loopF () { // calculated in whole seconds
    clock+=1;hours=Math.floor(clock/60/60);minutes=Math.floor(clock/60)-(hours*60);seconds=Math.round(clock-(minutes*60)-(hours*60*60)); // update loop seconds, calc
    if (hours>999) {hours=hours-1000;}if (hours>99) {hours=hours-100;}if (hours<10) {hours='0'+hours;} // style for display after cutting off extra hours digits (breaks at 10,000 hours)
    if (minutes<10) {minutes='0'+minutes;} // style for display
    if (seconds<10) {seconds='0'+seconds;} else if (seconds>59) {seconds='00'} // style for display

    numbers=''+hours+minutes+seconds;
    nx=0;while (nx<6) { // for each number
        if (document.getElementById('n'+nx).innerHTML!=numbers.substr(nx,1)) { // it's different, change it
            document.getElementById('f'+nx).style.display='inline';
            setTimeout('document.getElementById("f'+nx+'").style.display="none";',70);
            document.getElementById('n'+nx).innerHTML=numbers.substr(nx,1);
        }
        nx++;
    }
}

var nonNaughty=/[^0-9,a-z,A-Z,\+\-& ]/gi; // keeps numbers, letters, ampersand, plus and space. for hyphens add this: \- but not if swapping url spaces for hyphens

function editSaveLogF(thisLog,thisLogId) { //
    if (thisLog.value=='EDIT') { // get ready to edit this log
        thisLog.value='SAVE'; thisLog.style.backgroundColor='rgb(249,216,93)';
        dump=document.getElementById('l'+thisLogId).innerHTML;
        document.getElementById('l'+thisLogId).innerHTML='<input type="text" maxlength="100" style="width:400px;" id="e'+thisLogId+'" value="'+dump+'" />'; // put a text input in the span
        document.getElementById('e'+thisLogId).select(); // pre-select it for easy editing
    } else { // has been edited, now save it
        thisLog.value='EDIT'; thisLog.style.backgroundColor='rgb(220,220,220)';
        name=document.getElementById('e'+thisLogId).value.replace(nonNaughty, "");
        document.getElementById('doFrame').src='/do.php?edit='+thisLogId+'&Name='+escape(name);
        document.getElementById('l'+thisLogId).innerHTML=name;
    }
}

function startStopF() {
    if (logId!='0') { // there's already a selected log 
        if (typeof timer!=='undefined') { // was running. STOP it. show start.
            clearInterval(timer);
            timer=undefined;
            document.getElementById('doFrame').src='/do.php?stop='+logId+'&clock='+clock+'&fill='+Math.ceil(10000*Math.random());; // recognised, and records
            document.getElementById('startStopB').style.backgroundColor='rgb(28,179,73)';
            document.getElementById('startStopB').style.borderColor='rgb(25,150,57)';
            document.getElementById('startStopB').innerHTML='START';
        } else { // wasn't running. START it. show stop.
            if (!autoStartTimer) { // the db record hasn't been started
                document.getElementById('doFrame').src='/do.php?start='+logId+'&fill='+Math.ceil(10000*Math.random());
            } else {
                autoStartTimer=false;
            }
            timer=setInterval(loopF,1000);
            document.getElementById('startStopB').style.backgroundColor='rgb(245,20,20)';
            document.getElementById('startStopB').style.borderColor='rgb(205,5,5)';
            document.getElementById('startStopB').innerHTML='STOP';
        }
    } else { // no log selected. new user or something wrong
        alert('Welcome!\n\nPlease click the ADD NEW LOG button before clicking start.');
    }
}

function deleteLogF(thisLogId) {
    if (confirm('Are you sure you want to permanently delete this log?')) {
        document.getElementById('doFrame').src='/do.php?del='+thisLogId+'&fill='+Math.ceil(10000*Math.random());
    }
}

function addLogF() { // create another one and refresh page (or through js?)
    document.getElementById('doFrame').src='/do.php?add'+'&clock='+clock+'&fill='+Math.ceil(10000*Math.random());
}

function selectLogF(thisLog,thisLogId) {
    logId=thisLogId;
    document.getElementById('doFrame').src='/do.php?get='+logId+'&fill='+Math.ceil(10000*Math.random());
    if (document.getElementById('selected')) {
        document.getElementById('selected').id='notselected';
    }
    thisLog.id='selected';
}

function cItF() { // this is because IE can't handle it inside do.php
    clearInterval(timer);
    timer=undefined;
}

function runningF() {
    if (typeof timer!=='undefined') {
        return true;
    } else {
        return false;
    }
}

