
/* Merged Plone Javascript file
 * This file is dynamically assembled from separate parts.
 * Some of these parts have 3rd party licenses or copyright information attached
 * Such information is valid for that section,
 * not for the entire composite file
 * originating files are separated by - filename.js -
 */

/* - ++resource++igs.theme.javascripts/main.js - */
// http://www.ecampus-esamtoulouse.com/portal_javascripts/++resource++igs.theme.javascripts/main.js?original=1
var ua=navigator.userAgent;var isIE6=(ua.match(/MSIE 6\.0/));IE_CorrectAlpha_PNG=function(){if(isIE6){docimages=jQuery('body img');docimages.each(function(){imgExt=this.src.substring(this.src.length-3,this.src.length);imgExt=imgExt.toUpperCase();if(imgExt=="PNG"){imgID=(this.id)?"id='"+this.id+"' ":"";imgClass=(this.className)?"class='"+this.className+"' ":"";imgTitle=(this.title)?"title='"+this.title+"' ":"title='"+this.alt+"' ";imgStyle="display:inline-block;"+this.style.cssText;if(this.align=="left"){imgStyle="float:left;"+imgStyle} else if(this.align=="right"){imgStyle="float:right;"+imgStyle}
if(this.parentElement.href){imgStyle="cursor:hand;"+imgStyle}
strNewHTML='<span '+imgID+imgClass+imgTitle+' style="width:'+this.width+'px; height:'+this.height+'px;'+imgStyle+';'+'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+this.src+'\', sizingMethod=\'scale\');"></span>';this.outerHTML=strNewHTML}})}}
jQuery(document).ready(IE_CorrectAlpha_PNG);fixCorners=function(){var col2=jQuery('#portal-column-two');var col1=jQuery('#portal-column-one');if(!col2.length){jQuery('#corner-bottom-right').css('background',"transparent url('./corner-right-bottom-white.gif') top right no-repeat");jQuery('#corner-bottom-right').css('border-color',"white");jQuery('#corner-top-right').css('background',"transparent url('./corner-right-top-white.gif') top right no-repeat");jQuery('#corner-top-right').css('border-color',"white")}
if(!col1.length&&!col2.length){jQuery('.managePortletsFallback').each(function(){jQuery(this).parent().css('background-color','white')})}}
jQuery(document).ready(fixCorners);fixContentPadding=function(){var content=jQuery('#content');if(!content.length) jQuery('.documentContent').css('padding','1em')}
jQuery(document).ready(fixContentPadding);fixScreenPadding=function(){if(jQuery('body').width()<1041){jQuery('body').css('padding','0 0 34px 0')}
else jQuery('body').removeAttr('style')}
jQuery(document).ready(fixScreenPadding);jQuery(window).bind('resize',fixScreenPadding);fixNavtreeStyle=function(){var navitems=jQuery('.portletItem .navTreeItem a');if(navitems.length) jQuery(navitems[navitems.length-1]).addClass('lastNavtreeItem')}
jQuery(document).ready(fixNavtreeStyle);fixPortletsStyleFor=function(portlets,dontforcefirstfooter){dontforcefirstfooter=(dontforcefirstfooter)?dontforcefirstfooter:false;if(portlets.length){var firstPortlet=jQuery(portlets[0]);firstPortlet.addClass('firstPortlet');var firstFooter=jQuery('.portletFooter',firstPortlet);if(!(firstFooter.length||dontforcefirstfooter)){firstPortlet.append('<dd class="portletFooter emptyFooter">&nbsp;</dd>')}
var lastPortlet=jQuery(portlets[portlets.length-1]);lastPortlet.addClass('lastPortlet');var lastFooter=jQuery('.portletFooter',lastPortlet);if(!lastFooter.length){lastPortlet.append('<dd class="portletFooter emptyFooter">&nbsp;</dd>')}}}
fixPortletsStyle=function(){fixPortletsStyleFor(jQuery('#portal-column-one .portlet'),dontforcefirstfooter=true);fixPortletsStyleFor(jQuery('#portal-column-two .portlet'))}
jQuery(document).ready(fixPortletsStyle);fixSafariChrome=function(){if(window.devicePixelRatio){jQuery('#portal-columns').addClass('relativeCols');jQuery('#portal-footer').addClass('relativeFooter');jQuery('#portal-colophon').addClass('relativeColophon');jQuery('#corners-bottom-wrapper').addClass('relativeCornersBottom')}}
jQuery(document).ready(fixSafariChrome);fixGlobalNav=function(){if(jQuery('#portal-column-one').length) coloneWidth=jQuery('#portal-column-one').width();else coloneWidth=0;jQuery('#portal-globalnav').width(coloneWidth+jQuery('#portal-column-content').width());jQuery('#portal-globalnav .portal-tab-link').each(function(){theight=jQuery(this).height();if(theight>20){jQuery(this).css('top','20px')}})}
jQuery(window).load(fixGlobalNav);jQuery(window).resize(fixGlobalNav);

/* - ++resource++trainingconvention_edit.js - */
igsQuery(document).ready( function () {
	if (igsQuery('#trainingconvention-base-edit').length == 0) { return false; }

	/* 
	 * we are in a trainingconvention edit mode
	 * let's define some function to handle form
	 * and navigation.
	 * 
	 */
	
	/* This method show all needed error */
	function checkFormError() {
		igsQuery('#kss-spinner').show();
		
		var baseedit = igsQuery('#trainingconvention-base-edit');
		
		var url = baseedit.attr('action');
		url = url.replace('/atct_edit','/@@validation');
		
		igsQuery('.archetypes-schemata-link').removeClass('schemata_error');
		
		igsQuery.getJSON(
			url,
			baseedit.serialize(),
			function (data) {
				/* callback for the json ajax query */
				var fields = igsQuery('#trainingconvention-base-edit .field');
				igsQuery.each(fields,
						function (index, value) {
							var inerror = false;
							for (var schemata in data) {
								var name = value.id;
								name = name.replace('archetypes-fieldname-','');
								if (name in data[schemata]) {
									inerror = true;
								};
								if (inerror) {
									fields.eq(index).addClass('error');
								} else {
									fields.eq(index).removeClass('error');
									igsQuery('#archetypes-fieldname-' + name + " div.fieldErrorBox").text('');
								};
							}
						}
				);

				/* Set text */
				for (var schemata in data){
					//alert(schemata);
					igsQuery('#archetypes-schemata-link-'+schemata).addClass('schemata_error');
					for (var field in data[schemata]) {
							var fieldobj = igsQuery('#archetypes-fieldname-' + field);
							var texts = data[schemata][field];
							if (fieldobj.length>0) {
								for (var i=0; i < fieldobj.length; i++)
									{
										igsQuery('#archetypes-fieldname-' + field + " div.fieldErrorBox").text( texts[i] );
									}
							}
						};
				}
				igsQuery('#kss-spinner').hide();
			}
		)
		
	}
	/* Call this one at load time */
	checkFormError();
	
	/*
	 * Events binding:
	 * We bind events on input (leave field = validate)
	 */
	igsQuery('#trainingconvention-base-edit input').unbind('focusout');
	igsQuery('#trainingconvention-base-edit input').focusout(checkFormError);
	igsQuery('#trainingconvention-base-edit textarea').unbind('focusout');
	igsQuery('#trainingconvention-base-edit textarea').focusout(checkFormError);
	igsQuery('#trainingconvention-base-edit select').unbind('focusout');
	igsQuery('#trainingconvention-base-edit select').focusout(checkFormError);
	
	/* Ended */
});

