// OPEN WINDOW PAGE PRINCIPALE ---------
function yerso_news(theurl)
{
if((navigator.appVersion.indexOf("Win") != -1)  && (navigator.appName.indexOf("Netscape") != -1))
{
window.open('news_n.html','','scrollbars=yes,width=309,height=300');
}
else if (navigator.appVersion.indexOf("Macintosh") != -1){
window.open('news_n.html','','scrollbars=yes,width=309,height=300');
}
  else {
	  //window.open('toto.html','_blank','toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, copyhistory=0, menuBar=0, width=300, height=300');
	  //window.open('news.html','news','scrollbars=yes,width=309,height=300');
	  openIT(theurl,'news','news',300,300,'center','center')
}
}

function yersonews_a(theurl)
{
if((navigator.appVersion.indexOf("Win") != -1) && (navigator.appName.indexOf("Netscape") != -1)) {

window.open('news_na.html','','scrollbars=yes,width=309,height=300');
}
else if (navigator.appVersion.indexOf("Macintosh") != -1){
window.open('news_na.html','','scrollbars=yes,width=309,height=300');
}
  else {
openIT(theurl,'news_a','news_a',300,300,'center','center')
}
}

function yerso_contact(theurl)
{
if (navigator.appVersion.indexOf("Macintosh") != -1){
window.open('contact.html','','scrollbars=no,width=300,height=300');
}
  else {
openIT(theurl,'contact','contact',300,300,'center','center')
}
}

function yerso_distri(theurl)
{
if((navigator.appVersion.indexOf("Win") != -1) && (navigator.appName.indexOf("Netscape") != -1)) {
window.open('distri_n.html','','scrollbars=yes,width=320,height=300');
}
else if (navigator.appVersion.indexOf("Macintosh") != -1){
window.open('distri_n.html','','scrollbars=yes,width=309,height=300');
}
  else {
openIT(theurl,'distribution','distribution',300,300,'center','center')
}
}

function yersodistri_a(theurl)
{
if((navigator.appVersion.indexOf("Win") != -1) && (navigator.appName.indexOf("Netscape") != -1)) {
window.open('distri_na.html','','scrollbars=yes,width=320,height=300');
}
else if (navigator.appVersion.indexOf("Macintosh") != -1){
window.open('distri_na.html','','scrollbars=yes,width=309,height=300');
}
  else {
openIT(theurl,'distribution','distribution',300,300,'center','center')
}
}

function yerso_histoire(theurl)
{
if (navigator.appVersion.indexOf("Macintosh") != -1){
window.open('histoire.html','','scrollbars=no,width=750,height=250');
}
  else {
openIT(theurl,'histoire','histoire',750,250,'center','center')
}
}

function yersohistoire_ma(theurl)
{
if (navigator.appVersion.indexOf("Macintosh") != -1){
window.open('histoire_ang.html','','scrollbars=no,width=750,height=250');
}
  else {
openIT(theurl,'history','history',750,250,'center','center')
}
}

function yerso_credit(theurl)
{
if (navigator.appVersion.indexOf("Macintosh") != -1){
window.open('credits.html','','scrollbars=no,width=300,height=360');
}
  else {
openIT(theurl,'credits','credits',300,350,'center','center')
}
}

function yerso_down(theurl)
{
if (navigator.appVersion.indexOf("Macintosh") != -1){
window.open('down.html','','scrollbars=no,width=300,height=300');
}
  else {
openIT(theurl,'MP3','mp3',300,300,'center','center')
}
}

function yerso_livre(theurl)
{
	if((navigator.appVersion.indexOf("Win") != -1)  && (navigator.appName.indexOf("Netscape") != -1)){
		window.open('php/guestbook.php','','scrollbars=yes,width=480,height=430');
	}
	else if (navigator.appVersion.indexOf("Macintosh") != -1){
			window.open('php/guestbook.php','','scrollbars=yes,width=480,height=430');
	}
	else {
		openIT(theurl,'Livre','livre',450,430,'center','center')
	}
}


function yerso_m_award(theurl) // ouvre la page 1 de photos des amenian music award
{
if (navigator.appVersion.indexOf("Macintosh") != -1){
window.open('m_award_1.html','','scrollbars=no,width=570,height=450');
}
  else {
openIT(theurl,'ama1','grammyaw',570,450,'center','center')
}
}

function yerso_addguest(theurl)
{
if (navigator.appVersion.indexOf("Macintosh") != -1){
window.open('addguest.html','','scrollbars=no,width=258,height=328');
}
  else {
openIT(theurl,'Livre','livre',450,430,'center','center')
}
}



