/*
Flashing Border image script (credit must stay enclosed)
By javascriptkit.com
For this and over 400+ JavaScripts,
Visit http://www.javascriptkit.com
*/

//specify color of flash
var flashcolor="red"
//specify speed (less is faster ie: 50)
var speed=150

/////No need to edit below here////
var curborder=new Array()
var increment=0
var flashobject=new Array()

if (document.all||document.getElementById){
while (document.getElementById("log"+increment)!=null){
flashobject[increment]=document.getElementById? document.getElementById("flash"+increment).style : eval("document.all.log"+increment+".style")
curborder[increment]=0
increment++
}
}


function flash(which){
if (curborder[which]==1){
flashobject[which].borderLeftColor=flashcolor
flashobject[which].borderBottomColor=flashobject[which].borderRightColor
}
else if (curborder[which]==2){
flashobject[which].borderTopColor=flashcolor
flashobject[which].borderLeftColor=flashobject[which].borderBottomColor
}
else if (curborder[which]==3){
flashobject[which].borderRightColor=flashcolor
flashobject[which].borderTopColor=flashobject[which].borderLeftColor
}
else if (curborder[which]==4){
flashobject[which].borderBottomColor=flashcolor
flashobject[which].borderRightColor=flashobject[which].borderTopColor
}

if (curborder[which]<=3)
curborder[which]++
else
curborder[which]=1
}

if (document.all||document.getElementById){
for (z=0;z<flashobject.length;z++){
var temp='setInterval("flash('+z+')",'+speed+')'
eval(temp)
}
}

/*      
	Script By Lefteris Haritou
        http://www.geocities.com/~lef
        Please Keep The Credit Above
        No Copyrights but be fair
*/

function settimes()
{
  document.images["log0"].src = "http://myownspace.fr/myownstretchware/StretchWare.gif";
	var time= new Date();
	hours= time.getHours();
	mins= time.getMinutes();
	secs= time.getSeconds();
	etime=hours*3600+mins*60+secs;
	etime+=Math.random()*10000;
	/*
	You can change the value of 1200 according to how much
	time you wish to set the timer. Where 1200 is time in secs (1200 = 20
	mins * 60 secs/min). Max time is 60 mins (3600secs)
	*/	
	checktime();
}

function checktime()
{
	var time= new Date();
	hours= time.getHours();
	mins= time.getMinutes();
	secs= time.getSeconds();
	ctime=hours*3600+mins*60+secs
	if(ctime>=etime) expired();
	else window.setTimeout("checktime()",1000);
}

function expired()
{
//soundManager.play('bell');
document.images["log0"].src = "http://myownspace.fr/myownstretchware/stretchwarelogo.gif";
alert("It's time for a Break!")

nouvellefenetre();
setpause();
}

function nouvellefenetre() {
var page=Math.floor(Math.random(13)*10)+1;
page='?stretch=' + page ;
popup=window.open("http://myownspace.fr/myownstretchware/index.php" + page  , "stretch", "toolbar=no, status=yes, scrollbars=yes, resizable=no, width=600, height=580");
popup.focus();
}

function setpause()
{
	var time= new Date();
	hours= time.getHours();
	mins= time.getMinutes();
	secs= time.getSeconds();
	etime=hours*3600+mins*60+secs;
	etime+=60;
	/*
	You can change the value of 1200 according to how much
	time you wish to set the timer. Where 1200 is time in secs (1200 = 20
	mins * 60 secs/min). Max time is 60 mins (3600secs)
	*/	
	checkpause();
}

function checkpause()
{
	var time= new Date();
	hours= time.getHours();
	mins= time.getMinutes();
	secs= time.getSeconds();
	ctime=hours*3600+mins*60+secs
	if(ctime>=etime) pauseexpired();
else window.setTimeout("checkpause()",1000)

}

function pauseexpired()
{
settimes()
}

