/********************************************************************************************************************************************************
	TOOLTIP
*********************************************************************************************************************************************************/

function tipz() {
	
		$$('div.tipz').each(function(element,index) {
		    var content = element.get('title');
		    element.store('tip:title', content);
		});
		
		//create the tooltips
		var tipz = new Tips('.tipz',{
		    className: 'tipz',
		    fixed: false,
		    showDelay: 0,
		    hideDelay: 0
		});
		  
}


/********************************************************************************************************************************************************
	MOVE X Y
*********************************************************************************************************************************************************/

function moveH(item,x,t){

	item.set('tween', {duration: t});
	item.tween('margin-left', x);
				
}

function moveV(item,y,t){

	item.set('tween', {duration: t});
	item.tween('margin-top', y);
				
}

/********************************************************************************************************************************************************
	GO PAGE
*********************************************************************************************************************************************************/

function goPage(p,b){
	
	if(b == 1) {
	window.open(p);
	}else {
	window.location.href=''+p+'';
	}

}

/********************************************************************************************************************************************************
	AJAX
*********************************************************************************************************************************************************/

function getProjetForGalery(limit) {
    
	
	//var d = $('selectCat').selectedIndex;
	//var v = $('selectCat').options[d].value;
	
	var v = 356;
		
	new Request({
	url: 'getProjetForGalery.php?id='+v+'&limit='+limit+'', 
	evalScripts: true,
	onComplete: function(response) {
	   
	       
				 $('divGalery').set('html', response);
	
 					//Mediabox.scanPage();   
	  
	}}).send();

    
    
}

function getDNS(domain, ext) {
    
	
	//var d = $('selectCat').selectedIndex;
	//var v = $('selectCat').options[d].value;
	
	var v = 356;
		
	new Request({
	url: 'getDNSResponse.php?domain='+domain+'&ext='+ext+'', 
	evalScripts: true,
	onComplete: function(response) {
	   
	       
				 $('divReponse').set('html', response);
	
 					//Mediabox.scanPage();   
	  
	}}).send();

    
    
}



function ajaxMe(data,page,div){

				
		//ajax url
		var url 	= 	page;
		//ajax method (POST or GET)
		var method	=	"POST";
		//data to treatment
		var data 	=	data;
		//DIV traget to append content
		var target 	=	div;
		//target page to load in DIV container
		//var page	=	page;
				
		//init query
		var query	=	new Request({
			
			url: url,
			
			method: method,
			
			data : data,
			
			evalScripts: true,
				
			onFailure: function(instance){
				
				this.fireEvent('ajaxFailure', instance);
				
			}.bind(this),
			
			
			
			onRequest: function(){
								
				$(target).set('html', '<div style="width:100%;text-align:center;margin-top:20px;"><img src="images/ajax-loader.gif"></div>');
			
			}.bind(this),
			
			onSuccess: function(result){
				
				//launch function to success
				this.fireEvent('ajaxSuccess', result); 
					
					//opacity in 0;
					$(target).setStyle('opacity', 0);
	
					//inject content
   					$(target).innerHTML=result;
					
					//fading in opacity
					$(target).fade(1);
					
					//alert('ok');
					
					
						
								
			}.bind(this)
		
		//POST form with inited query 
		}).post(query);
		
}


/********************************************************************************************************************************************************
	MENU
*********************************************************************************************************************************************************/

/*
var s = new Fx.Morph($('menuShadow'), {duration: 500});
s.start({'width': '500px'});
*/

function shadowInputInit() {

	for(i=0;i<6;i++) {
	
		var m = $('m'+i).offsetWidth;
		
		$('mInput'+i).value = m;
	
	}

}

function moveShadow(i,d) {

	var total = 0;
	
	for(z=0;z<i;z++) {
	
		var w = $('mInput'+z).value;
	
		total = parseFloat(total)+parseFloat(w);
	
	}
	
	var m = $('mInput'+i).value;
	
	var total2 = (m-107) / 2; 
	
	var superTotal = parseFloat(total) + parseFloat(total2);
	
	moveH($('menuShadow'),superTotal,d);
	
}

/********************************************************************************************************************************************************
	THUMB
*********************************************************************************************************************************************************/

////require_once('../phpThumb/phpthumb.class.php');          
//function thumb($fileName,$w,$h,$zc=1,$fileOutPut=null){
//
//	
//	
//	$phpThumb 	= 	new phpThumb();
//		
//	//$fileOutPut	=	$path.$folder.substr($fileName,strlen($path));
//	
//	$phpThumb->setSourceData(file_get_contents($fileName));
//	$phpThumb->setParameter('w', $w);
//	$phpThumb->setParameter('h',$h);
//	
//	if($zc==1){
//	
//		$phpThumb->setParameter('zc',1);
//	}
//	
//	
//	if ($phpThumb->GenerateThumbnail()) { // this line is VERY important, do not remove it!
//		
//		if ($phpThumb->RenderToFile($fileOutPut)) {
//			
//		//echo 'Successfully rendered to "'.$fileOutPut.'".<img src="'.$fileOutPut.'">';
//		}
//	} else {
//		// do something with debug/error messages
//		//echo 'Failed:<pre>'.$phpThumb->fatalerror."¥n¥n".implode("¥n¥n", $phpThumb->debugmessages).'</pre>';
//	}
//
//
//	return $fileOutPut;
//}
//


































