if( $('andyslist') ){  var showAndyslist = 1;}var showAndyslist = 1;         window.onload = function() {  // gestion de l'input et du label du champ search    if ($('search')){      Event.observe('search', 'focus', searchFocus);      Event.observe('search', 'blur', searchBlur);    }    if( $('login') ) {      resizeContent();    }        if( $('subscription') ) {      resizeContent();    }    if( $('loginform') ) {      initPos();    }    if($('coupons_type_id')) {      changeCouponType();      Event.observe('coupons_type_id', 'change', changeCouponType);    }        if( $('signin') ){       if( $('chkperso_0').checked ){         toggleFormPro(true);       }else {         $('chkperso_1').setAttribute('checked', true);         toggleFormPro(false);       }     }        if( $('my-cart') ){           init_mycart();            Event.observe(window, 'scroll', function() {        init_mycart();      });    }};function init_mycart(){  var limit_x = 280;  var min_height = 30;  var offset_top =  (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);  var diffX = min_height + offset_top - limit_x;    if( offset_top > limit_x  ){          $('cart-content').setStyle({top: diffX+'px'});    } else {    $('cart-content').setStyle({top: min_height + 'px'});    }    }function resizeContent() {    if($('main-content')) $('main-content').setStyle({height: ' auto'});    if($('col-dashboard')) $('col-dashboard').setStyle({height: ' auto'});    else return false;    if( $('loginform') ) {      $('loginform').setStyle({height: ' auto'});    }    if( $('signin') ) {      $('signin').setStyle({height: ' auto'});    }    if( $('signinvalid') ) {      $('signinvalid').setStyle({height: ' auto'});    }    if( $('changeIdentity') ) {      $('changeIdentity').setStyle({height: ' auto'});    }    if( $('welcome') ) {      $('welcome').setStyle({height: ' auto'});    }  	if($('main-content')) var col1_height = $('main-content').getHeight();    if($('col-dashboard')) var col2_height = $('col-dashboard').getHeight();		var maxHeight = [col1_height, col2_height].max();		if( col1_height <= col2_height ){		  //maxHeight = maxHeight + 10;  		if( $('welcome') ) {        $('welcome').setStyle({height: maxHeight+'px'});        $('col-dashboard').setStyle({height: (maxHeight)+'px'});      } else {		    $('main-content').setStyle({height: maxHeight+'px'});		  }    } else {      if( $('subscription') ) {         maxHeight = maxHeight -20;       }      $('col-dashboard').setStyle({height: (maxHeight)+'px'});            }    //maxHeight = maxHeight + 10;    if( $('loginform') ) {      $('loginform').setStyle({height: '439px'});    }    if( $('signin') ) {      $('signin').setStyle({height: maxHeight+'px'});    }    if( $('signinvalid') ) {      $('signinvalid').setStyle({height: maxHeight+'px'});    }    if( $('changeIdentity') ) {      $('changeIdentity').setStyle({height: maxHeight+'px'});    }}function resizeAndysList(){  if( showAndyslist  == 1){    $('btn_list').addClassName('plus');    showAndyslist = 0;  } else {    $('btn_list').removeClassName('plus');    showAndyslist = 1;  }  Effect.toggle('andyslist', 'blind');}function toggleHelp(element){  var block = $(element).getStyle('display');  if(block == 'none') {    $(element).show();  } else {    $(element).hide();  }  resizeContent()}function changeCouponType(){  var v = $('coupons_type_id').getValue();  if(v == 1) {    $('coupons_user_id').up().up().show();    $('coupons_referer').up().up().hide();  }  else if(v == 2) {    $('coupons_user_id').up().up().hide();    $('coupons_referer').up().up().show();  }  else {    $('coupons_user_id').up().up().hide();    $('coupons_referer').up().up().hide();  }}function searchFocus(){  $('label-search').hide();}function searchBlur(){  if($('search').getValue() == '') {        $('label-search').show();    }}function higlightMyBank(item){  switch(item){    case 'article':        $('navContents').setStyle({            backgroundPosition: '0px -75px'          });        break;    case 'docs':        $('navContents').setStyle({            backgroundPosition: '0px -50px'          });        break;    case 'market':        $('navContents').setStyle({            backgroundPosition: '0px -100px'          });        break;    case 'video':        $('navContents').setStyle({            backgroundPosition: '0px -125px'          });        break;    case 'photo':        $('navContents').setStyle({            backgroundPosition: '0px -25px'          });        break;    case 'text':    default:        $('navContents').setStyle({            backgroundPosition: '0px 0px'          });        break;  }}function higlightMyContent(item){  switch(item){    case 'member':        $('navContents').setStyle({            backgroundPosition: '0px -90px'          });        break;    case 'docs':      $('navContents').setStyle({          backgroundPosition: '0px -60px'        });      break;    case 'video':    case 'market':        $('navContents').setStyle({            backgroundPosition: '0px -90px'          });        break;    case 'article':        $('navContents').setStyle({            backgroundPosition: '0px -30px'          });        break;    case 'photo':    default:        $('navContents').setStyle({            backgroundPosition: '0px 0px'          });        break;  }}var Site = {	settings: {currentLanguage: 'en'}}var MyContentsHandler = function() {	this.init();}MyContentsHandler.prototype = {	countParagraph: 0,	init: function() {	},	setNewParagraphId: function() {		this.countParagraph++;	},	getNewParagraphId: function() {		this.setNewParagraphId();		return this.countParagraph;	},	MyContentsEditor: function() {		var container = document.getElementById('paragraphs');		var containerStyles = {			tagName: 'div',			className: 'paragraph-content',			idPrefix: 'paragraph'		};		var paragraphTitleStyles = {			tagName: 'input',			type: 'text',			maxLength: 50,			className: 'text title',			idPrefix: 'title_',			initValue: ''		};		var paragraphContentStyles = {			tagName: 'textarea',			type: '',			maxLength: 500,			className: 'text content',			idPrefix: 'content_',			initValue: ''		};		var paragraphLabels = {			labelSuffix: {				labels: {					fr: ' (max. xx caract&egrave;res)',					en: ' (max. xx characters)',					de: ' (max. xx characters)',					current: function() { return eval("this."+Site.settings.currentLanguage); }				},				tag: 'em'			},			titles: {				fr: 'Titre du paragraphe ',				en: 'Title Paragraph ',				de: 'Title Paragraph ',				current: function() { return eval("this."+Site.settings.currentLanguage); }			},			content: {				fr: 'Texte du paragraph ',				en: 'Text Paragraph ',				de: 'Text Paragraph ',				current: function() { return eval("this."+Site.settings.currentLanguage); }			}		};		var createStructure = function(newId) {			/* Creates a new block with:			 - 1 label for the paragraph title			 - 1 input="text" for the paragraph title			 - 1 label for the paragraph content			 - 1 textarea for the paragraph content			*/			// Main block			var newObj = document.createElement(containerStyles.tagName);			newObj.className					= containerStyles.className;			newObj.id							= containerStyles.idPrefix+newId;			// Paragraph title			var newObjTitleLabel = document.createElement('label');			newObjTitleLabel.innerHTML			= paragraphLabels.titles.current()+newId;			if (paragraphTitleStyles.maxLength > 0) {				newObjTitleLabel.labelSuffixString = '<'+paragraphLabels.labelSuffix.tag+'>';				newObjTitleLabel.labelSuffixString += paragraphLabels.labelSuffix.labels.current().replace(new RegExp("(xx)", "g"), paragraphTitleStyles.maxLength);				newObjTitleLabel.labelSuffixString += '</'+paragraphLabels.labelSuffix.tag+'>';				newObjTitleLabel.innerHTML += newObjTitleLabel.labelSuffixString;			}			var newObjTitleInput = document.createElement(paragraphTitleStyles.tagName);			newObjTitleInput.name				= paragraphTitleStyles.idPrefix+newId;			newObjTitleInput.id					= paragraphTitleStyles.idPrefix+newId;			newObjTitleInput.className			= paragraphTitleStyles.className;			if (paragraphTitleStyles.initValue.length > 0)				newObjTitleInput.value			= paragraphTitleStyles.initValue;			if (paragraphTitleStyles.maxLength > 0 && paragraphTitleStyles.tagName == "input")				newObjTitleInput.maxLength		= paragraphTitleStyles.maxLength;			if (paragraphTitleStyles.tagName == "input")				newObjTitleInput.type			= paragraphTitleStyles.type;			// Paragraph content			var newObjContentLabel = document.createElement('label');			newObjContentLabel.innerHTML		= paragraphLabels.content.current()+newId;			if (paragraphContentStyles.maxLength > 0) {				newObjContentLabel.labelSuffixString = '<'+paragraphLabels.labelSuffix.tag+'>';				newObjContentLabel.labelSuffixString += paragraphLabels.labelSuffix.labels.current().replace(new RegExp("(xx)", "g"), paragraphContentStyles.maxLength);				newObjContentLabel.labelSuffixString += '</'+paragraphLabels.labelSuffix.tag+'>';				newObjContentLabel.innerHTML += newObjContentLabel.labelSuffixString;			}			var newObjContentInput = document.createElement(paragraphContentStyles.tagName);			newObjContentInput.name				= paragraphContentStyles.idPrefix+newId;			newObjContentInput.id				= paragraphContentStyles.idPrefix+newId;			newObjContentInput.className		= paragraphContentStyles.className;			if (paragraphContentStyles.initValue.length > 0)				newObjContentInput.value		= paragraphContentStyles.initValue;			if (paragraphContentStyles.maxLength > 0 && paragraphContentStyles.tagName == "input")				newObjContentInput.maxLength	= paragraphContentStyles.maxLength;			if (paragraphContentStyles.tagName == "input")				newObjContentInput.type			= paragraphContentStyles.type;			return {				id: newId,				mainContainer: newObj,				titleLabel: newObjTitleLabel,				titleInput: newObjTitleInput,				contentLabel: newObjContentLabel,				contentInput: newObjContentInput			};		}		return {			checkForm: {				mandatoryFields: new Array('category','author_name','author_surname','title','summary'),				nbMinParagraph: 1			},			addParagraph: function(id) {				var Paragraph = createStructure(id);				container.appendChild(Paragraph.mainContainer);				Paragraph.mainContainer.appendChild(Paragraph.titleLabel);				Paragraph.mainContainer.appendChild(Paragraph.titleInput);				Paragraph.mainContainer.appendChild(Paragraph.contentLabel);				Paragraph.mainContainer.appendChild(Paragraph.contentInput);				resizeContent();			},			getFieldnames: function() {				return {					fieldnames: {title: paragraphTitleStyles.idPrefix, content: paragraphContentStyles.idPrefix}				}			},			validate: function(inst) {				var frm = document.getElementById('frmDashboard');				if (frm) {					var _errMsg = 'Some error have been found. Please check the following message.\n';					var _tmpErrMsg = '';					var _errCpt = 0;					var _errFields = new Array;					var _emptyParagraph = 0;					for (i=1; i<=inst.countParagraph; i++) {						if (document.getElementById('paragraph'+i) && (								frm.elements[paragraphTitleStyles.idPrefix+i].value.length == 0								|| frm.elements[paragraphContentStyles.idPrefix+i].value.length == 0							)) {							_emptyParagraph++;						}					}					if (_emptyParagraph > 0 || (inst.countParagraph < this.checkForm.nbMinParagraph)) {						_errMsg += 'Please add at least '+this.checkForm.nbMinParagraph+' paragraph.\n';						_errCpt++;					}					for (i=0; i<this.checkForm.mandatoryFields.length; i++) {						if (frm.elements[this.checkForm.mandatoryFields[i]].value.length == 0) {							_tmpErrMsg += this.checkForm.mandatoryFields[i]+', ';							_errCpt++;						}					}					if (_errCpt > 0) {						if (_errFields) {							_errMsg += 'You must enter a value for the following fields: '+_tmpErrMsg;							alert(_errMsg.substr(0, (_errMsg.length-2))+'.');						}						else alert(_errMsg);						return false;					}				}				return true;			}		};	}};var myContents = new MyContentsHandler();function initPos(){  var current = 'visual_passwd'+in_pass[pos_pwd]  $('visual_passwd'+in_pass[pos_pwd]).addClassName('current');}function putPass(c){  if( pos_pwd < 3){    $('passwd').value = $('passwd').value + c;    $('visual_passwd'+in_pass[pos_pwd]).removeClassName('current');    $('visual_passwd'+in_pass[pos_pwd]).addClassName('past');    pos_pwd++;    if( pos_pwd < 3){      $('visual_passwd'+in_pass[pos_pwd]).addClassName('current');    }  }  return false;}function toggleMainCommunity(element){  if(element.checked){    $('maincommunity').setStyle({display: 'none'});  } else {    $('maincommunity').setStyle({display: 'block'});  }}function toggleFormPro( corporate ){  $$('form#signin  .required-corporate').each(function(element) {     if( corporate ){       element.addClassName("required");     } else {       element.removeClassName("required");     }  });        $$('form#signin  .required-individual').each(function(element) {     if( corporate ){       element.removeClassName("required");     } else {       element.addClassName("required");     }  });    }function toggleSave(){  $('btnSave').setStyle({display: 'none'});  $('btn_loading').setStyle({display: 'block'});}function updateDirInput(value, tabrtl ){  $('frmDashboard').removeClassName('rtl');  if( tabrtl.indexOf(value) != -1 ){      $('frmDashboard').addClassName('rtl');  }}function toggleFFViewOption( element ) {  if(element.checked){    $('field_option').setStyle({display: 'block'});  } else {    $('field_option').setStyle({display: 'none'});  }}function activeVideo( video ) {  $$('div[class="video_container active"]').each( function(element){    element.removeClassName('active');  })  $('video'+video).addClassName('active');    return false;  }  function toggleCustomOptions( element ){    var options  =  $(element.id + '_options');  Effect.toggle(options, 'blind');}function setDefaultMarketplaceOptions( options ){  for ( i in options ) {        if( $(i) ){     $(i).checked = true;     if( options[i] != '' ) {       if( $( i + '_qty' ) ){        var quantity_field = $( i + '_qty' );        quantity_field.value = options[i];          } else if( $( i + '_quantity' ) ) {                  var selectThis = options[i];          $$('select#' + i + '_quantity option').each(function(o){                if(o.value==selectThis){                  o.selected = true;                }          });       }     }    }  } }function showNextParagraph(idParagraph){  nextParagraph = idParagraph + 1;  currentValue = $('is_limited').options[$('is_limited').selectedIndex].value;  if(idParagraph > 4 && currentValue == 0) {     Effect.BlindUp('btnAddParagraph'+idParagraph);     Effect.BlindDown('paragraph'+idParagraph, { queue: 'end' } );    if(idParagraph < 10) {       Effect.BlindDown('btnAddParagraph'+nextParagraph, { queue: 'end' });    }  } else {    if(idParagraph == 4) {       Effect.BlindUp('btnAddParagraph'+idParagraph);       Effect.BlindDown('paragraph'+idParagraph, { queue: 'end' } );       if(currentValue == 0) Effect.BlindDown('btnAddParagraph'+nextParagraph, { queue: 'end' })     } else {       Effect.BlindUp('btnAddParagraph'+idParagraph);       Effect.BlindDown('paragraph'+idParagraph, { queue: 'end' } );     }  }}
