// display decision alert box
function decision(message, url){
	if(confirm(message)) location.href = url;
}

// open browser window
function openPopUp(url, windowName, w, h, scrollbar) {

           var winl = (screen.width - w) / 2;
           var wint = (screen.height - h) / 2;
           winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scrollbar ;
		   win = window.open(url, windowName, winprops);
           if (parseInt(navigator.appVersion) >= 4) { 
              	win.window.focus(); 
           } 
}
function getImage(imageName)
{
		document.getElementById('img').src = imageName;
}
function jumpMenu(target,object,restore){ 
  eval(target+".location='"+object.options[object.selectedIndex].value+"'");
  if (restore) object.selectedIndex=0;
}



/* Fonctions recuperees pour afficher et masquer les boutons*/
/* Ces fonctions ne sont pas utilisees*/
/*function affiche_masque (id_cadre, vis) {
    div_actif = document.getElementById(id_cadre);
    if (vis == 0) {
        div_actif.style.display = 'none';
    }
    else {
        div_actif.style.display = 'block';
    }
}

function affiche_masque_panier(id_cadre, id_bt_aff, id_bt_masq, vis_cadre) {
    if (vis_cadre == 0) {
    	vis_inverse = 1;
    }
    else {
    	vis_inverse = 0;
    }
    affiche_masque (id_cadre, vis_cadre);
    affiche_masque (id_bt_masq, vis_cadre);
    affiche_masque (id_bt_aff, vis_inverse);    
}
*/


/* Fonction pour afficher et masquer le panier */
var buy = 0

function affich1 () {
	if (basket.innerHTML == "View basket") {
		loadwindow("http://www.google.com",160,100)		
		basket.innerHTML="Hide basket"
		//window.open("index.php?act=viewbasket")
		document.getElementById("cframe1").src="index.php?act=viewbasket"
	}
	else {
		closeit();
		basket.innerHTML="View basket"
		//window.open("index.php?act=hidebasket")
		document.getElementById("cframe1").src="index.php?act=hidebasket"
	}
}

/* Fonction pour le bouton achat*/
function BuyButton () {
	alert('This product has been added into your cart')
	document.getElementById("cframe1").src="index.php?act=viewbasket"
	document.addtobasket.submit()
}


/* Ancienne fonction d'affichage et masquage du panier*/
function affich (nb) {
	if (nb == 0) {
		panier.style.display = '';
		maskCart.style.display = '';
		affichCart.style.display = 'none';
		loadwindow("http://www.google.com",160,100)		
		nb = 1;
	}
	else {
		panier.style.display = 'none';
		maskCart.style.display = 'none';
		affichCart.style.display = '';
		nb = 0;
		
	}
}

function mask () {
	panier.style.display = 'none';
	maskCart.style.display = 'none';
	affichCart.style.display = '';

}

/*******************************/
/****** Fonctions pour le scroller des categories****/

var speed=5

iens6=document.all||document.getElementById
ns4=document.layers

var tjstimer=0;
if (iens6){
//document.write('<div id="boitenamani" style="position:relative;width:618px;height:125px;overflow:hidden;border:2px ridge white">') // http://www.namani.net 
//document.write('<div id="content" style="position:relative;width:900px;left:0px;top:0px;">')
}
//alpha progressif
var TabAlpha=new Array();
TabAlpha.length=7;		// 5 images alpha A MODIFIER SI PLUS D'IMAGES
for (var alphaI=0;alphaI<TabAlpha.length;alphaI++) {
	TabAlpha[alphaI]=-1;
}


function namhaut(){

if (window.moveupvar) clearTimeout(moveupvar)
if (iens6&&parseInt(crossobj.style.left)>=(contentwidth*(-1)+100))
crossobj.style.left=parseInt(crossobj.style.left)-speed+"px"
else if (ns4&&crossobj.left>=(contentwidth*(-1)+100))
crossobj.left-=speed
dir=1
movedownvar=setTimeout("namhaut()",20)
} // http://www.namani.net 

