var gblSelectedImage="NONE";

// Images
function diSwap(imgName, imgObj) { 
	if(typeof(window[imgObj])!="undefined")
		document[imgName].src = window[imgObj].src;	
}

function diSwapOn(imgName) { 
	// check if try on the current page selected image
	if(document[imgName].src.indexOf(",on")>0) {
		gblSelectedImage=imgName;	
		return;
	}

	if( (typeof(window[imgName + "_on"])!="undefined")
	&& (typeof(window[imgName + "_on"].src)!="undefined"))
	{
		diSwap(imgName, imgName + "_on");
	} else {
		diLoad(imgName); 
		diSwap(imgName, imgName + "_on");
	}
}

function diSwapOff(imgName) { 
	// check if try off the current page selected image
	if(gblSelectedImage==imgName) return;
	
	if( (typeof(window[imgName + "_off"])!="undefined")
	&& (typeof(window[imgName + "_off"].src)!="undefined"))
	{
		diSwap(imgName, imgName + "_off");
	} else {
		diLoad(imgName); 
		diSwap(imgName, imgName + "_off");
	}
}

function diLoad(imgName) { 
	if( typeof(document[imgName])!="undefined")
	{	
		var imgsrc = document[imgName].src;
		eval(imgName +"_on = new Image()");
		eval(imgName +"_off = new Image()");
		
		imgsrc=imgsrc.replace(",off",",on");
		eval(imgName +"_on.src =\""+imgsrc +"\"");			
		imgsrc=imgsrc.replace(",on",",off");
		eval(imgName +"_off.src =\""+imgsrc +"\"");
	}
}

// Tools
function dtPopup(target, width, height, style, wnd, otop, oleft)
{
	if(!width) width=600;
	if(!height) height=400;
	if(!wnd) wnd="_blank";
	if(!style) style="toolbar=yes,menubar=yes,resizable=yes,scrollbars=yes";
	
	if(typeof(otop) != "undefined") wtop=otop;
	else {
		wtop= (window.screen.availHeight - height  - 120) / 2 ;
		if(wtop>50) wtop-=40;
	}
	if(typeof(oleft) != "undefined") wleft=oleft;
	else wleft= (window.screen.availWidth - width) / 2;
	
	style +=",left="+wleft+",top="+wtop+",height="+height+",width="+width;
	window.open(target,wnd,style);	
}	

function dtPopImg(imgName) {
	if( typeof(document[imgName])!="undefined")	{			
		dtPopup(document[imgName].src);
	} else {
		alert("Image :"+imgName+" not found");
	}
}


// Raymond 2005-04-04
function DIY_Browser() {
 d=document;
 this.agent=navigator.userAgent.toLowerCase();
 this.major = parseInt(navigator.appVersion);
 this.dom=(d.getElementById)?1:0; // true for ie6, ns6
 this.ns=(d.layers);
 this.ns4up=(this.ns && this.major >=4);
 this.ns6=(this.dom&&navigator.appName=="Netscape");
 this.op=(this.agent.indexOf('opera')!=-1&&this.major<7);
 this.opera5=(this.agent.indexOf("Opera 5")>-1);
 this.ie=(d.all);
 this.ie4=(d.all&&!this.dom)?1:0;
 this.ie4up=(this.ie && this.major >= 4);
 this.ie5=(d.all&&this.dom);
 this.ie6=(this.agent.indexOf("msie 6")>-1 && this.dom && !this.opera5)?1:0;
 this.win=((this.agent.indexOf("win")!=-1) || (this.agent.indexOf("16bit")!=-1));
 this.mac=(this.agent.indexOf("mac")!=-1);
}


var oBw = new DIY_Browser();

/* _w : which ID (1) or (2) */
/* _h : (h)ide or (s)how */
function setShow(_w,_h) {
	if (oBw.dom)
	{
		if (_h=='s') document.getElementById(_w).style.visibility='visible';
		if (_h=='s') document.getElementById(_w).style.display='block';
		if (_h=='h') document.getElementById(_w).style.visibility='hidden';
		if (_h=='h') document.getElementById(_w).style.display='none';
	}
	else if (oBw.ie) {
		if (_h=='s') eval("document.all."+_w+".style.visibility='visible';");
		if (_h=='s') eval("document.all."+_w+".style.display='block';");
		if (_h=='h') eval("document.all."+_w+".style.visibility='hidden';");
		if (_h=='h') eval("document.all."+_w+".style.display='none';");
	}
	else if(oBw.ns)
	{
		if (_h=='s') eval("document.layers['"+_w+"'].visibility='show';");
		if (_h=='s') eval("document.layers['"+_w+"'].display='block';");
		if (_h=='h') eval("document.layers['"+_w+"'].visibility='hide';");
		if (_h=='h') eval("document.layers['"+_w+"'].display='none';");
	}
}

function showMore(){
	setShow("morePrd","s");
	setShow("lessBut","s");
	setShow("moreBut","h");
}

function hide(){
	setShow("morePrd","h");
	setShow("lessBut","h");
	setShow("moreBut","s");
}