
var track_image=new Image;
track_image.src="/img/common/tracker.gif?h="+screen.availHeight+"&w="+screen.availWidth+"&userAgent="+escape(navigator.userAgent);


/* DROP DOWN */
function goThereDropDown(form, fieldname) {
    field = form[fieldname];
    if ( field == null ) { return false; }
    url = field.options[field.selectedIndex].value;
    if ( url.length > 0 ) {
        window.location.href = url;
        return true;
    }
    return false;
}

/* FLASH PLUGIN */
var plugver=0;
var flplugin = ((navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0);

if(flplugin){
    var plugver=parseInt(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin.description.substring(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin.description.indexOf(".")-1));
}

function plugin_check() {
    document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width="+f_width+" height="+f_height+">");
    document.write("<param name=movie value="+f_src+"><param name=quality value=high><param name=bgcolor value="+f_bgcolor+">");

    if(plugver>=ok_version || (navigator.userAgent.indexOf('Mac',0) >= 0 && navigator.appVersion.indexOf('MSIE 3.',0) >= 0) || (navigator.userAgent.indexOf('Mac',0) >= 0 && navigator.appVersion.indexOf('MSIE 4.',0) >= 0)){
        document.write("<embed src="+f_src+" quality=high pluginspage='http://www.macromedia.com/jp/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width="+f_width+" height="+f_height+" alt="+f_alt+" bgcolor="+f_bgcolor+">");
        document.write("</embed>");
    }else{
        document.write(change_img);
    }
    document.write("</object>");
}

/* LEFT NAVI POPUP */
function popnavi(root,ver){
    var url = root + "navi/navi_" + ver + ".html";
    naviwin=window.open( url,"navi","toolbar=no,location=no,menubar=no,directories=no,status=no,scrollbars=no,resizable=no,top=0,left=0,width=280,height=520");
    naviwin.focus();
}

/* GENERIC POPUP */
function popup(pURL,pName,features){
    new_window = window.open(pURL, pName, features);
}

/* IMAGE POPUP */
function image_popup(pUrl,pAlt,pWidth,pHeight){
    var width = 620;
    var height = 460;
    if ( window.screen && (pWidth+30) < window.screen.availWidth ) {
        width = pWidth+30;
    }
    else if ( window.screen ) {
        width = window.screen.availWidth-30
    }
    if ( window.screen &&  (pHeight+60) < window.screen.availHeight ) {
        height = pHeight+60;
    }
    else if ( window.screen ) {
        height = window.screen.availHeight-30
    }
    popup(pUrl+'&alt='+escape(pAlt),'large_image', 'width='+width+',height='+height+',scrollbars=yes,toolbars=no,resizable=yes');
}

/* FBF2 css function */

var writeCSS=function(reg,ns) {
    var f =(((navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)<=4))
    || (navigator.userAgent.indexOf("Opera",0)!=-1)) ? ns : reg;
    var inc ='<link rel="stylesheet" type="text/css" href="'+f+'">';
    document.open();
    document.write(inc);
    document.close();
}
var writeCss=writeCSS
function openLarge(src,w,h,desc,qt,swf) {
    var aw=screen.availWidth;var ah=screen.availHeight;
    var sw=parseInt(w)+30;var sh=parseInt(h)+50;
    var big=(sw>aw)||(sh>ah);
    sw=(sw>aw)?aw:sw;sh=(sh>ah)?ah:sh;
    var html='<html><head><title>'+desc+'</title></head><body bgcolor="white" leftmargin="5" rightmargin="5" topmargin="5" marginwidth="5" marginheight="5"><div align="center">';
    html+=qt?getQt(src,qt,w,h,desc):swf?getSwf(src,swf,w,h,desc):getImg(src,w,h,desc);
    html+='</div><form><div align="center"><input type="button" value="Close" onclick="window.close()" onkeypress="window.close()"></div></form></body></html>';
    var wstyle=((big)?'scrollbars=yes,':'')+'location=no,menubar=no,status=no,resizable=yes,toolbars=no,width='+sw+',height='+sh;
    var doc=window.open('','',wstyle).document;
    doc.open();
    doc.write(html);
    doc.close();
    return false;
}

function getImg(src,w,h,desc) {
	return '<img border="0" src="'+src+'" width="'+w+'" height="'+h+'" alt="'+desc+'">';
}

function getSwf(isrc,src,w,h,desc) {
	return '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="'+w+'" height="'+h+'"><param name="quality" value="high"><param name="movie" value="'+src+'">'+getImg(isrc,w,h,desc)+'</object>';
}

function getQt(isrc,src,w,h,desc) {
	return '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" width="'+w+'" height="'+h+'"><param name="controller" value="TRUE"><param name="type" value="video/quicktime"><param name="autoplay" value="true"><param name="target" value="myself"><param name="src" value="'+src+'"><param name="pluginspage" value="http://www.apple.com/quicktime/download/indext.html">'+getImg(isrc,w,h,desc)+'</object>';
}

function openWindow(src,w,h) {
    window.open(src, '', 'width=' + w + ',height=' + h + ',scrollbars=yes,location=no,menubar=no,status=no,resizable=yes,toolbars=no');
}