// OPEN WINDOW TEXT ALL ---------
function yerso_rencont(theurl)
{
if((navigator.appVersion.indexOf("Win") != -1) && (navigator.appName.indexOf("Netscape") != -1)) {
window.open('rencontre_n.html','','scrollbars=yes,width=320,height=300');
}
else if (navigator.appVersion.indexOf("Macintosh") != -1){
window.open('rencontre_n.html','','scrollbars=yes,width=309,height=300');
}
  else {
openIT(theurl,'rencontre','rencontre',300,300,'center','center')
}
}

function yersorencont_a(theurl)
{
if((navigator.appVersion.indexOf("Win") != -1) && (navigator.appName.indexOf("Netscape") != -1)) {
window.open('rencontre_na.html','','scrollbars=yes,width=320,height=300');
}
else if (navigator.appVersion.indexOf("Macintosh") != -1){
window.open('rencontre_na.html','','scrollbars=yes,width=309,height=300');
}
  else {
openIT(theurl,'rencontre','rencontre',300,300,'center','center')
}
}

function yerso_zartong(theurl)
{
if((navigator.appVersion.indexOf("Win") != -1) && (navigator.appName.indexOf("Netscape") != -1)) {
window.open('zartong_n.html','','scrollbars=yes,width=320,height=300');
}
else if (navigator.appVersion.indexOf("Macintosh") != -1){
window.open('zartong_n.html','','scrollbars=yes,width=309,height=300');
}
  else {
openIT(theurl,'zartong','zartong',300,300,'center','center')
}
}

function yersozartong_a(theurl)
{
if((navigator.appVersion.indexOf("Win") != -1) && (navigator.appName.indexOf("Netscape") != -1)) {
window.open('zartong_n.html','','scrollbars=yes,width=320,height=300');
}
else if (navigator.appVersion.indexOf("Macintosh") != -1){
window.open('zartong_n.html','','scrollbars=yes,width=309,height=300');
}
  else {
openIT(theurl,'zartong','zartong',300,300,'center','center')
}
}

function yerso_duo(theurl)
{
if((navigator.appVersion.indexOf("Win") != -1) && (navigator.appName.indexOf("Netscape") != -1)) {
window.open('duo_n.html','','scrollbars=yes,width=320,height=300');
}
else if (navigator.appVersion.indexOf("Macintosh") != -1){
window.open('duo_n.html','','scrollbars=yes,width=309,height=300');
}
  else {
openIT(theurl,'duo','duo',300,300,'center','center')
}
}

function yersoduo_a(theurl)
{
if((navigator.appVersion.indexOf("Win") != -1) && (navigator.appName.indexOf("Netscape") != -1)) {
window.open('duo_na.html','','scrollbars=yes,width=320,height=300');
}
else if (navigator.appVersion.indexOf("Macintosh") != -1){
window.open('duo_na.html','','scrollbars=yes,width=309,height=300');
}
  else {
openIT(theurl,'duo','duo',300,300,'center','center')
}
}

// OPEN WINDOW ----------
function openIT(theurl,wname,tit,W,H,Wx,Wy) {
	
	//theurl= theurl;
	//wname=wname;
	//W=W;
	//H=H;
	//Wx=Wx;
	//Wy=Wy;
	windowCERRARa 		= "croix.gif"
	windowCERRARd 		= "croix.gif"
	windowCERRARo 		= "croix.gif"
	windowTIT 	    	= "<img src='images/"+ tit +".gif'>"
	windowBORDERCOLOR   	= "white"
	windowBORDERCOLORsel	= "white"
	windowTITBGCOLOR    	= "white"
	windowTITBGCOLORsel 	= "white"
	
	openchromeless(theurl, wname, W, H, windowCERRARa, windowCERRARd, windowCERRARo, windowTIT, windowBORDERCOLOR, windowBORDERCOLORsel, windowTITBGCOLOR, windowTITBGCOLORsel,Wx,Wy)
}



