var isIE6=false;
if((document.all)&&(navigator.appVersion.indexOf("MSIE 6.")!=-1)){
		isIE6=true;
}

$(document).ready(function(){
					setIvecoFrame.init();
					booking.init();

                    if(!$('.dealer_locator').length){
                        dlocator.init();
                    }
					 if($('#body_welcome').is('div')){
						mng_welcome();
						$(window).resize(function(){mng_welcome()});
					}
					if($('.wrapper_tools').is('div')){
						mng_wrapper_swftop();
						$(window).resize(function(){mng_wrapper_swftop()});
						if($('.tools_top').is('div')){
								toolstop.init();
								toolstop.setbtns();	
								}
						if($('.panel_foto').is('div')){
							album.init();
							}
						if($('.panel_video').is('div')){
							video.init();
							}	
					}
					if($('#choose_lang').is('p')){
						sel_mkt.init();
						}
					if($('#menutop').is('ul')){
						menus.set_ev('#menutop');
						style_menutop();
						}
					if($('.quickmenu').is('ul')){
						menus.set_ev('.quickmenu');
						}	
					if($('.news_footer').is('div')){
						mng_newsftr();
						}
					if($('.box_moreinfo').is('div')){	
						checkForm.init('fmore_info');
					}
					if($('#aspnetForm').is('form')){
							checkForm.init('aspnetForm');
					}
					if($('.panel_informazioni').is('div')){
							checkForm.init('aspnetForm');
					}
					if($('.goplayervideo').is('a')){
						player_coldx.init();
						}
					if(typeof(panelstatus)!='undefined'){
						if(panelstatus=='open'){
							toolstop.tshow('informazioni');
							toolstop.elprev='informazioni';
							}
						}
					if($('.col_msx').is('div')){
						//mng_msx.set_style_btn();
						mng_msx.init();
						}
                    if($('.c_booking_calendar').length){
                       mng_calendar.init()
                    }
                if($('.customer_content').length){
                        mng_customerservice.init();
                    }
		});

var mng_calendar = {
    currweek : 0,
    weeks : 0,
    init : function(){
          $(".tab_calendar input").live("click", function(){
                $(".tab_calendar td").removeClass('selected');
	            $(this).parent().addClass('selected');
                });
            this.row_cols();
            $('.weeks_calendar:first').show();
            mng_calendar.weeks=$('.weeks_calendar').length;
            if(mng_calendar.weeks<=1){
                 $('.prev_week').hide();
                          $('.next_week').hide();
            }
            $('.next_week').click(function(e){
             mng_calendar.next_week();
             e.preventDefault();
            });
            $('.prev_week').click(function(e){
              mng_calendar.prev_week();
             e.preventDefault();
            });

    },
    row_cols : function(){
                var $cols = $('.weeks_calendar').eq(this.currweek).find('colgroup');
                var $week=$('.weeks_calendar:eq('+this.currweek+')');
                $week.find('td').live('mouseover', function(){
                    var i = $(this).prevAll('td').length;
                    $(this).parent().addClass('hover')
                    $($cols[i]).addClass('hover');

                }).live('mouseout', function(){
                    var i = $(this).prevAll('td').length;
                    $(this).parent().removeClass('hover');
                    $($cols[i]).removeClass('hover');
                });

                $('.weeks_calendar:eq('+this.currweek+')').find('.tab_calendar').mouseleave(function(){
                    $cols.removeClass('hover');
                });
    },
    next_week : function(){
            this.currweek=this.currweek+1;
            if(this.currweek==this.weeks-1) {
                     $('.next_week').hide();
                     $('.prev_week').show();
                }else{
                    $('.next_week').show();
                    $('.prev_week').show();
                }


             $('.weeks_calendar').eq(this.currweek).show();
             $('.weeks_calendar').eq(this.currweek-1).hide();
             mng_calendar.row_cols();
             this.unbind_row_cols();

    },
    prev_week : function(){
                this.currweek=this.currweek-1;
               if(this.currweek<=0) {
                            $('.prev_week').hide();
                              $('.next_week').show();
                        }else{
                          $('.prev_week').show();
                          $('.next_week').show();
                        }
             $('.weeks_calendar').eq(this.currweek).show();
             $('.weeks_calendar').eq(this.currweek+1).hide();

    },
    unbind_row_cols : function(){
            $('.weeks_calendar:eq('+(this.currweek-1)+')').die();
    }
}



var mng_customerservice = {
    prevcs : null,
    init : function(){
        $('.m_cs>div').each(function(i){
            if($(this).attr('class')=='m'+(i+1)+' on'){
                $(this).attr({rel:'on'})
            }
        });
        $('.mcs_img a').hover(function(){
            if($(this).parent().parent().attr('rel')=='on') return;
            $(this).parent().prev('msc_lab').find('img').animate({top:0},150);
            $(this).parent().animate({height:175},150,function(){
                $(this).parent().addClass('on');
            });
        },function(){
           if($(this).parent().parent().attr('rel')=='on') return;
           $(this).parent().prev('msc_lab').find('img').animate({top:-26},100);
            $(this).parent().animate({height:145},100,function(){
                $(this).parent().removeClass('on');
            });
        });
         $('.mcs_img a').click(function(e){

             var ind=$(this).parent().parent().attr('class').substr(1,1);
            for(i=1;i<=3;i++){
                $('.cs'+i).hide();
                $('.m'+i).attr('rel','');
                $('.m'+i).find('.mcs_img').attr('style','');
                $('.m'+i).removeClass('on');
            }
             $('.cs'+ind).show();
             $(this).parent().parent().addClass('on');
             $(this).parent().parent().attr({rel:'on'})
             e.preventDefault();
         });
    }
}


var setIvecoFrame={
	url : null,
	init : function(){
			var container='<div id="container_iframe" class="jqmWindow"><iframe id="jqmContent" src="" allowtransparency="yes" frameborder="0"  scrolling="auto"></iframe><div id="jqmTitle"><a href="#" class="jqmClose"><img src="/SiteCollectionImages/Iveco/img/shared/panels_tools/lbx_btn_close.gif" /></a></div></div>';
			$('body').append(container);
			$('#container_iframe').css({display:'none'}).jqm({target: '#jqmContent',onShow:setIvecoFrame.loadPage});
			
		},
	showModalIveco : function(url){
			w_win=$(window).width();
			el_left=Math.round((w_win-730)/2);
			$('#container_iframe').css('left',el_left);
			setIvecoFrame.url=url;
			$('#container_iframe').jqmShow();
		},	
	loadPage : function(hash){
			var $trigger = $(hash.t);
			var $modal = $(hash.w);
			var $modalContent = $("iframe", $modal);
			$modalContent.html('').attr('src', setIvecoFrame.url);
			$('#container_iframe').show();	
		}	
	}


var dlocator={
	url : null,
	init : function(){
			var container='<div id="container_dlocator" class="jqmWindow"><iframe id="jqmContent_dealer" src="" allowtransparency="yes" frameborder="0"  scrolling="auto"></iframe><div id="jqmTitle_dealer"><a href="#" class="jqmClose"><img src="/SiteCollectionImages/Iveco/img/shared/panels_tools/lbx_btn_close.gif" /></a></div></div>';
			$('body').append(container);
			$('#container_dlocator').css({display:'none'}).jqm({target: '#jqmContent_dealer',onShow:dlocator.loadPage});

		},
	showModalIveco : function(url){
			w_win=$(window).width();
			el_left=Math.round((w_win-990)/2);
			$('#container_dlocator').css('left',el_left);
			dlocator.url=url;
			$('#container_dlocator').jqmShow();
		},
	loadPage : function(hash){
			var $trigger = $(hash.t);
			var $modal = $(hash.w);
			var $modalContent = $("iframe", $modal);
			$modalContent.html('').attr('src', dlocator.url);
			$('#container_dlocator').show();
		}
	}