function nambas(){
if (window.movedownvar) clearTimeout(movedownvar)
if (iens6&&parseInt(crossobj.style.left)<=0)
crossobj.style.left=parseInt(crossobj.style.left)+speed+"px"
else if (ns4&&crossobj.left<=0)
crossobj.left+=speed
dir=2
moveupvar=setTimeout("nambas()",20)
}
function stopnamani(){
if (window.moveupvar) clearTimeout(moveupvar)
if (window.movedownvar) clearTimeout(movedownvar)
}
function topnamani(){
stopnamani()
if (iens6)
crossobj.style.left=0+"px"
else if (ns4)
crossobj.left=0
}
function bottomnamani(){
stopnamani()
if (iens6)
crossobj.style.left=0+"px"
else if (ns4)
crossobj.left=0
}
function namanibouge(){
if (iens6)
contentwidth=crossobj.offsetWidth
else if (ns4)
document.nsboitenamani.document.nsnamani.visibility="show"
}
function direction()
{
	if (dir==1)
	 namhaut()
	if (dir==2) 
	 nambas()
}
	
function ModifAlpha(no,alpha){
	if (document.images["img"+no]) {
		if (document.images["img"+no].filters) {
			TabAlpha[no]=alpha;
			if (tjstimer==0) {setTimeout("tjstimerAlpha()",30)}
		}
	}
}

function tjstimerAlpha() {
	var opacity=0;
	for (var alphaI=0;alphaI<TabAlpha.length;alphaI++) {
		if (TabAlpha[alphaI]!=-1) {
			opacity =TabAlpha[alphaI] - document.images["img"+alphaI].filters.alpha.opacity;
			//opacity =TabAlpha[alphaI] - document.images["img"+alphaI].filters.item("DXImageTransform.Microsoft.Alpha").opacity;
			
			//window.status=opacity
			//window.status=document.images["img"+alphaI].filters.item("DXImageTransform.Microsoft.Alpha").opacity
			//opacity =TabAlpha[alphaI] -.filters.item("DXImageTransform.Microsoft.Alpha").opacity 
			// 10;
			//opacity =TabAlpha[alphaI] - opacinit;
			//alert(opacity)
			if (opacity!=0) {
				tjstimer=1;
				//var opac=Math.abs(opacity)/opacity * 3;
				
				
				//var myfilter="progid:DXImageTransform.Microsoft.BasicImage(opacity="+opac+") progid:DXImageTransform.Microsoft.Shadow(direction=225,color=#ff00ff,strength=5)"
				
				//eval("img"+alphaI+".style.filter=''")
				//document.images["img"+alphaI].filters.item("DXImageTransform.Microsoft.Alpha").opacity=Math.abs(opacity)/opacity * 3;
				//document.images["img"+alphaI].style.filter=myfilter
				document.images["img"+alphaI].filters.alpha.opacity+=Math.abs(opacity)/opacity * 3;		
			} else {
				TabAlpha[alphaI]=-1
			}
		}
	}
	if (tjstimer==1) {setTimeout("tjstimerAlpha()",30);} else {tjstimer=0}
}

/**********  Fonctions pour le scroller des themes   *********/


var speed2=5

iens62=document.all || document.getElementById
ns42=document.layers

var tjstimer2=0;
if (iens62){
//document.write('<div id="boitenamani" style="position:relative;width:618px;height:125px;overflow:hidden;border:2px ridge white">') // http://www.namani.net 
//document.write('<div id="content" style="position:relative;width:900px;left:0px;top:0px;">')
}
//alpha progressif
var TabAlpha2=new Array();
TabAlpha2.length=7;		// 5 images alpha A MODIFIER SI PLUS D'IMAGES
for (var alphaI2=0;alphaI2<TabAlpha2.length;alphaI2++) {
	TabAlpha2[alphaI2]=-1;
}


function namhaut2(){

if (window.moveupvar2) clearTimeout(moveupvar2)
if (iens62&&parseInt(crossobj2.style.top)>=(contentwidth2*(-1)+100))
crossobj2.style.top=parseInt(crossobj2.style.top)-speed2+"px"
else if (ns42&&crossobj2.top>=(contentwidth2*(-1)+100))
crossobj2.top-=speed2
dir2=1
movedownvar2=setTimeout("namhaut2()",20)
} // http://www.namani.net 