function openchromeless(theURL, wname, W, H, windowCERRARa, windowCERRARd, windowCERRARo, windowTIT, windowBORDERCOLOR, windowBORDERCOLORsel, windowTITBGCOLOR, windowTITBGCOLORsel,Wx,Wy) {
	
	<!-- chemin de la page chromeless.html -->
	var pathchrom = "chromeless.html"
	
	var windowW = W;
	var windowH = H;
	//////
	if (Wx == "center")
	{
    var windowX = Math.ceil( (window.screen.width  - windowW) / 2  );
	}
	else
	{
	var windowX = Wx;
	}
	if (Wy == "center")
	{
	var windowY = Math.ceil( (window.screen.height - windowH) / 2  );
	}
	else
	{
	var windowY = Wy;
	}
	/////
	if (navigator.appVersion.indexOf("Macintosh") != -1)
	isie=false
	else
	if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion)>=4) isie=true
	else isie=false

	if (isie) { H=H+20+2; W=W+2; }

	s = ",width="+W+",height="+H;
	if (isie) {
		var parameters = escape( theURL+"|"+windowCERRARa+"|"+windowCERRARd+"|"+windowCERRARo+"|"+windowTIT+"|"+windowBORDERCOLOR+"|"+windowBORDERCOLORsel+"|"+windowTITBGCOLOR+"|"+windowTITBGCOLORsel)

		/*splashWin = window.open( "" , wname, "fullscreen=yes,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0");
		splashWin.resizeTo( Math.ceil( W )       , Math.ceil( H ) );
		splashWin.moveTo  ( Math.ceil( windowX ) , Math.ceil( windowY ) ) 
		splashWin.document.open("text/html", "replace");
		splashWin.document.write("<html><style type='text/css'>\n");
		splashWin.document.write("body                  { border: 1px solid #000000; overflow: hidden; margin: 0pt;}");
		splashWin.document.write("#stillloadingDiv 	{ position: absolute; left: 0px; top: 0px; width: 100%px; height: 19px; z-index: 1; background-color: #C0C0C0; layer-background-color: #C0C0C0; clip:rect(0,100%,19,0);}");
		splashWin.document.write("</style>\n");
		splashWin.document.write("<body onload=\"top.document.location.replace('"+pathchrom+"?"+parameters+"')\" TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll='no'>");
		splashWin.document.write("<div id=stillloadingDiv><table width=100% height=22 cellspacing=0 cellpadding=0><tr><td align=left valign=middle width=100%><FONT size=1 face=verdana color=#000000>&nbsp;&nbsp;c h a r g e m e n t  . . .</font></td></tr></table></div>");
		splashWin.document.write("</body></html>");
		splashWin.document.close();
		*/
		var splashWin = window.open(theURL, wname, "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1"+s, true);
		
	}
	else	var splashWin = window.open(theURL, wname, "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1"+s, true);

	splashWin.focus();
}

/////////////////////////////////////////////////////////////// CHROMELESS OPEN WINDOW //////

function openwinnowin(theurl, wname, W, H) {
	if (is.ie) r = ",resizable=0"
	else       r = ",resizable=1"
	s = ",width="+W+",height="+H;

	var windowW = W;
	var windowH = H;
	var windowX = Math.ceil( (window.screen.width  - windowW) / 2 );
	var windowY = Math.ceil( (window.screen.height - windowH) / 2 );
	alert("AVANT OPEN");
	var splashWin = window.open("", wname, "fullscreen=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0"+r+s)

	splashWin.resizeTo( Math.ceil( W )       , Math.ceil( H ) )
	splashWin.moveTo  ( Math.ceil( windowX ) , Math.ceil( windowY ) )

	splashWin.document.open("text/html", "replace");
	splashWin.document.write("<html><style type='text/css'>\n");
	splashWin.document.write("#lineLDiv 		{ position: absolute; left:         0px; top:                  0px; width:     1px; height: "+H+"px; z-index: 2; background-color: #000000; layer-background-color: #000000; clip:rect(0,1,"+H+",0);}");
	splashWin.document.write("#lineRDiv		{ position: absolute; left: "+(W-1)+"px; top:                  0px; width:     1px; height: "+H+"px; z-index: 2; background-color: #000000; layer-background-color: #000000; clip:rect(0,1,"+H+",0);}");
	splashWin.document.write("#lineBDiv 		{ position: absolute; left:         0px; top: "+         (H-1)+"px; width: "+W+"px; height:     1px; z-index: 2; background-color: #000000; layer-background-color: #000000; clip:rect(0,"+W+",1,0);}");
	splashWin.document.write("#lineTDiv 		{ position: absolute; left:         0px; top:                  0px; width: "+W+"px; height:     1px; z-index: 2; background-color: #000000; layer-background-color: #000000; clip:rect(0,"+W+",1,0);}");
	splashWin.document.write("#stillloadingDiv 	{ position: absolute; left:         0px; top: "+Math.ceil(H/2)+"px; width: "+W+"px; height: "+H+"px; z-index: 1; background-color: #C0C0C0; layer-background-color: #C0C0C0; clip:rect(0,"+W+",19,0);}");
	splashWin.document.write("</style>\n");
	splashWin.document.write("<body onload=\"self.document.location.href='"+theurl+"'\" TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll='no' style='border: 0px; overflow: hidden; margin: 0pt;'>");
	splashWin.document.write("<div id='lineLDiv'></div>");
	splashWin.document.write("<div id='lineRDiv'></div>");
	splashWin.document.write("<div id='lineBDiv'></div>");
	splashWin.document.write("<div id='lineTDiv'></div>");
	splashWin.document.write("<div id=stillloadingDiv><table width=100% height=22 cellspacing=0 cellpadding=0><tr><td align=left valign=middle width=100%><FONT size=1 face=verdana color=#000000>&nbsp;&nbsp; c h a r g e m e n t . . .</font></td></tr></table></div>");
	splashWin.document.write("</body></html>");
	splashWin.document.close();

	splashWin.focus();

	eval(wname+"=splashWin")
}