var booking={
	url : null,
	init : function(){
			var container='<div id="container_booking" class="jqmWindow"><iframe id="jqmContent_booking" src="" allowtransparency="yes" frameborder="0"  scrolling="auto"></iframe><div id="jqmTitle_booking"><a href="#" class="jqmClose"><img src="/SiteCollectionImages/Iveco/img/shared/panels_tools/lbx_btn_close.gif" /></a></div></div>';
			$('body').append(container);
			$('#container_booking').css({display:'none'}).jqm({target: '#jqmContent_booking',onShow:booking.loadPage});

		},
	showModalIveco : function(url,btn){
            var btnpos=$(document).scrollTop()+30;
            //var topcontainer=(btnpos.top)-280;
            var topcontainer=btnpos;
			w_win=$(window).width();
			el_left=Math.round((w_win-800)/2);
			$('#container_booking').css({left:el_left,top:topcontainer});
			booking.url=url;
			$('#container_booking').jqmShow();
		},
	loadPage : function(hash){
			var $trigger = $(hash.t);
			var $modal = $(hash.w);
			var $modalContent = $("iframe", $modal);
			$modalContent.html('').attr('src', booking.url);
			$('#container_booking').show();
		}
	}


/**
var grid_calendar ={
       set_events : function(){
       $('.calendar td').click(function() {
            if($(this).children('img').length) return;
			var tr = $(this).parent();
			for (var i = 0; i < tr.children().length; i++) {
				if (tr.children().get(i) == this) {
					var column = i;
					break;
				}
			}

			var tbody = tr.parent();
			for (var j = 0; j < tbody.children().length; j++) {
				if (tbody.children().get(j) == tr.get(0)) {
					var row = j;
					break;
				}
			}

           if(column!=0){
               grid_calendar.set_hiddenvalue($(this).find('span').text());
               $(this).addClass('on');
           }

		});
       },
    set_hiddenvalue : function(value){
        this.removeClass();
        $('.value_to_send').val(value);

    },
    removeClass : function(){
        $('.calendar td.on').removeClass('on');
    }
}
**/


function style_menutop(){
	var wMtop=0;
	$('#menutop>li').each(function(){
								wMtop+=$(this).width()+60;
								});
        if(wMtop>964){
            wMtop=964;
            $('#menutop>li').css({marginLeft:20});
        }else if(wMtop<700){
            $('#menutop>li').css({marginLeft:50});
        }
    $('#menutop').css({width:wMtop})
	}


function getpopup(url){
	window.open(url,'mywin','width=770,height=500,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');
	}
	
var player_coldx={
	init : function(){
		$('.goplayervideo').click(function(){
									var video_hires=$(this).parent().find('input[name|=video_hires]').val();
									var video_splashimg=$(this).parent().find('input[name|=video_splashimg]').val();
									player_coldx.buildplayer(video_hires,video_splashimg);	   
										   });
		},
	buildplayer:function(video_hires,video_splashimg){	
	var modal_video='<div class="jqmWindow" id="modal_video"><p id="closemodal"><a href="#" id="mod_closevideo"><img src="'+abspath+'/img/shared/panels_tools/lbx_btn_close.gif" /></a></p><div id="iveco_video"></div></div>';
					$('body').append(modal_video);
					w_win=$(window).width();
					el_left=Math.round((w_win-593)/2);
					$('#modal_video').css('left',el_left);
					// Inizializzazione
					var flashvars = {};
					var params = {};
					var attributes = {};
				  
					// Parametri del player:
					// - OBBLIGATORI
					// Larghezza e altezza
					var width = '563';
					var height = '317';
					// URL assoluto del video in alta risoluzione (se disponibile)
					flashvars.hq = video_hires;
					// URL assoluto del video in bassa risoluzione (se disponibile)
					//flashvars.lq = lr;
					// - FACOLTATIVI
					// URL assoluto dell'immagine di splash - default = nessuna immagine
					flashvars.splashimg = video_splashimg;
					// Avvio automatico della riproduzione (true|false) - defalut = false
					flashvars.autoplay = 'false';
					// Esecuzione del controllo velocità di banda (true|false) - default = false
					flashvars.bwCheck = 'true';
					// Testo del messaggio per lo switch di risoluzione (solo se bwChek è true) - default = nessun messaggio
					flashvars.bwMsg = 'Per limitare i tempi di buffering puoi anche vedere questo video in bassa risoluzione';
					// Colore di sfondo - default = trasparente
					params.bgcolor = '#000000';
				  
					// NON MODIFICARE
					params.quality = 'high';
					params.allowfullscreen = 'true';
					params.allowscriptaccess = 'sameDomain';
					params.wmode = 'transparent';
				  
					// Iclusione del player
					swfobject.embedSWF('/SiteCollectionImages/Iveco/swf/player.swf', 'iveco_video', width, height, '9.0.115', false, flashvars, params, attributes);
					$('#modal_video').jqm({overlay: 60, trigger: false});
					$('#modal_video').jqmShow();
					$('#mod_closevideo').click(function(){player_coldx.closemodal();});
			},
		closemodal : function(){
					$('#modal_video').jqmHide();
					$('#modal_video').remove();	
			}		
	}

var video={
	init : function(){
			 $('.wrapper_cols_video p.thumb>a').each(function(i){
									  $(this).click(function(){
									  	 var pathxmlvideo=$(this).attr('href');
										 video.get_data(pathxmlvideo);
										  return false;
										});
									  });	
			},
	get_data : function(pathxmlvideo){
						$.ajax({
						  type: "GET",
						  url: pathxmlvideo,
						  success: function(xmlvideo){
								video.buildplayer(xmlvideo);
						  },
						  error:function (xhr, ajaxOptions){
							   alert('Errore '+xhr.responseText);
							  }       
						  });
			},		
	buildplayer : function(xmlvideo){
					var modal_video='<div class="jqmWindow" id="modal_video"><p id="closemodal"><a href="#" id="mod_closevideo"><img src="'+abspath+'/img/shared/panels_tools/lbx_btn_close.gif" /></a></p><div id="iveco_video"></div></div>';
					$('body').append(modal_video);
					w_win=$(window).width();
					el_left=Math.round((w_win-593)/2);
					$('#modal_video').css('left',el_left);
					$(xmlvideo).find('item').each(function(i){
						hqv=$(this).children('hires').text();
						splashimage=$(this).children('splashimg').text();
					});
					// Inizializzazione
					var flashvars = {};
					var params = {};
					var attributes = {};
				  
					// Parametri del player:
					// - OBBLIGATORI
					// Larghezza e altezza
					var width = '563';
					var height = '317';
					// URL assoluto del video in alta risoluzione (se disponibile)
					flashvars.hq = hqv;
					// URL assoluto del video in bassa risoluzione (se disponibile)
					//flashvars.lq = lr;
					// - FACOLTATIVI
					// URL assoluto dell'immagine di splash - default = nessuna immagine
					flashvars.splashimg = splashimage;
					// Avvio automatico della riproduzione (true|false) - defalut = false
					flashvars.autoplay = 'false';
					// Esecuzione del controllo velocità di banda (true|false) - default = false
					flashvars.bwCheck = 'true';
					// Testo del messaggio per lo switch di risoluzione (solo se bwChek è true) - default = nessun messaggio
					flashvars.bwMsg = 'Per limitare i tempi di buffering puoi anche vedere questo video in bassa risoluzione';
					// Colore di sfondo - default = trasparente
					params.bgcolor = '#000000';
				  
					// NON MODIFICARE
					params.quality = 'high';
					params.allowfullscreen = 'true';
					params.allowscriptaccess = 'sameDomain';
					params.wmode = 'transparent';
				  
					// Iclusione del player
					swfobject.embedSWF('/SiteCollectionImages/Iveco/swf/player.swf', 'iveco_video', width, height, '9.0.115', false, flashvars, params, attributes);
					$('#modal_video').jqm({overlay: 60, trigger: false});
					$('#modal_video').jqmShow();
					$('#mod_closevideo').click(function(){video.closemodal();});
			},
		closemodal : function(){
					$('#modal_video').jqmHide();
					$('#modal_video').remove();	
			}	
}	

