function checkparent (parentpage,level) {
	if (level==1)
	{
		if (!parent.document.getElementById('mainbody')) 
		{
			window.location=(parentpage) ;
		}
	}
	if (level==2)
	{
		if (!parent.parent.document.getElementById('mainbody')) 
		{
			window.location=(parentpage) ;
		}
	}
	if (level==3)
	{
		if (!parent.parent.parent.document.getElementById('mainbody')) 
		{
			window.location=(parentpage) ;
		}
	}
}
function openNewWindow(picturepath,wintitle) {
 OpenWindow=window.open('','mywin',
'left=300,top=80,width=600,height=600,toolbar=0,resizable=0');
OpenWindow.document.write('<TITLE>' + wintitle + '</TITLE>');
OpenWindow.document.write('<BODY >')

OpenWindow.document.write('<a href="../images/diadromes/crete.jpg" target="_blank"><img src="' + picturepath + '" align="top" alt="" /></a>')
OpenWindow.document.write('</BODY>')
OpenWindow.document.write('</HTML>')
}

function openNewWindowPhotos(picturespath) {
 OpenWindow=window.open(picturespath,'mywin',
'left=0,top=0,width=1024,height=768,toolbar=0,resizable=1');

}
function openNewWindowText(txt,w,h,l,t,wintitle) {
 OpenWindow=window.open('','mywin',
'left=' + l + ',top=' + t + ',width=' + w + ',height=' + h + ',toolbar=0,resizable=0');
OpenWindow.document.write('<TITLE>' + wintitle + '</TITLE>');
OpenWindow.document.write('<BODY >')

OpenWindow.document.write(txt)
OpenWindow.document.write('</BODY>')
OpenWindow.document.write('</HTML>')

}
function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function selectcurrentdate()
{
	var d = new Date();
ddlyear.selectedIndex=0;
ddlmonth.selectedIndex=d.getMonth();

}

function fillddldays()
{
	var i,valyear,valmonth,numdays;
	listdays=new Array();
	valyear = ddlyear.options[ddlyear.selectedIndex].value;
	valmonth = ddlmonth.options[ddlmonth.selectedIndex].value;
	numdays = 31;
	if (valmonth==4 || valmonth==6 || valmonth==9 || valmonth==11) {numdays = 30}
	if (valmonth==2) {numdays = daysInFebruary(valyear) }
	for (i=1;i<=numdays;i++)
	{
		listdays[i-1]= i + "|" + i;
	}
	ddlday.length=listdays.length;
	for(i=0;i<listdays.length;i++){ 
	  valeurs=listdays[i].split("|"); 
	  ddlday.options[i].text=valeurs[0];  
	//new item
	  ddlday.options[i].value=valeurs[1]; 
	//new item value
	 }
	 var d = new Date();
	 ddlday.selectedIndex=d.getDate()-1;
}