function goDropDown(f) {
	var s=f.elements[0].options[f.elements[0].selectedIndex].value;
	if(s&&s!='') window.location.href=s;
	return false;
}

/* FBF Forms validator class */

function FF_Validator(name) {
	this.fv=new Array;
	this.form=document.forms[name];
}

function FF_Validator_addFV(name,label,validators) {
	var f={name:name,label:label,validators:new Array};
	var _v=validators.split(',');
	for(var i=0; i<_v.length; ++i) if(_v[i]) f.validators[f.validators.length]=FV[_v[i]];
	this.fv[this.fv.length]=f;
}

function FF_Validator_validate() {
	var err='';
	for(var i=0;i<this.fv.length;++i) 
		for(var j=0;j<this.fv[i].validators.length;++j) {
			var e=this.fv[i].validators[j](this.form.elements[this.fv[i].name]);
			if(e) { err+=e.replace('%1',this.fv[i].label)+'\n'; break; }
		}
	if(err) alert(err);
	return !err;
}

FF_Validator.prototype.addFV=FF_Validator_addFV;
FF_Validator.prototype.validate=FF_Validator_validate;

/* FBF Forms validator class */

function FF_Validator(name) {
	this.fv=new Array;
	this.fc=new Array;
	this.form=document.forms[name];
}

function FF_Validator_addFV(name,label,validators,cond) {
	var f={name:name,label:label,validators:new Array,cond:cond};
	var _v=validators.split(',');
	for(var i=0; i<_v.length; ++i) if(_v[i]) f.validators[f.validators.length]=FV[_v[i]];
	this.fv[this.fv.length]=f;
}

function FF_Validator_addFC(fc) {
	fc.form=this.form;
	fc.position=0;
	for(var i=0;i<this.fc.length;++i) if(fc.name==this.fc[i].name) ++fc.position;
	this.fc[this.fc.length]=fc;
}

function FF_Validator_validate() {
	var err='';
	for(var i=0;i<this.fv.length;++i) 
		for(var j=0;j<this.fv[i].validators.length;++j) {
			var e=(!this.fv[i].cond||this.fv[i].cond.check(this.form))?this.fv[i].validators[j](this.form.elements[this.fv[i].name]):'';
			/* label disappears when field is not visible */
			if(e&&this.fv[i].label) { err+=e.replace('%1',this.fv[i].label)+'\n'; break; }
		}
	if(err) alert(err);
	return !err;
}

function FF_Validator_resetAll() {
	for(var i=0;i<this.fc.length;++i) this.fc[i].toggle(this.form);
	return true;
}

FF_Validator.prototype.addFV=FF_Validator_addFV;
FF_Validator.prototype.addFC=FF_Validator_addFC;
FF_Validator.prototype.validate=FF_Validator_validate;
FF_Validator.prototype.resetAll=FF_Validator_resetAll;

/* Condition evaluators */
function FC_Condition(fn,name,value,hide,fields) {
	eval("this.cond=FCC_"+fn);
	this.name=name;
	this.value=value;
	this.hide=hide;
	this.fields=fields.split(',');
}

function FC_Condition_check(f) {
	return this.cond(f.elements[this.name],this.value);
}

function FC_Condition_toggle() {
	var c=this.check(this.form);
	for(var i=0;i<this.fields.length;++i) FC_Condition_setEnabled(this.form.elements[this.fields[i]],c);
	if(this.hide) {
		var n="fl_"+this.form.name+"."+this.name+(this.position>0?this.position:"");
		var l=document.getElementById?document.getElementById(n):
		document.all?document.all[n]:'';
		if(l) l.style.display=c?"":"none";
	}
	return 1;
}

function FC_Condition_setEnabled(f,c) {
	if(f) switch(f.type||f[0].type) {
		case 'text':
		case 'textarea':
		case 'password':
		case 'select-multiple':
		case 'select-one':
			return f.disabled=!c;
		case 'radio':
		case 'checkbox':
			if(f.length) for(var i=0; i<f.length; ++i) f[i].disabled=!c;
			else f.disabled=!c;
	}
	return 1;
}

FC_Condition.prototype.check=FC_Condition_check;
FC_Condition.prototype.toggle=FC_Condition_toggle;

function FCC_is_non_empty(f) {
	switch(f.type||f[0].type) {
		case 'text':
		case 'textarea':
		case 'password':
			return f.value&&f.value!='';
		case 'select-multiple':
		case 'select-one':
			return f.selectedIndex&&f.selectedIndex>0;
		case 'radio':
		case 'checkbox':
			if(f.length) { for(var i=0; i<f.length; ++i) if(f[i].checked) return true; }
			return f.disabled;
	}
	return false;
}

function FCC_is_empty(f) {
	return !FCC_is_non_empty(f);
}

function FCC_has_the_value(f,value) {
	switch(f.type||f[0].type) {
		case 'text':
		case 'textarea':
		case 'password':
			return f.value&&f.value==value;
		case 'select-multiple':
		case 'select-one':
		case 'radio':
		case 'checkbox':
			if(f.length) for(var i=0; i<f.length; ++i) if(f[i].checked&&f[i].value==value) return true;
			return f.value==value;
	}
	return false;
}