var album={
	init : function(){
		   $('.wrapper_cols_foto p.thumb>a').each(function(i){
									  var indexalbum='thumbalbum_'+i;
									  $(this).attr('id',indexalbum);
									  var pathalbum=$(this).attr('href');
									  $(this).click(function(){
									  if($(this).attr('rel')=='has_els'){
										 var idul='lbxalbum_'+indexalbum.substr(11);
										 $('#'+idul+' a.elsalbum:first').trigger('click');
										  }
									  else{album.get_data(pathalbum,indexalbum);}
									  return false;
										});
									  });
		   		},		
	get_data : function(pathalbum,indexalbum){
										  $.ajax({
											type: "GET",
											url: pathalbum,
											success: function(xmlalbum){
												  album.build_els(xmlalbum,indexalbum);
											},
											error:function (xhr, ajaxOptions){
												 alert('Errore '+xhr.responseText);
												}       
											});
												  
			},
	build_els : function(xmlalbum,indexalbum){
				$('#'+indexalbum).attr('rel','has_els')
				var id_newul='lbxalbum_'+indexalbum.substr(11);
				$('#'+indexalbum).parent().parent().append('<ul id="'+id_newul+'" class="data_album"></ul>');
				$(xmlalbum).find('item').each(function(i){
					lr=$(this).children('lores').text();
					hr=$(this).children('hires').text();
					wallpsmall=$(this).children('wallpapersmall').text();
					wallpmedium=$(this).children('wallpapermedium').text();
					wallpbig=$(this).children('wallpaperbig').text();
					desc=$(this).find('description').text()
					hires_download='';
					wallpaper_download='';
					if(hr!=''){
						hires_download='&lt;a href=&quot;'+hr+'&quot;&gt;HiRes&lt;/a&gt;';
						}	
					if(wallpsmall!=''){
						wallpaper_download='1';
						wsmall='&lt;a href=&quot;'+wallpsmall+'&quot;&gt;1024x768&lt;/a&gt';
						}
					else{
						wsmall='';
						}	
					if(wallpmedium!=''){
						wallpaper_download='1';
						wmedium='&lt;a href=&quot;'+wallpmedium+'&quot;&gt;1280x800&lt;/a&gt';
						}
					else{
						wmedium='';
						}	
					if(wallpbig!=''){
						wallpaper_download='1';
						wbig='&lt;a href=&quot;'+wallpbig+'&quot;&gt;1280x1024&lt;/a&gt';
						}
					else{
						wbig='';
						}	
					if(wallpaper_download=='1'){
						wallpaper_download='Wallpaper: '+wsmall+' '+wmedium+' '+wbig;
						}
					else{
						wallpaper_download='';
						}
					contentel=desc+'&lt;hr /&gt;'+hires_download+' | '+wallpaper_download;
					els_album='<li><a href="'+lr+'" title="'+contentel+'" class="elsalbum" rel="fbx'+indexalbum.substr(11)+'">&nbsp;</a></li>';
					$('#'+id_newul).append(els_album);
				});
				album.gallery(id_newul);
			},
	gallery :  function(idul){
			$('#'+idul+' a.elsalbum').fancybox({
						'speedIn'		:	600, 
						'speedOut'		:	200,
						overlayOpacity	:	0.6,
						overlayColor	:	'#000',
						'overlayShow'	:	true
					});
			$('#'+idul+' a.elsalbum:first').trigger('click');
		} 		
}
function formatTitle(title, currentArray, currentIndex, currentOpts) {
    return '<div id="tip7-title">' + (title && title.length ? '<b>' + title + '</b>' : '' ) + 'Image ' + (currentIndex + 1) + ' of ' + currentArray.length + '</div>';
}


var checkForm={
	init : function(form){
		$("#"+form).find('input').each(function(){
											if($(this).attr('type')=='text'){
												$(this).attr('rel',$(this).val());
												if($(this).attr('rel')!=''){
													if($('.box_moreinfo').is('div')){
													$(this).focus(function(){
																		   if($(this).attr('rel')==$(this).val()){
																		   	  $(this).val('');
																		   }
																		   });
													$(this).blur(function(){
																		  if($(this).val()==''){
																				$(this).val($(this).attr('rel'));  
																			  }
																			});
														}
													}
												}
											});
		$("#"+form).find('textarea').each(function(){
												$(this).attr('rel',$(this).val());
												if($(this).attr('rel')!=''){
													if($('.box_moreinfo').is('div')){
													$(this).focus(function(){
																		   if($(this).attr('rel')==$(this).val()){
																		   	  $(this).val('');
																		   }
																		   });
													$(this).blur(function(){
																		  if($(this).val()==''){
																				$(this).val($(this).attr('rel'));  
																			  }
																			});
														}
													}
											});
		
		$.validator.addMethod("cRequired", function(value, element) { if($(element).attr('type')=='text'){return value!=$(element).attr('rel')}
																	if($(element).attr('type')=='radio'&&$(element).attr('checked')==true){return $(element).attr('rel') == 'si';}
																																		},"");
		$.validator.addMethod("cEmail",  $.validator.methods.email,"");
		$.validator.addMethod("cTelefono", function(value, element) { return /^[+0-9 ]?[\-0-9 ]+$/.test(value);},"");
		
		
		$.validator.addClassRules("req", { cRequired: true});
		$.validator.addClassRules("email", { cEmail: true});
		$.validator.addClassRules("telefono", { cTelefono: true});
		$.validator.addClassRules("zip", { cZip: true});
	}	
}


function startcheck(form){
	return $("#"+form).validate({
						errorContainer: ".form_error_message",
						rules : {
							req : { cRequired : true },
							email	: { cEmail : true },
							telefono: { cTelefono : true },
							zip: { cZip : true }
						},
		 				highlight: function(element, errorClass) {
							if($(element).attr('type')=='radio'){
								$(element).parent().addClass('error');
							}
							else{
								$(element).addClass('error');
								}
						},
						unhighlight: function(element, errorClass) {
							if($(element).attr('type')=='radio'){
								$(element).parent().removeClass('error');
							}
							else{
								$(element).removeClass('error');
								}
						},
						invalidHandler: function(e, validator) {
							var errors = validator.numberOfInvalids();
						  if (errors) {
							$("div.form_error_message").show();
						  }
						  else {
                      	  $("div.form_error_message").hide();
               			 } 
						 return false;
						}
					}).form();
}




function mng_welcome(){
		var nw=$('#layout').width();
		if(nw<=990) return;
		var nm=nw-1280;
		$('#body_welcome').width(nw-1);
		$('#wrapper_welcome').css('left',(nm/2)+'px');
		$('#select_market').css('left',(nm/2)+'px');
}