function nambas2(){
if (window.movedownvar2) clearTimeout(movedownvar2)
if (iens62&&parseInt(crossobj2.style.top)<=0)
crossobj2.style.top=parseInt(crossobj2.style.top)+speed2+"px"
else if (ns42&&crossobj2.top<=0)
crossobj2.top+=speed2
dir2=2
moveupvar2=setTimeout("nambas2()",20)
}
function stopnamani2(){
if (window.moveupvar2) clearTimeout(moveupvar2)
if (window.movedownvar2) clearTimeout(movedownvar2)
}
function topnamani2(){
stopnamani2()
if (iens62)
crossobj2.style.top=0+"px"
else if (ns42)
crossobj2.top=0
}
function namanibouge2(){
if (iens62)
contentwidth2=crossobj2.offsetHeight
else if (ns4)
document.nsboitenamani2.document.nsnamani2.visibility="show"
}
function direction2()
{
	if (dir2==1)
	 namhaut2()
	if (dir2==2) 
	 nambas2()
}
	
function ModifAlpha2(no2,alpha2){
	if (document.images["img2"+no2]) {
		if (document.images["img2"+no2].filters) {
			TabAlpha2[no2]=alpha2;
			if (tjstimer2==0) {setTimeout("tjstimerAlpha2()",30)}
		}
	}
}


function tjstimerAlpha2() {
	var opacity2=0;
	for (var alphaI2=0;alphaI2<TabAlpha2.length;alphaI2++) {
		if (TabAlpha2[alphaI2]!=-1) {
			opacity2 =TabAlpha2[alphaI2] - document.images["img2"+alphaI2].filters.alpha.opacity;
			if (opacity2!=0) {
				tjstimer2=1;
				document.images["img2"+alphaI2].filters.alpha.opacity+=Math.abs(opacity2)/opacity2 * 3;		
			} else {
				TabAlpha2[alphaI2]=-1
			}
		}
	}
	if (tjstimer2==1) {setTimeout("tjstimerAlpha2()",30);} else {tjstimer2=0}
}

/*Fonction recuperees dans index.tpl */
var dragapproved=false
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

function iecompattest(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function drag_drop(e){
if (ie5&&dragapproved&&event.button==1){
document.getElementById("dwindow").style.left=tempx+event.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
document.getElementById("dwindow").style.left=tempx+e.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+e.clientY-offsety+"px"
}
}

function initializedrag(e){
offsetx=ie5? event.clientX : e.clientX
offsety=ie5? event.clientY : e.clientY
document.getElementById("dwindowcontent").style.display="none" //extra
tempx=parseInt(document.getElementById("dwindow").style.left)
tempy=parseInt(document.getElementById("dwindow").style.top)

dragapproved=true
document.getElementById("dwindow").onmousemove=drag_drop
}

function loadwindow(url,width,height){
if (!ie5&&!ns6)
window.open(url,"","width=width,height=height,scrollbars=1")
else{
document.getElementById("dwindow").style.display=''
document.getElementById("dwindow").style.width=initialwidth=width+"px"
document.getElementById("dwindow").style.height=initialheight=height+"px"
document.getElementById("dwindow").style.left="30px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30+"px" : iecompattest().scrollTop*1+30+"px"
//document.getElementById("cframe").src=url
}
}

function maximize(){
if (minrestore==0){
minrestore=1 //maximize window
document.getElementById("maxname").setAttribute("src","restore.gif")
document.getElementById("dwindow").style.width=ns6? window.innerWidth-20+"px" : iecompattest().clientWidth+"px"
document.getElementById("dwindow").style.height=ns6? window.innerHeight-20+"px" : iecompattest().clientHeight+"px"
}
else{
minrestore=0 //restore window
document.getElementById("maxname").setAttribute("src","max.gif")
document.getElementById("dwindow").style.width=initialwidth
document.getElementById("dwindow").style.height=initialheight
}
document.getElementById("dwindow").style.left=ns6? window.pageXOffset+"px" : iecompattest().scrollLeft+"px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset+"px" : iecompattest().scrollTop+"px"
}

function closeit(){
document.getElementById("dwindow").style.display="none"
basket.innerHTML="View basket"
document.getElementById("cframe1").src="index.php?act=hidebasket"
}

function stopdrag(){
dragapproved=false;
document.getElementById("dwindow").onmousemove=null;
document.getElementById("dwindowcontent").style.display="" //extra
}
