

// JavaScript Document
	
	var clip_COUNT=0;

	var clip_total_time_interval = new Array();
	
	var clip_fade = new Array();

	var clip_inc_fade = new Array();
	
	var clip_inc_fade_time = new Array();
	
	var target_top_inc_fade_time = new Array();			
	
	var target_width_inc_fade_time = new Array();	
	
	var target_bottom_inc_fade_time = new Array();			
	var target_left_inc_fade_time = new Array();				
	var CLIP_VALUES=new Array();	
		
	CLIP_VALUES['FLAG']=0; 
	
	CLIP_VALUES['FLAG_RUN']=0;  
	
	CLIP_VALUES['call_counter']=0;	// couting iteration   
	
	function clip(object_id,value_top,value_right,value_bottom,value_left,target_value_top,target_value_right,target_value_bottom,target_value_left,fading_millisec,target_values_array) {	
	
		clip_COUNT++;	
			
		CLIP_VALUES['call_counter']++;
			
		clip_fade[clip_COUNT] = 0;
			
		clip_inc_fade[clip_COUNT]= 0;						

		CLIP_VALUES['object_id'+clip_COUNT]=object_id+'_'+clip_COUNT;			
		
		CLIP_VALUES['value_top'+clip_COUNT]=value_top;			
				
		CLIP_VALUES['value_right'+clip_COUNT]=value_right;
			
		CLIP_VALUES['value_bottom'+clip_COUNT]=value_bottom;
			
		CLIP_VALUES['value_left'+clip_COUNT]=value_left;			
			
		CLIP_VALUES['target_value_top'+clip_COUNT]=target_value_top;				// added
			
		CLIP_VALUES['target_value_right'+clip_COUNT]=target_value_right;			// added
			
		CLIP_VALUES['target_value_bottom'+clip_COUNT]=target_value_bottom;			// added
																						
		CLIP_VALUES['target_value_left'+clip_COUNT]=target_value_left;				// added
			
		CLIP_VALUES['fading_millisec'+clip_COUNT]=fading_millisec;
			
			
		if(target_values_array){
			
			CLIP_VALUES['target_values_array'+clip_COUNT] = target_values_array;
			
		}
			
			CLIP_VALUES['clip_top_value'+clip_COUNT] =  CLIP_VALUES['target_value_top'+clip_COUNT] - CLIP_VALUES['value_top'+clip_COUNT] ;			
			CLIP_VALUES['clip_right_value'+clip_COUNT] =  CLIP_VALUES['target_value_right'+clip_COUNT] - CLIP_VALUES['value_right'+clip_COUNT] ;			
			CLIP_VALUES['clip_bottom_value'+clip_COUNT] =  CLIP_VALUES['target_value_bottom'+clip_COUNT] - CLIP_VALUES['value_bottom'+clip_COUNT] ;						
			CLIP_VALUES['clip_left_value'+clip_COUNT] =  CLIP_VALUES['target_value_left'+clip_COUNT] - CLIP_VALUES['value_left'+clip_COUNT] ;					
			document.getElementById(CLIP_VALUES['object_id'+clip_COUNT]).style.clip="rect("+CLIP_VALUES['value_top'+clip_COUNT]+"px,"+CLIP_VALUES['value_right'+clip_COUNT]+"px,"+CLIP_VALUES['value_bottom'+clip_COUNT]+"px,"+CLIP_VALUES['value_left'+clip_COUNT]+"px)";			
			
			if(CLIP_VALUES['clip_top_value'+clip_COUNT] < 0 ){				
			
				CLIP_VALUES['tofixed_target_clip_top'+clip_COUNT]	= CLIP_VALUES['clip_top_value'+clip_COUNT] /  CLIP_VALUES['fading_millisec'+clip_COUNT] ;				
				CLIP_VALUES['target_clip_top'+clip_COUNT]  = CLIP_VALUES['tofixed_target_clip_top'+clip_COUNT].toFixed(2);		// added 				
			}else{
				
				CLIP_VALUES['tofixed_target_clip_top'+clip_COUNT] = CLIP_VALUES['clip_top_value'+clip_COUNT] /  CLIP_VALUES['fading_millisec'+clip_COUNT];				
				CLIP_VALUES['target_clip_top'+clip_COUNT]  = CLIP_VALUES['tofixed_target_clip_top'+clip_COUNT].toFixed(2);			// added 						
			}			
		
			if(CLIP_VALUES['clip_right_value'+clip_COUNT] < 0 ){				
				
				CLIP_VALUES['tofixed_target_clip_right'+clip_COUNT]	= CLIP_VALUES['clip_right_value'+clip_COUNT] /  CLIP_VALUES['fading_millisec'+clip_COUNT] ;				
				CLIP_VALUES['target_clip_right'+clip_COUNT]  = CLIP_VALUES['tofixed_target_clip_right'+clip_COUNT].toFixed(2);		// added 				
			}else{
				
				CLIP_VALUES['tofixed_target_clip_right'+clip_COUNT] = CLIP_VALUES['clip_right_value'+clip_COUNT] /  CLIP_VALUES['fading_millisec'+clip_COUNT];				
				CLIP_VALUES['target_clip_right'+clip_COUNT]  = CLIP_VALUES['tofixed_target_clip_right'+clip_COUNT].toFixed(2);			// added 								
			}
				
			if(CLIP_VALUES['clip_bottom_value'+clip_COUNT] < 0 ){				
				
				CLIP_VALUES['tofixed_target_clip_bottom'+clip_COUNT] = CLIP_VALUES['clip_bottom_value'+clip_COUNT] /  CLIP_VALUES['fading_millisec'+clip_COUNT];				
				CLIP_VALUES['target_clip_bottom'+clip_COUNT]= CLIP_VALUES['tofixed_target_clip_bottom'+clip_COUNT].toFixed(2);						
			}else{
				
				CLIP_VALUES['tofixed_target_clip_bottom'+clip_COUNT] = CLIP_VALUES['clip_bottom_value'+clip_COUNT] / CLIP_VALUES['fading_millisec'+clip_COUNT];				
				CLIP_VALUES['target_clip_bottom'+clip_COUNT]= CLIP_VALUES['tofixed_target_clip_bottom'+clip_COUNT].toFixed(2);
			}
			
			if(CLIP_VALUES['clip_left_value'+clip_COUNT] < 0 ){				
				
				CLIP_VALUES['tofixed_target_clip_left'+clip_COUNT] = CLIP_VALUES['clip_left_value'+clip_COUNT] /  CLIP_VALUES['fading_millisec'+clip_COUNT];				
				CLIP_VALUES['target_clip_left'+clip_COUNT]= CLIP_VALUES['tofixed_target_clip_left'+clip_COUNT].toFixed(2);				
				
			}else{
				
				CLIP_VALUES['tofixed_target_clip_left'+clip_COUNT] = CLIP_VALUES['clip_left_value'+clip_COUNT] / CLIP_VALUES['fading_millisec'+clip_COUNT];				
				CLIP_VALUES['target_clip_left'+clip_COUNT]= CLIP_VALUES['tofixed_target_clip_left'+clip_COUNT].toFixed(2);	
			}
			
			 clip_total_time_interval[clip_COUNT]=setInterval("animation_left("+clip_COUNT+")",CLIP_VALUES['fading_millisec'+clip_COUNT]);					 
			
	} 
		
		
	function animation_left(clip_count) {		
								
			clip_inc_fade_time[clip_count]=Number(clip_inc_fade[clip_count]) * CLIP_VALUES['inc'+clip_count];				
			
			CLIP_VALUES['tofixed_target_top_inc_fade_time'+clip_count] = Number(clip_inc_fade[clip_count]) * CLIP_VALUES['target_clip_top'+clip_count];			
			target_top_inc_fade_time[clip_count] = CLIP_VALUES['tofixed_target_top_inc_fade_time'+clip_COUNT];   		// added 
						
			
			CLIP_VALUES['tofixed_target_width_inc_fade_time'+clip_count] = Number(clip_inc_fade[clip_count]) * CLIP_VALUES['target_clip_right'+clip_count];			
			target_width_inc_fade_time[clip_count] = CLIP_VALUES['tofixed_target_width_inc_fade_time'+clip_COUNT];   		// added 			
			
			CLIP_VALUES['tofixed_target_bottom_inc_fade_time'+clip_count] = Number(clip_inc_fade[clip_count]) * CLIP_VALUES['target_clip_bottom'+clip_count];			
			target_bottom_inc_fade_time[clip_count] = CLIP_VALUES['tofixed_target_bottom_inc_fade_time'+clip_count] ;	// added 			
			
			CLIP_VALUES['tofixed_target_left_inc_fade_time'+clip_count] = Number(clip_inc_fade[clip_count]) * CLIP_VALUES['target_clip_left'+clip_count];			
			target_left_inc_fade_time[clip_count] = CLIP_VALUES['tofixed_target_left_inc_fade_time'+clip_count] ;	// added 
			
			 if(CLIP_VALUES['FLAG']==1){   
				 			  
			document.getElementById(CLIP_VALUES['object_id'+clip_count]).style.clip="rect("+(CLIP_VALUES['value_top'+clip_count]+(Math.floor(target_top_inc_fade_time[clip_count])))+"px,"+(CLIP_VALUES['value_right'+clip_count]+(Math.floor(target_width_inc_fade_time[clip_count])))+"px,"+(CLIP_VALUES['value_bottom'+clip_count]+(Math.floor(target_bottom_inc_fade_time[clip_count])))+"px,"+(CLIP_VALUES['value_left'+clip_count]+(Math.floor(target_left_inc_fade_time[clip_count])))+"px)";				
				CLIP_VALUES['FLAG_RUN']=1;				

				
			}else if(CLIP_VALUES['FLAG']==0){	
			
				document.getElementById(CLIP_VALUES['object_id'+clip_count]).style.clip="rect("+(CLIP_VALUES['value_top'+clip_count]+(Math.floor(target_top_inc_fade_time[clip_count])))+"px,"+(CLIP_VALUES['value_right'+clip_count]+(Math.floor(target_width_inc_fade_time[clip_count])))+"px,"+(CLIP_VALUES['value_bottom'+clip_count]+(Math.floor(target_bottom_inc_fade_time[clip_count])))+"px,"+(CLIP_VALUES['value_left'+clip_count]+(Math.floor(target_left_inc_fade_time[clip_count])))+"px)";				 	
			} 	
	
		CLIP_VALUES['condition_top'+clip_count] =  Number(CLIP_VALUES['value_top'+clip_count]+(Math.floor(target_top_inc_fade_time[clip_count])));		
		CLIP_VALUES['condition_right'+clip_count] = Number(CLIP_VALUES['value_right'+clip_count]+(Math.floor(target_width_inc_fade_time[clip_count])));		
		CLIP_VALUES['condition_bottom'+clip_count] =  Number(CLIP_VALUES['value_bottom'+clip_count]+(Math.floor(target_bottom_inc_fade_time[clip_count])));		
		CLIP_VALUES['condition_left'+clip_count] =  Number(CLIP_VALUES['value_left'+clip_count]+(Math.floor(target_left_inc_fade_time[clip_count])));		
		
		if( 	( CLIP_VALUES['target_clip_top'+clip_COUNT]    < 0 ) ||
				( CLIP_VALUES['target_clip_right'+clip_COUNT]  < 0 ) || 
				( CLIP_VALUES['target_clip_bottom'+clip_COUNT] < 0 ) ||
				( CLIP_VALUES['target_clip_left'+clip_COUNT]   < 0 )  ) {  
			if ( (CLIP_VALUES['condition_top'+clip_count] <= CLIP_VALUES['target_value_top'+clip_count])&&
																		 
				 (CLIP_VALUES['condition_right'+clip_count] <= CLIP_VALUES['target_value_right'+clip_count] )&&
				
				 (CLIP_VALUES['condition_bottom'+clip_count] <= CLIP_VALUES['target_value_bottom'+clip_count])&&
				 
				  (CLIP_VALUES['condition_left'+clip_count] <= CLIP_VALUES['target_value_left'+clip_count]) 
				
				) {					
									
				CLIP_VALUES['next_target_clip_top'+clip_count] = 	Math.floor(CLIP_VALUES['value_top'+clip_count]+(target_top_inc_fade_time[clip_count]) );						
				CLIP_VALUES['next_target_clip_right'+clip_count] =  Math.floor(CLIP_VALUES['value_right'+clip_count]+(target_width_inc_fade_time[clip_count]) );						
				CLIP_VALUES['next_target_clip_bottom'+clip_count] = Math.floor(CLIP_VALUES['value_bottom'+clip_count]+(target_bottom_inc_fade_time[clip_count]) );					  				CLIP_VALUES['next_target_clip_left'+clip_count] =  	Math.floor(CLIP_VALUES['value_left'+clip_count]+(target_left_inc_fade_time[clip_count]) );								
				clip_inc_fade[clip_count]=0;								
				clip_fade[clip_count]=0;								
				
				clearInterval(clip_total_time_interval[clip_COUNT]);															
				setTimeout("doSomething("+CLIP_VALUES['next_target_clip_top'+clip_COUNT] +","+CLIP_VALUES['next_target_clip_right'+clip_COUNT]+","+CLIP_VALUES['next_target_clip_bottom'+clip_COUNT]+","+CLIP_VALUES['next_target_clip_left'+clip_COUNT]+")",80);
			}
			
		} else {				
			
			if(  (CLIP_VALUES['condition_right'+clip_count] >= CLIP_VALUES['target_value_right'+clip_count] ) && (CLIP_VALUES['condition_left'+clip_count] >= CLIP_VALUES['target_value_left'+clip_count]) && (CLIP_VALUES['condition_bottom'+clip_count] >= CLIP_VALUES['target_value_bottom'+clip_count]) && (CLIP_VALUES['condition_top'+clip_count] >= CLIP_VALUES['target_value_top'+clip_count])  ) { 				
				
				CLIP_VALUES['next_target_clip_top'+clip_count] =  Math.floor(CLIP_VALUES['value_top'+clip_count]+(target_top_inc_fade_time[clip_count]) );						
				CLIP_VALUES['next_target_clip_right'+clip_count] =  Math.floor(CLIP_VALUES['value_right'+clip_count]+(target_width_inc_fade_time[clip_count]) );						
				CLIP_VALUES['next_target_clip_bottom'+clip_count] =  Math.floor(CLIP_VALUES['value_bottom'+clip_count]+(target_bottom_inc_fade_time[clip_count]) );				 				CLIP_VALUES['next_target_clip_left'+clip_count] = Math.floor(CLIP_VALUES['value_left'+clip_count]+(target_left_inc_fade_time[clip_count]) );						
				clearInterval(clip_total_time_interval[clip_count]);				
				clip_inc_fade[clip_count]=0;								
				clip_fade[clip_count]=0;					
				setTimeout("doSomething("+CLIP_VALUES['next_target_clip_top'+clip_COUNT] +","+CLIP_VALUES['next_target_clip_right'+clip_COUNT]+","+CLIP_VALUES['next_target_clip_bottom'+clip_COUNT]+","+CLIP_VALUES['next_target_clip_left'+clip_COUNT]+")",80);
			}
		}
			clip_inc_fade[clip_count]++;			
	}
	
	function stop_animation(clip_count) {		
	
		if(CLIP_VALUES['FLAG']==0) {				
			CLIP_VALUES['FLAG']=1;												// 12-4-10 										
			CLIP_VALUES['temp_inc_fade_time']=clip_inc_fade_time[clip_count];										
			CLIP_VALUES['temp_value_bottom']=Number(CLIP_VALUES['value_bottom'+clip_count])+target_bottom_inc_fade_time[clip_count];								
			clearInterval(clip_total_time_interval[clip_count]);		
				
		} else if(CLIP_VALUES['FLAG']==1) {
				
			CLIP_VALUES['FLAG']=0;				
			clip_COUNT=0;
			CLIP_VALUES['call_counter']--;						
			clip('img_front',CLIP_VALUES['value_top'+clip_count]+(Math.floor(target_top_inc_fade_time[clip_count])),CLIP_VALUES['value_right'+clip_count]+(Math.floor(target_width_inc_fade_time[clip_count])),CLIP_VALUES['value_bottom'+clip_count]+(Math.floor(target_bottom_inc_fade_time[clip_count])),CLIP_VALUES['value_left'+clip_count]+(Math.floor(target_left_inc_fade_time[clip_count])),CLIP_VALUES['target_value_top'+clip_count],CLIP_VALUES['target_value_right'+clip_count],CLIP_VALUES['target_value_bottom'+clip_count],CLIP_VALUES['target_value_left'+clip_count],CLIP_VALUES['fading_millisec'+clip_count]);
			CLIP_VALUES['FLAG_RUN']=1;
		}		
	}

	function clip_img(clip_img_array){
		
		temp_img = '<div><img id="img_front_1" name="img_front_1" src="'+clip_img_array[0]+'" style="position:absolute; cursor:pointer;left:39px;top:236px;z-index:1" onclick="onmouseover_func(1);" /><img id="img_back_1" name="img_back_1" src="'+clip_img_array[0]+'" style="filter:Alpha(opacity=20);opacity:0.2;position:absolute;left:39px;top:236px; z-index:0" /></div>';
		document.write(temp_img);
	}
	
	function doSomething(top,right,bottom,left){
		 	
		var temp_array_name = CLIP_VALUES['target_values_array'+clip_COUNT];		
		clip_COUNT=0;   		
		var _obj_value = CLIP_VALUES['call_counter']-1;		
		
		clip('img_front',top,right,bottom,left,temp_array_name[_obj_value].top,temp_array_name[_obj_value].right,temp_array_name[_obj_value].bottom,temp_array_name[_obj_value].left,temp_array_name[_obj_value].tot_millisec);	
		
		if( (CLIP_VALUES['call_counter']-1) == temp_array_name.length ) {	 
						
			CLIP_VALUES['call_counter']=1;						
		}
	}
	
	function clip_img(clip_img_array){		
		
		temp_img = '<span id="front_img"><img id="img_front_1" name="img_front_1" src="'+clip_img_array+'" style="filter:Alpha(opacity=100);opacity:1;position:absolute;z-index:5; cursor:pointer;" onclick="JavScript:stop_animation(1);" /></span><span id="back_img"><img id="img_back_1" name="img_back_1" src="'+clip_img_array+'" style="filter:Alpha(opacity=10);opacity:0.1;"  onclick="JavaScript:stop_animation(1);" /></span>';
		document.write('<div class=left_menu_div>'+temp_img+'</div>');
	}
	
	