function mng_wrapper_swftop(){
		var nw=$('.layout').width();
		if(nw<=990) {
			nw=990;
			};
		var nm=nw-1280;
		var header = $("div.header:first")
		var headerOffeset = header.offset();
		$('.wrapper_tools').css("top", headerOffeset.top + header.height());
		if($('#MSO_tblPageBody').is('table')) nw=950;
		var header        = $("div.header:first")
		var headerOffeset = header.offset();
		$('.wrapper_tools').css("top", headerOffeset.top + header.height());
		$('.wrapper_tools').width(nw-1);
		$('.wrapper_panels').width(nw-1);
		$('.bg_wrp').css('left',(nm/2)+'px');
		$('.bg_panels').css('left',(nm/2)+'px');
}

var toolstop={
		elcurr: '',
		elprev: '',
		slide_active: [],
		init : function(){
						$('.t_menu li').each(function(){
													 $(this).find('a').hover(function(){
																	$(this).find('img').addClass('over');	
																				 },
																		function(){
																	$(this).find('img').removeClass('over');		
																			});
													 $(this).find('a').click(function(){
																		var classparent=$(this).parent().parent().attr('class');
																		 var idel=classparent.substring(4);
																		 if($('.panel_'+idel).is('div')){
																		  if(idel==toolstop.elcurr){
																			  return;
																		  }
																		  else{
																			 if(toolstop.elprev!=''){
																				 toolstop.thide(toolstop.elprev); 
																				 }
																			 toolstop.tshow(idel);
																				switch(idel){
																					case 'promozioni':
																					 toolstop.slideobj('.wrapper_cols_'+idel,2);
																					  break;
																					case 'schede':
																					   toolstop.slideobj('.wrapper_cols_'+idel,2);
																					   break;
																					 case 'catalogo':
																					   toolstop.slideobj('.wrapper_cols_'+idel,2);
																					   break;  
																					case 'video':
																					  toolstop.slideobj('.wrapper_cols_'+idel,4);
																					  break;
																					case 'foto':
																					 	toolstop.slideobj('.wrapper_cols_'+idel,4);
																					  break;
																					}
																			 
																			  }
																		  toolstop.elprev=idel;
																		  return false;
																		  }
																		  });
													 });
						$('.btn_closepanel>a').click(function(){
										  toolstop.thide(toolstop.elprev,1); 
										  return false;
										   });
				},
		setbtns : function(){
			var wtools_top=0;
			$('.t_menu li').each(function(){
					if(isIE6){					  
						if($(this).attr('class')!='tools_divider'){	
							var elw=$(this).find('.txt_tool').width();
							var elh=$(this).find('.txt_tool').height();
							if(elh>=16){
								$(this).width(elw*1.9);
							}
							else{
								$(this).width(elw*1.2);
								}
						}
					}
					wtools_top=wtools_top+$(this).find('.txt_tool').width()+35;					 
			});
			$('.tools_top').width(wtools_top)
			},		
		 tshow: function(el){
				 $('.btn_'+el).find('.ico_btn img').addClass('over_clicked');	
			 		if($('.wrapper_panels').css('display')=='none'){
							$('.wrapper_panels').show();
						}
			 		$('.panel_'+el).show();
					if($('.wrapper_cols_'+el).is('div')){
					
						if($.inArray('.wrapper_cols_'+el, toolstop.slide_active)!=-1){
							$('.wrapper_panels').height($('.panel_'+el).attr('xdh')+'px');
							}
						else{
							var new_panel_height=$('.wrapper_cols_'+el).find('.slider_els').height();
							if(new_panel_height<140){
								new_panel_height=100;
								}
							$('.wrapper_panels').height(new_panel_height+57);
							$('.panel_'+el).find('li').height(new_panel_height+57);
							$('.panel_'+el).attr('xdh',new_panel_height+57)
							}
						}
					else{
						$('.wrapper_panels').height($('.panels').height()+40);
						}
					$('.btn_closepanel').css('top',$('.wrapper_panels').height()-23);
					$('.btn_closepanel').show();
					toolstop.elprev=toolstop.elcurr;
			 },
		thide: function(el,part){
					$('.btn_'+el).find('.ico_btn img').removeClass('over_clicked');	
					$('.panel_'+el).hide();	
					$('.btn_closepanel').hide();
					if(part==1){
						$('.wrapper_panels').hide();
						}
			},
		slideobj: function(el,nr){
				if($.inArray(el, toolstop.slide_active)!=-1) return;
				toolstop.slide_active.push(el);
				$(el).jCarouselLite({
					  btnNext: ".btn_next>a",
					  btnPrev: ".btn_prev>a",
					  circular: false,
					  speed: 500,
					  visible: nr
					  });
				
			}	
}

function mng_newsftr(){
		$('#btn_newsftr').click(function(){
										if($('.news_footer').css('display')=='none'){
											$('.news_footer').show();
											mng_wrapper_swftop();
											$.scrollTo('max',1000);
											}
										else{
											$('.news_footer').hide();
											}	
										return false;	
										});
		$('.close_newsftr>a').click(function(){										  
										$('.news_footer').hide();
										return false;	
										});
	}


var mng_msx={
	init : function(){
		$('.col_msx a[class!=addthis_button]').each(function(i){
										$(this).append('<img src="'+abspath+'/img/shared/msx_btm.gif" />');
										if($(this).parent().find('ul').length>=1){
											$(this).parent().find('ul').attr('id','ivecomsx_'+i);
											
											}
										$(this).click(function(){
															 if($(this).attr('href')=='#'&&$(this).next('ul')){
																var idel=$(this).next('ul').attr('id');
																
																mng_msx.mopen(idel);
																mng_msx.mclose(idel);
																return false;
																}
															   })
											 });
		
		
		
		},
	mopen : function(idel){
			$('#'+idel).slideDown('fast');
			$('#'+idel).parent().addClass('on');	
		},
	mclose : function(idel){
			
				$('#'+idel).parent('li').siblings('li').find('ul').slideUp('fast');
				$('#'+idel).parent('li').siblings('li').removeClass('on');
			
		}		
}

var sel_mkt={
		init : function(){
				$('#choose_lang>a').click(function(){
												   $('#select_market').show();
												   });
				$('#wlc_iveco').click(function(){
												   $('#select_market').show()
												   });
				$('#close_selmkt>a').click(function(){
												   $('#select_market').hide();
												   });
			}
	}

var menus={
		curr_el: '',
		prev_el: '',
		set_ev: function(el){
		$(el+'>li>a').each(function(i){
								$(this).parent().find('ul').eq(0).attr('id','mt_'+i);	
								$(this).parent().find('ul').eq(0).prepend('<img src="../../../SiteCollectionImages/Iveco/img/shared/bg_mtop_top.jpg" class="bg_top_mtop" />')
								$(this).hover(function(){
												$(this).find('img').addClass('over');	   
													   },
											function(){
											   $(this).find('img').removeClass('over');		
												});
								$(this).click(function(){
													if($(this).parent().find('ul').length>=1){
															var elid=$(this).parent().find('ul').attr('id');
															if(elid==menus.curr_el&&$('#'+elid).css('display')=='block') return;
															if(menus.curr_el!=''){
																menus.prev_el=menus.curr_el;
																}
															menus.open_menu(elid);
															menus.curr_el=elid;
															menus.close_menu();
															return false;
															}
													   });
						});
			$('#btn_cmtop>a').click(function(){
									$('#'+menus.curr_el).hide();  
									$('#btn_cmtop').hide();
									});	
			},
		open_menu: function(elid){
				if($('#'+elid).find('li').length>=3&&$('#'+elid).find('li').length<=4){
					$('#'+elid).css('paddingLeft','180px')
					$('#'+elid).css('width','810px')
					}
				if($('#'+elid).find('li').length<=3){
					$('#'+elid).css('paddingLeft','280px')
					$('#'+elid).css('width','710px')
					}	
				$('#'+elid).show();  
				$('#btn_cmtop').css('top',138+$('#'+elid).height());
				$('#btn_cmtop').show();
			},	
		close_menu: function(){
					if(menus.prev_el!=''&&menus.prev_el!=menus.curr_el){
						$('#'+menus.prev_el).hide();  
						}
			}
	}