var isinit     = false;
var mywindowok = true;

var param = parent.location.search.toString()
    param = unescape( param.substring(1, param.length) )

if ( param.split("|").length>=9 ) {
	theURL 	    	    = param.split("|")[0]
	windowCERRARa 	    = param.split("|")[1]
	windowCERRARd 	    = param.split("|")[2]
	windowCERRARo 	    = param.split("|")[3]
	windowTIT 	    = param.split("|")[4]
	windowBORDERCOLOR   = param.split("|")[5]
	windowBORDERCOLORsel= param.split("|")[6]
	windowTITBGCOLOR    = param.split("|")[7]
	windowTITBGCOLORsel = param.split("|")[8]
}
else {  // For debug
	theURL="about:blank"
	windowCERRARa 		= "img/close_a.gif"
	windowCERRARd 		= "img/close_a.gif"
	windowCERRARo 		= "img/close_a.gif"
	windowTIT 	    	= ""
	windowBORDERCOLOR   	= "#000000"
	windowBORDERCOLORsel	= "#FF8A00"
	windowTITBGCOLOR    	= "#d7dcd9"
	windowTITBGCOLORsel 	= "#ffffff"
}

var windowCERRARImg_a = new Image(); windowCERRARImg_a.src=windowCERRARa;
var windowCERRARImg_d = new Image(); windowCERRARImg_d.src=windowCERRARd;
var windowCERRARImg_o = new Image(); windowCERRARImg_o.src=windowCERRARo;


function whaitborders() {
	if ( parent.chromewinb && parent.chromewinl && parent.chromewinr ) {
		parent.chromewinb.document.bgColor=windowBORDERCOLOR
		parent.chromewinl.document.bgColor=windowBORDERCOLOR
		parent.chromewinr.document.bgColor=windowBORDERCOLOR
	} else {
		setTimeout('whaitborders()', 100);
	}
}
whaitborders()

//////////////////////////////////////////////////////////////// MOUSE MOVE //////

function mouseSTATUS() {
	this.x       = null;
	this.y       = null;
	this.bt      = "up";
	this.oldx    = null;
	this.oldy    = null;
	this.dx      = null;
	this.dy      = null;
	this.screeny = null;
	this.screenx = null;

	this.element = null;
	this.event   = null;
}

var mouse = new mouseSTATUS();

function actualizateMouseSTATUS(e) {
	if (!e) var e = event
	if ( (e.type=="mousedown" || e.type=="mouseup") && e.button!=1) return true

	var x=e.x+document.body.scrollLeft
	var y=e.y+document.body.scrollTop

	mouse.x   = x;
	mouse.y   = y;

	     if ( e.type == "mousedown" ) mouse.bt = "down";
	else if ( e.type == "mouseup" )   mouse.bt = "up";

	if (window.event) {
		mouse.screenx=window.event.screenX;
		mouse.screeny=window.event.screenY;
	} else {
		mouse.screenx=-1;
		mouse.screeny=-1;
	}

}


function initMouseEvents() {
	document.onmousedown = actualizateMouseSTATUS
	document.onmousemove = actualizateMouseSTATUS
	document.onmouseup   = actualizateMouseSTATUS
	document.onselectstart = selectstart
	document.ondragstart   = new Function("actualizateMouseSTATUS(event); return false;")
}

function selectstart(){
	if ( event.srcElement.tagName != "INPUT" && event.srcElement.tagName != "TEXTAREA") { return false; } 
	else { mouse.bt="up"; return true; }
}

initMouseEvents()

//////////////////////////////////////////////////////////////// WINDOW DRAG //////

var mywindowbt    ="up";
var wincloseSTATUS="up";