/* Field validators 
   Return the error message, or '' if okay */
function FV_required(f) {
	return FCC_is_non_empty(f)?'':_RB['f_required'];
}
function FV_email(f) {
	var p;
	return (!f.value||/^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/.test(f.value))?'':_RB['f_e-mail'];
}
function FV_uszip(f) {
	return (!f.value||(f.value.length==5&&/\d{5}/.test(f.value))
	||(f.value.length==10&&/\d{5}-\d{4}/.test(f.value)))?'':_RB['f_uszip'];
}
function FV_usphone(f) {
	f.value=f.value.replace(/\s/g,'');
	return (!f.value||/1?[(-]?\d{3}[)-]\d{3}-?\d{4}/.test(f.value))?'':_RB['f_usphone'];
}
var FV=new Array;
FV['required']=FV_required;
FV['email']=FV_email;
FV['us-zip']=FV_uszip;
FV['us-phone']=FV_usphone;
var _RB=new Array;
var FBF_Locale='en';


/* TOGGLE OVERVIEW */
var plusIcon = new Image(14,14);
plusIcon .src = "../../images/objets/toggle-plus.gif";
var minusIcon = new Image(14,14);
minusIcon.src = "../../images/objets/toggle-minus.gif";


function ToggleOverview(overviewId, iconId) {
	var image=document.images?document.images[iconId]:'';
	var overview=
		document.getElementById?document.getElementById(overviewId).style:
		document.all?document.all[overviewId].style:'';
	if(image&&overview) {
		var s=(overview.display=="none");
		image.src=s?minusIcon.src:plusIcon.src;
		overview.display=s?"":"none";
		return false;
	} else return true;
}


/* TOGGLE ASSETINFO */
var infoIcon = new Image(16,16);
infoIcon .src = "/img/common/icons/info.gif";
var rinfoIcon = new Image(16,16);
rinfoIcon.src = "/img/common/icons/r-info.gif";


function ToggleAssetInfo(assetinfoId, iconId) {
	var image=document.images?document.images[iconId]:'';
	var assetinfo=
		document.getElementById?document.getElementById(assetinfoId).style:
		document.all?document.all[assetinfoId].style:'';
	if(image&&assetinfo) {
		var s=(assetinfo.display=="none");
		image.src=s?rinfoIcon.src:infoIcon.src;
		assetinfo.display=s?"":"none";
		return false;
	} else return true;
}

/** GIG3 **/
var ua,mode;

ua = navigator.userAgent;



if(ua.indexOf("Mac", 0) >= 0){
mode = "mac_";
}
else if(ua.indexOf("Win", 0) >= 0){
mode = "win_";
}
else{
mode = "other_";
}



if(ua.indexOf("Opera", 0) >= 0){
mode += "opera";
}

else if(ua.indexOf("MSIE 6", 0) >= 0){
mode += "msie";
}

else if(ua.indexOf("MSIE 5", 0) >= 0){
mode += "msie5";
}

else if(ua.indexOf("Mozilla/4.0", 0) >= 0){
mode += "msie";
}

else if(ua.indexOf("Mozilla/4", 0) >= 0){
mode += "ns4";
}

else if(ua.indexOf("Safari", 0) >= 0){
mode += "safari";
}

else{
mode += "other";
}



if(mode == "mac_msie5"){
document.write("<link rel=stylesheet href=/inc/initialize_msiemac5_s.css />");
}

else if(mode == "mac_ns4"){
document.write("");
}

else if(mode == "mac_safari"){
document.write("<link rel=stylesheet href=/inc/initialize_safari_s.css />\n");
}

else if(mode == "mac_opera"){
document.write("<link rel=stylesheet href=/inc/initialize_opera_s.css />\n");
}

else if(mode == "mac_other"){
document.write("<link rel=stylesheet href=/inc/initialize_gecko_s.css />\n");
}

else if(mode == "win_msie"){
document.write("<link rel=stylesheet href=/inc/initialize_msie_s.css />\n");
}

else if(mode == "win_msie5"){
document.write("<link rel=stylesheet href=/inc/initialize_msie5_s.css />\n");
}

else if(mode == "win_ns4"){
document.write("");
}

else if(mode == "win_opera"){
document.write("<link rel=stylesheet href=/inc/initialize_opera_s.css />\n");
}

else if(mode == "win_other"){
document.write("<link rel=stylesheet href=/inc/initialize_gecko_s.css />\n");
}

else if(mode == "other_msie"){
document.write("<link rel=stylesheet href=/inc/initialize_msie_s.css />\n");
}

else if(mode == "other_ns4"){
document.write("");
}

else if(mode == "other_opera"){
document.write("<link rel=stylesheet href=/inc/initialize_opera_s.css />\n");
}

else if(mode == "other_other"){
document.write("<link rel=stylesheet href=/inc/initialize_gecko_s.css />\n");
}

else{
document.write("<link rel=stylesheet href=/inc/initialize_gecko_s.css />\n");
}