/********UTILS********/
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
(function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},o||{});return this.each(function(){var b=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var c=$(this),ul=$("ul",c),tLi=$("li",ul),tl=tLi.size(),v=o.visible;if(o.circular){ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());o.start+=v}var f=$("li",ul),itemLength=f.size(),curr=o.start;c.css("visibility","visible");f.css({overflow:"hidden",float:o.vertical?"none":"left"});ul.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});c.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var g=o.vertical?height(f):width(f);var h=g*itemLength;var j=g*v;f.css({width:f.width(),height:f.height()});ul.css(sizeCss,h+"px").css(animCss,-(curr*g));c.css(sizeCss,j+"px");if(o.btnPrev)$(o.btnPrev).click(function(){return go(curr-o.scroll)});if(o.btnNext)$(o.btnNext).click(function(){return go(curr+o.scroll)});if(o.btnGo)$.each(o.btnGo,function(i,a){$(a).click(function(){return go(o.circular?o.visible+i:i)})});if(o.mouseWheel&&c.mousewheel)c.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll)});if(o.auto)setInterval(function(){go(curr+o.scroll)},o.auto+o.speed);function vis(){return f.slice(curr).slice(0,v)};function go(a){if(!b){if(o.beforeStart)o.beforeStart.call(this,vis());if(o.circular){if(a<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*g)+"px");curr=a==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll}else if(a>=itemLength-v+1){ul.css(animCss,-((v)*g)+"px");curr=a==itemLength-v+1?v+1:v+o.scroll}else curr=a}else{if(a<0||a>itemLength-v)return;else curr=a}b=true;ul.animate(animCss=="left"?{left:-(curr*g)}:{top:-(curr*g)},o.speed,o.easing,function(){if(o.afterEnd)o.afterEnd.call(this,vis());b=false});if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled")}}return false}})};function css(a,b){return parseInt($.css(a[0],b))||0};function width(a){return a[0].offsetWidth+css(a,'marginLeft')+css(a,'marginRight')};function height(a){return a[0].offsetHeight+css(a,'marginTop')+css(a,'marginBottom')}})(jQuery);