var ofx=0;
var ofy=0;
var opx=0;
var opy=0;
var px=0;
var py=0;

var wcpx1=-1, wcpy1=-1;
var wcpx2=-1, wcpy2=-1;

var wclosechanged = false;

function initToMoveWin() { 
	if (mywindowok) {
		if (wincloseSTATUS=="up" && ( mywindowbt=="up" || mywindowbt=="over") ) {
			if (isinit) {
				wcpx1 = document.all["mywindowCLOSE"].style.pixelLeft=document.body.clientWidth-18
				wcpy1 = document.all["mywindowCLOSE"].style.pixelTop =2
				wcpx2 = wcpx1 + 11 - 1 
				wcpy2 = wcpy1 + 11 - 1
				if ( mouse.x >= wcpx1 && mouse.x <= wcpx2 && mouse.y >= wcpy1 && mouse.y <= wcpy2) { 
					if (wclosechanged == false) {
						document.all["mywindowCLOSE"].document.images["closewin"].src=windowCERRARImg_o.src
						wclosechanged = true
					}
						
				} else if (wclosechanged == true) {
					document.all["mywindowCLOSE"].document.images["closewin"].src=windowCERRARImg_d.src
					wclosechanged = false
				}
			}
		}

		     if (   mouse.y <= 22 && mouse.y >= 1   && mywindowbt == "up"   && mouse.bt =="up"    ) { mywindowbt = "over" }
		else if ( ( mouse.y  > 22 || mouse.y <  1 ) && mywindowbt == "over" && mouse.bt =="up"    ) { mywindowbt = "up"   }
		else if (   mouse.y <= 22 && mouse.y >= 1   && mywindowbt == "over" && mouse.bt == "down" ) { 
			self.window.focus();
	
			if ( mouse.x >= wcpx1 && mouse.x <= wcpx2 && mouse.y >= wcpy1 && mouse.y <= wcpy2 ) { 
				wincloseSTATUS="down"
				document.all["mywindowCLOSE"].document.images["closewin"].src=windowCERRARImg_a.src
			} else {
				document.all["mywindowTITLE"].style.backgroundColor = windowTITBGCOLORsel
				document.body.style.borderColor = windowBORDERCOLORsel
				parent.chromewinb.document.bgColor=windowBORDERCOLORsel
				parent.chromewinl.document.bgColor=windowBORDERCOLORsel
				parent.chromewinr.document.bgColor=windowBORDERCOLORsel
				ofx =  mouse.x;
				ofy =  mouse.y;
				opx =  mouse.x;
				opy =  mouse.y;
			}	
			mywindowbt="down"; 
		}
		else if ( mouse.bt =="up" && mywindowbt == "down" ) { 
			mywindowbt="up"; 
			ofx=0; 
			ofy=0; 
			opx=0; 
			opy=0; 

			if ( mouse.x >= wcpx1 && mouse.x <= wcpx2 && mouse.y >= wcpy1 && mouse.y <= wcpy2 && wincloseSTATUS=="down" ) { top.window.close() }

			wincloseSTATUS="up"
		
			if ( document.all["mywindowTITLE"] ) {
				document.all["mywindowTITLE"].style.backgroundColor = windowTITBGCOLOR
				document.body.style.borderColor = windowBORDERCOLOR
				parent.chromewinb.document.bgColor=windowBORDERCOLOR
				parent.chromewinl.document.bgColor=windowBORDERCOLOR
				parent.chromewinr.document.bgColor=windowBORDERCOLOR
			}

		}
		else if ( mywindowbt == "down" && wincloseSTATUS == "up") {
			var m_scrx = mouse.screenx;
			var m_scry = mouse.screeny;
			opx = px + ofx - m_scrx;
			opy = py + ofy - m_scry;
			px = m_scrx - ofx;
			py = m_scry - ofy;
			top.window.moveTo(px , py);
		}
	}
	setTimeout('initToMoveWin()',20);
}
initToMoveWin()

//////////////////////////////////////////////////////////////// WRITE TITLE //////

function init() {
	document.all["mywindowTITLE"].innerHTML='<table width=100% height=20 border=0 cellpadding=0 cellspacing=0><tr><td valign=middle align=left>'+windowTIT+'</td></tr></table>'
	document.all["mywindowTITLE"].style.backgroundColor  = windowTITBGCOLOR
	document.all["mywindowCLOSE"].document.images["closewin"].src=windowCERRARImg_d.src

	setTimeout('parent.main.location.replace("'+theURL+'")',200)

	isinit=true
}
// FIN OPEN WINDOW  ----------