/*
 * jQuery validation plug-in 1.6
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
 * http://docs.jquery.com/Plugins/Validation
 *
 * Copyright (c) 2006 - 2008 Jörn Zaefferer
 *
 * $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z joern.zaefferer $
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(7($){$.H($.2O,{1d:7(d){l(!6.F){d&&d.24&&2Y.1H&&1H.52("3v 3o, 4N\'t 1d, 67 3v");8}p c=$.17(6[0],\'v\');l(c){8 c}c=2e $.v(d,6[0]);$.17(6[0],\'v\',c);l(c.q.3u){6.3r("1B, 3j").1n(".4G").3b(7(){c.3a=w});l(c.q.35){6.3r("1B, 3j").1n(":23").3b(7(){c.1V=6})}6.23(7(b){l(c.q.24)b.5N();7 2m(){l(c.q.35){l(c.1V){p a=$("<1B 1A=\'5v\'/>").1p("u",c.1V.u).2M(c.1V.Z).51(c.U)}c.q.35.11(c,c.U);l(c.1V){a.3A()}8 I}8 w}l(c.3a){c.3a=I;8 2m()}l(c.M()){l(c.1a){c.1l=w;8 I}8 2m()}16{c.2h();8 I}})}8 c},J:7(){l($(6[0]).2Z(\'M\')){8 6.1d().M()}16{p b=w;p a=$(6[0].M).1d();6.P(7(){b&=a.L(6)});8 b}},4F:7(c){p d={},$L=6;$.P(c.1O(/\\s/),7(a,b){d[b]=$L.1p(b);$L.6c(b)});8 d},1f:7(h,k){p f=6[0];l(h){p i=$.17(f.M,\'v\').q;p d=i.1f;p c=$.v.2D(f);22(h){1b"1e":$.H(c,$.v.1N(k));d[f.u]=c;l(k.G)i.G[f.u]=$.H(i.G[f.u],k.G);2K;1b"3A":l(!k){S d[f.u];8 c}p e={};$.P(k.1O(/\\s/),7(a,b){e[b]=c[b];S c[b]});8 e}}p g=$.v.42($.H({},$.v.3Y(f),$.v.3W(f),$.v.3U(f),$.v.2D(f)),f);l(g.14){p j=g.14;S g.14;g=$.H({14:j},g)}8 g}});$.H($.5s[":"],{5p:7(a){8!$.1q(""+a.Z)},5i:7(a){8!!$.1q(""+a.Z)},5f:7(a){8!a.4l}});$.v=7(b,a){6.q=$.H({},$.v.33,b);6.U=a;6.3I()};$.v.W=7(c,b){l(T.F==1)8 7(){p a=$.3D(T);a.4V(c);8 $.v.W.1Q(6,a)};l(T.F>2&&b.29!=3x){b=$.3D(T).4R(1)}l(b.29!=3x){b=[b]}$.P(b,7(i,n){c=c.1P(2e 3s("\\\\{"+i+"\\\\}","g"),n)});8 c};$.H($.v,{33:{G:{},2d:{},1f:{},19:"3p",26:"J",2C:"4Q",2h:w,3l:$([]),2A:$([]),3u:w,3i:[],3Q:I,4O:7(a){6.3e=a;l(6.q.4M&&!6.4J){6.q.1L&&6.q.1L.11(6,a,6.q.19,6.q.26);6.1K(a).2y()}},4E:7(a){l(!6.1D(a)&&(a.u V 6.1c||!6.K(a))){6.L(a)}},6b:7(a){l(a.u V 6.1c||a==6.4y){6.L(a)}},69:7(a){l(a.u V 6.1c)6.L(a);16 l(a.4v.u V 6.1c)6.L(a.4v)},38:7(a,c,b){$(a).1Y(c).2w(b)},1L:7(a,c,b){$(a).2w(c).1Y(b)}},65:7(a){$.H($.v.33,a)},G:{14:"61 4q 2Z 14.",1r:"N 2L 6 4q.",1I:"N O a J 1I 60.",1v:"N O a J 5X.",1u:"N O a J 1u.",2q:"N O a J 1u (5R).",1s:"N O a J 1s.",1U:"N O 5P 1U.",2c:"N O a J 5O 5M 1s.",2n:"N O 47 5I Z 5H.",44:"N O a Z 5C a J 5B.",18:$.v.W("N O 3X 5y 2X {0} 2W."),1z:$.v.W("N O 5x 5w {0} 2W."),2j:$.v.W("N O a Z 3V {0} 45 {1} 2W 5q."),2i:$.v.W("N O a Z 3V {0} 45 {1}."),1x:$.v.W("N O a Z 5k 2X 3L 3K 48 {0}."),1F:$.v.W("N O a Z 5d 2X 3L 3K 48 {0}.")},3J:I,5b:{3I:7(){6.2r=$(6.q.2A);6.4i=6.2r.F&&6.2r||$(6.U);6.2s=$(6.q.3l).1e(6.q.2A);6.1c={};6.55={};6.1a=0;6.1i={};6.1g={};6.21();p f=(6.2d={});$.P(6.q.2d,7(d,c){$.P(c.1O(/\\s/),7(a,b){f[b]=d})});p e=6.q.1f;$.P(e,7(b,a){e[b]=$.v.1N(a)});7 1C(a){p b=$.17(6[0].M,"v");b.q["4A"+a.1A]&&b.q["4A"+a.1A].11(b,6[0])}$(6.U).1C("3F 3E 4W",":3C, :4U, :4T, 2b, 4S",1C).1C("3b",":3B, :3z, 2b, 3y",1C);l(6.q.3w)$(6.U).2J("1g-M.1d",6.q.3w)},M:7(){6.3t();$.H(6.1c,6.1w);6.1g=$.H({},6.1w);l(!6.J())$(6.U).2H("1g-M",[6]);6.1m();8 6.J()},3t:7(){6.2G();Q(p i=0,13=(6.27=6.13());13[i];i++){6.28(13[i])}8 6.J()},L:7(a){a=6.2F(a);6.4y=a;6.2E(a);6.27=$(a);p b=6.28(a);l(b){S 6.1g[a.u]}16{6.1g[a.u]=w}l(!6.3q()){6.12=6.12.1e(6.2s)}6.1m();8 b},1m:7(b){l(b){$.H(6.1w,b);6.R=[];Q(p c V b){6.R.2a({1j:b[c],L:6.2f(c)[0]})}6.1k=$.3n(6.1k,7(a){8!(a.u V b)})}6.q.1m?6.q.1m.11(6,6.1w,6.R):6.3m()},2B:7(){l($.2O.2B)$(6.U).2B();6.1c={};6.2G();6.2T();6.13().2w(6.q.19)},3q:7(){8 6.2g(6.1g)},2g:7(a){p b=0;Q(p i V a)b++;8 b},2T:7(){6.2P(6.12).2y()},J:7(){8 6.3N()==0},3N:7(){8 6.R.F},2h:7(){l(6.q.2h){3O{$(6.3h()||6.R.F&&6.R[0].L||[]).1n(":4P").3g()}3f(e){}}},3h:7(){p a=6.3e;8 a&&$.3n(6.R,7(n){8 n.L.u==a.u}).F==1&&a},13:7(){p a=6,2U={};8 $([]).1e(6.U.13).1n(":1B").1R(":23, :21, :4L, [4K]").1R(6.q.3i).1n(7(){!6.u&&a.q.24&&2Y.1H&&1H.3p("%o 4I 3X u 4H",6);l(6.u V 2U||!a.2g($(6).1f()))8 I;2U[6.u]=w;8 w})},2F:7(a){8 $(a)[0]},2z:7(){8 $(6.q.2C+"."+6.q.19,6.4i)},21:7(){6.1k=[];6.R=[];6.1w={};6.1o=$([]);6.12=$([]);6.27=$([])},2G:7(){6.21();6.12=6.2z().1e(6.2s)},2E:7(a){6.21();6.12=6.1K(a)},28:7(d){d=6.2F(d);l(6.1D(d)){d=6.2f(d.u)[0]}p a=$(d).1f();p c=I;Q(Y V a){p b={Y:Y,2l:a[Y]};3O{p f=$.v.1T[Y].11(6,d.Z.1P(/\\r/g,""),d,b.2l);l(f=="1S-1Z"){c=w;4D}c=I;l(f=="1i"){6.12=6.12.1R(6.1K(d));8}l(!f){6.3c(d,b);8 I}}3f(e){6.q.24&&2Y.1H&&1H.4C("6g 6f 6e 6d L "+d.4z+", 28 47 \'"+b.Y+"\' Y",e);6a e;}}l(c)8;l(6.2g(a))6.1k.2a(d);8 w},4x:7(a,b){l(!$.1y)8;p c=6.q.39?$(a).1y()[6.q.39]:$(a).1y();8 c&&c.G&&c.G[b]},4w:7(a,b){p m=6.q.G[a];8 m&&(m.29==4u?m:m[b])},4t:7(){Q(p i=0;i<T.F;i++){l(T[i]!==20)8 T[i]}8 20},2x:7(a,b){8 6.4t(6.4w(a.u,b),6.4x(a,b),!6.q.3Q&&a.68||20,$.v.G[b],"<4s>66: 64 1j 63 Q "+a.u+"</4s>")},3c:7(b,a){p c=6.2x(b,a.Y),36=/\\$?\\{(\\d+)\\}/g;l(1h c=="7"){c=c.11(6,a.2l,b)}16 l(36.15(c)){c=2v.W(c.1P(36,\'{$1}\'),a.2l)}6.R.2a({1j:c,L:b});6.1w[b.u]=c;6.1c[b.u]=c},2P:7(a){l(6.q.2u)a=a.1e(a.4p(6.q.2u));8 a},3m:7(){Q(p i=0;6.R[i];i++){p a=6.R[i];6.q.38&&6.q.38.11(6,a.L,6.q.19,6.q.26);6.34(a.L,a.1j)}l(6.R.F){6.1o=6.1o.1e(6.2s)}l(6.q.1G){Q(p i=0;6.1k[i];i++){6.34(6.1k[i])}}l(6.q.1L){Q(p i=0,13=6.4o();13[i];i++){6.q.1L.11(6,13[i],6.q.19,6.q.26)}}6.12=6.12.1R(6.1o);6.2T();6.2P(6.1o).4n()},4o:7(){8 6.27.1R(6.4m())},4m:7(){8 $(6.R).3d(7(){8 6.L})},34:7(a,c){p b=6.1K(a);l(b.F){b.2w().1Y(6.q.19);b.1p("4k")&&b.4j(c)}16{b=$("<"+6.q.2C+"/>").1p({"Q":6.32(a),4k:w}).1Y(6.q.19).4j(c||"");l(6.q.2u){b=b.2y().4n().5Z("<"+6.q.2u+"/>").4p()}l(!6.2r.5Y(b).F)6.q.4h?6.q.4h(b,$(a)):b.5W(a)}l(!c&&6.q.1G){b.3C("");1h 6.q.1G=="1t"?b.1Y(6.q.1G):6.q.1G(b)}6.1o=6.1o.1e(b)},1K:7(a){p b=6.32(a);8 6.2z().1n(7(){8 $(6).1p(\'Q\')==b})},32:7(a){8 6.2d[a.u]||(6.1D(a)?a.u:a.4z||a.u)},1D:7(a){8/3B|3z/i.15(a.1A)},2f:7(d){p c=6.U;8 $(5V.5U(d)).3d(7(a,b){8 b.M==c&&b.u==d&&b||4g})},1M:7(a,b){22(b.4f.3k()){1b\'2b\':8 $("3y:3o",b).F;1b\'1B\':l(6.1D(b))8 6.2f(b.u).1n(\':4l\').F}8 a.F},4e:7(b,a){8 6.2I[1h b]?6.2I[1h b](b,a):w},2I:{"5Q":7(b,a){8 b},"1t":7(b,a){8!!$(b,a.M).F},"7":7(b,a){8 b(a)}},K:7(a){8!$.v.1T.14.11(6,$.1q(a.Z),a)&&"1S-1Z"},4d:7(a){l(!6.1i[a.u]){6.1a++;6.1i[a.u]=w}},4c:7(a,b){6.1a--;l(6.1a<0)6.1a=0;S 6.1i[a.u];l(b&&6.1a==0&&6.1l&&6.M()){$(6.U).23();6.1l=I}16 l(!b&&6.1a==0&&6.1l){$(6.U).2H("1g-M",[6]);6.1l=I}},2o:7(a){8 $.17(a,"2o")||$.17(a,"2o",{31:4g,J:w,1j:6.2x(a,"1r")})}},1J:{14:{14:w},1I:{1I:w},1v:{1v:w},1u:{1u:w},2q:{2q:w},4b:{4b:w},1s:{1s:w},4a:{4a:w},1U:{1U:w},2c:{2c:w}},49:7(a,b){a.29==4u?6.1J[a]=b:$.H(6.1J,a)},3W:7(b){p a={};p c=$(b).1p(\'5L\');c&&$.P(c.1O(\' \'),7(){l(6 V $.v.1J){$.H(a,$.v.1J[6])}});8 a},3U:7(c){p a={};p d=$(c);Q(Y V $.v.1T){p b=d.1p(Y);l(b){a[Y]=b}}l(a.18&&/-1|5K|5J/.15(a.18)){S a.18}8 a},3Y:7(a){l(!$.1y)8{};p b=$.17(a.M,\'v\').q.39;8 b?$(a).1y()[b]:$(a).1y()},2D:7(b){p a={};p c=$.17(b.M,\'v\');l(c.q.1f){a=$.v.1N(c.q.1f[b.u])||{}}8 a},42:7(d,e){$.P(d,7(c,b){l(b===I){S d[c];8}l(b.30||b.2t){p a=w;22(1h b.2t){1b"1t":a=!!$(b.2t,e.M).F;2K;1b"7":a=b.2t.11(e,e);2K}l(a){d[c]=b.30!==20?b.30:w}16{S d[c]}}});$.P(d,7(a,b){d[a]=$.46(b)?b(e):b});$.P([\'1z\',\'18\',\'1F\',\'1x\'],7(){l(d[6]){d[6]=2Q(d[6])}});$.P([\'2j\',\'2i\'],7(){l(d[6]){d[6]=[2Q(d[6][0]),2Q(d[6][1])]}});l($.v.3J){l(d.1F&&d.1x){d.2i=[d.1F,d.1x];S d.1F;S d.1x}l(d.1z&&d.18){d.2j=[d.1z,d.18];S d.1z;S d.18}}l(d.G){S d.G}8 d},1N:7(a){l(1h a=="1t"){p b={};$.P(a.1O(/\\s/),7(){b[6]=w});a=b}8 a},5G:7(c,a,b){$.v.1T[c]=a;$.v.G[c]=b!=20?b:$.v.G[c];l(a.F<3){$.v.49(c,$.v.1N(c))}},1T:{14:7(c,d,a){l(!6.4e(a,d))8"1S-1Z";22(d.4f.3k()){1b\'2b\':p b=$(d).2M();8 b&&b.F>0;1b\'1B\':l(6.1D(d))8 6.1M(c,d)>0;5F:8 $.1q(c).F>0}},1r:7(f,h,j){l(6.K(h))8"1S-1Z";p g=6.2o(h);l(!6.q.G[h.u])6.q.G[h.u]={};g.43=6.q.G[h.u].1r;6.q.G[h.u].1r=g.1j;j=1h j=="1t"&&{1v:j}||j;l(g.31!==f){g.31=f;p k=6;6.4d(h);p i={};i[h.u]=f;$.2R($.H(w,{1v:j,41:"2S",40:"1d"+h.u,5A:"5z",17:i,1G:7(d){k.q.G[h.u].1r=g.43;p b=d===w;l(b){p e=k.1l;k.2E(h);k.1l=e;k.1k.2a(h);k.1m()}16{p a={};p c=(g.1j=d||k.2x(h,"1r"));a[h.u]=$.46(c)?c(f):c;k.1m(a)}g.J=b;k.4c(h,b)}},j));8"1i"}16 l(6.1i[h.u]){8"1i"}8 g.J},1z:7(b,c,a){8 6.K(c)||6.1M($.1q(b),c)>=a},18:7(b,c,a){8 6.K(c)||6.1M($.1q(b),c)<=a},2j:7(b,d,a){p c=6.1M($.1q(b),d);8 6.K(d)||(c>=a[0]&&c<=a[1])},1F:7(b,c,a){8 6.K(c)||b>=a},1x:7(b,c,a){8 6.K(c)||b<=a},2i:7(b,c,a){8 6.K(c)||(b>=a[0]&&b<=a[1])},1I:7(a,b){8 6.K(b)||/^((([a-z]|\\d|[!#\\$%&\'\\*\\+\\-\\/=\\?\\^X`{\\|}~]|[\\y-\\x\\E-\\C\\A-\\B])+(\\.([a-z]|\\d|[!#\\$%&\'\\*\\+\\-\\/=\\?\\^X`{\\|}~]|[\\y-\\x\\E-\\C\\A-\\B])+)*)|((\\3T)((((\\2k|\\1X)*(\\2V\\3S))?(\\2k|\\1X)+)?(([\\3R-\\5u\\3P\\3M\\5t-\\5r\\3Z]|\\5D|[\\5E-\\5o]|[\\5n-\\5m]|[\\y-\\x\\E-\\C\\A-\\B])|(\\\\([\\3R-\\1X\\3P\\3M\\2V-\\3Z]|[\\y-\\x\\E-\\C\\A-\\B]))))*(((\\2k|\\1X)*(\\2V\\3S))?(\\2k|\\1X)+)?(\\3T)))@((([a-z]|\\d|[\\y-\\x\\E-\\C\\A-\\B])|(([a-z]|\\d|[\\y-\\x\\E-\\C\\A-\\B])([a-z]|\\d|-|\\.|X|~|[\\y-\\x\\E-\\C\\A-\\B])*([a-z]|\\d|[\\y-\\x\\E-\\C\\A-\\B])))\\.)+(([a-z]|[\\y-\\x\\E-\\C\\A-\\B])|(([a-z]|[\\y-\\x\\E-\\C\\A-\\B])([a-z]|\\d|-|\\.|X|~|[\\y-\\x\\E-\\C\\A-\\B])*([a-z]|[\\y-\\x\\E-\\C\\A-\\B])))\\.?$/i.15(a)},1v:7(a,b){8 6.K(b)||/^(5l?|5j):\\/\\/(((([a-z]|\\d|-|\\.|X|~|[\\y-\\x\\E-\\C\\A-\\B])|(%[\\1W-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:)*@)?(((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5]))|((([a-z]|\\d|[\\y-\\x\\E-\\C\\A-\\B])|(([a-z]|\\d|[\\y-\\x\\E-\\C\\A-\\B])([a-z]|\\d|-|\\.|X|~|[\\y-\\x\\E-\\C\\A-\\B])*([a-z]|\\d|[\\y-\\x\\E-\\C\\A-\\B])))\\.)+(([a-z]|[\\y-\\x\\E-\\C\\A-\\B])|(([a-z]|[\\y-\\x\\E-\\C\\A-\\B])([a-z]|\\d|-|\\.|X|~|[\\y-\\x\\E-\\C\\A-\\B])*([a-z]|[\\y-\\x\\E-\\C\\A-\\B])))\\.?)(:\\d*)?)(\\/((([a-z]|\\d|-|\\.|X|~|[\\y-\\x\\E-\\C\\A-\\B])|(%[\\1W-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)+(\\/(([a-z]|\\d|-|\\.|X|~|[\\y-\\x\\E-\\C\\A-\\B])|(%[\\1W-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)*)*)?)?(\\?((([a-z]|\\d|-|\\.|X|~|[\\y-\\x\\E-\\C\\A-\\B])|(%[\\1W-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)|[\\5h-\\5g]|\\/|\\?)*)?(\\#((([a-z]|\\d|-|\\.|X|~|[\\y-\\x\\E-\\C\\A-\\B])|(%[\\1W-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)|\\/|\\?)*)?$/i.15(a)},1u:7(a,b){8 6.K(b)||!/5e|5S/.15(2e 5T(a))},2q:7(a,b){8 6.K(b)||/^\\d{4}[\\/-]\\d{1,2}[\\/-]\\d{1,2}$/.15(a)},1s:7(a,b){8 6.K(b)||/^-?(?:\\d+|\\d{1,3}(?:,\\d{3})+)(?:\\.\\d+)?$/.15(a)},1U:7(a,b){8 6.K(b)||/^\\d+$/.15(a)},2c:7(b,e){l(6.K(e))8"1S-1Z";l(/[^0-9-]+/.15(b))8 I;p a=0,d=0,2p=I;b=b.1P(/\\D/g,"");Q(p n=b.F-1;n>=0;n--){p c=b.5c(n);p d=5a(c,10);l(2p){l((d*=2)>9)d-=9}a+=d;2p=!2p}8(a%10)==0},44:7(b,c,a){a=1h a=="1t"?a.1P(/,/g,\'|\'):"59|58?g|57";8 6.K(c)||b.62(2e 3s(".("+a+")$","i"))},2n:7(c,d,a){p b=$(a).56(".1d-2n").2J("4B.1d-2n",7(){$(d).J()});8 c==b.2M()}}});$.W=$.v.W})(2v);(7($){p c=$.2R;p d={};$.2R=7(a){a=$.H(a,$.H({},$.54,a));p b=a.40;l(a.41=="2S"){l(d[b]){d[b].2S()}8(d[b]=c.1Q(6,T))}8 c.1Q(6,T)}})(2v);(7($){$.P({3g:\'3F\',4B:\'3E\'},7(b,a){$.1E.37[a]={53:7(){l($.3H.4r)8 I;6.50(b,$.1E.37[a].2N,w)},4Z:7(){l($.3H.4r)8 I;6.4Y(b,$.1E.37[a].2N,w)},2N:7(e){T[0]=$.1E.2L(e);T[0].1A=a;8 $.1E.2m.1Q(6,T)}}});$.H($.2O,{1C:7(d,e,c){8 6.2J(d,7(a){p b=$(a.3G);l(b.2Z(e)){8 c.1Q(b,T)}})},4X:7(a,b){8 6.2H(a,[$.1E.2L({1A:a,3G:b})])}})})(2v);',62,389,'||||||this|function|return|||||||||||||if||||var|settings||||name|validator|true|uD7FF|u00A0||uFDF0|uFFEF|uFDCF||uF900|length|messages|extend|false|valid|optional|element|form|Please|enter|each|for|errorList|delete|arguments|currentForm|in|format|_|method|value||call|toHide|elements|required|test|else|data|maxlength|errorClass|pendingRequest|case|submitted|validate|add|rules|invalid|typeof|pending|message|successList|formSubmitted|showErrors|filter|toShow|attr|trim|remote|number|string|date|url|errorMap|max|metadata|minlength|type|input|delegate|checkable|event|min|success|console|email|classRuleSettings|errorsFor|unhighlight|getLength|normalizeRule|split|replace|apply|not|dependency|methods|digits|submitButton|da|x09|addClass|mismatch|undefined|reset|switch|submit|debug||validClass|currentElements|check|constructor|push|select|creditcard|groups|new|findByName|objectLength|focusInvalid|range|rangelength|x20|parameters|handle|equalTo|previousValue|bEven|dateISO|labelContainer|containers|depends|wrapper|jQuery|removeClass|defaultMessage|hide|errors|errorLabelContainer|resetForm|errorElement|staticRules|prepareElement|clean|prepareForm|triggerHandler|dependTypes|bind|break|fix|val|handler|fn|addWrapper|Number|ajax|abort|hideErrors|rulesCache|x0d|characters|than|window|is|param|old|idOrName|defaults|showLabel|submitHandler|theregex|special|highlight|meta|cancelSubmit|click|formatAndAdd|map|lastActive|catch|focus|findLastActive|ignore|button|toLowerCase|errorContainer|defaultShowErrors|grep|selected|error|numberOfInvalids|find|RegExp|checkForm|onsubmit|nothing|invalidHandler|Array|option|checkbox|remove|radio|text|makeArray|focusout|focusin|target|browser|init|autoCreateRanges|equal|or|x0c|size|try|x0b|ignoreTitle|x01|x0a|x22|attributeRules|between|classRules|no|metadataRules|x7f|port|mode|normalizeRules|originalMessage|accept|and|isFunction|the|to|addClassRules|numberDE|dateDE|stopRequest|startRequest|depend|nodeName|null|errorPlacement|errorContext|html|generated|checked|invalidElements|show|validElements|parent|field|msie|strong|findDefined|String|parentNode|customMessage|customMetaMessage|lastElement|id|on|blur|log|continue|onfocusout|removeAttrs|cancel|assigned|has|blockFocusCleanup|disabled|image|focusCleanup|can|onfocusin|visible|label|slice|textarea|file|password|unshift|keyup|triggerEvent|removeEventListener|teardown|addEventListener|appendTo|warn|setup|ajaxSettings|valueCache|unbind|gif|jpe|png|parseInt|prototype|charAt|greater|Invalid|unchecked|uF8FF|uE000|filled|ftp|less|https|x7e|x5d|x5b|blank|long|x1f|expr|x0e|x08|hidden|least|at|more|json|dataType|extension|with|x21|x23|default|addMethod|again|same|524288|2147483647|class|card|preventDefault|credit|only|boolean|ISO|NaN|Date|getElementsByName|document|insertAfter|URL|append|wrap|address|This|match|defined|No|setDefaults|Warning|returning|title|onclick|throw|onkeyup|removeAttr|checking|when|occured|exception'.split('|'),0,{}));
/*
 * jqModal - Minimalist Modaling with jQuery
 *   (http://dev.iceburg.net/jquery/jqModal/)
 *
 * Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net>
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 * 
 * $Version: 03/01/2009 +r14
 */
(function($) {
$.fn.jqm=function(o){
var p={
overlay: 50,
overlayClass: 'jqmOverlay',
closeClass: 'jqmClose',
trigger: '.jqModal',
ajax: F,
ajaxText: '',
target: F,
modal: F,
toTop: F,
onShow: F,
onHide: F,
onLoad: F
};
return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s;
H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s};
if(p.trigger)$(this).jqmAddTrigger(p.trigger);
});};

$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');};
$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');};
$.fn.jqmShow=function(t){return this.each(function(){t=t||window.event;$.jqm.open(this._jqm,t);});};
$.fn.jqmHide=function(t){return this.each(function(){t=t||window.event;$.jqm.close(this._jqm,t)});};

$.jqm = {
hash:{},
open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),z=(z>0)?z:3000,o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z);
 if(c.modal) {if(!A[0])L('bind');A.push(s);}
 else if(c.overlay > 0)h.w.jqmAddClose(o);
 else o=F;

 h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F;
 if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}}

 if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;
  r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}
 else if(cc)h.w.jqmAddClose($(cc,h.w));

 if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);	
 (c.onShow)?c.onShow(h):h.w.show();e(h);return F;
},
close:function(s){var h=H[s];if(!h.a)return F;h.a=F;
 if(A[0]){A.pop();if(!A[0])L('unbind');}
 if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove();
 if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F;
},
params:{}};
var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),F=false,
i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),
e=function(h){if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);},
f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}},
L=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);},
m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;},
hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() {
 if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});};
})(jQuery);
