var $j = jQuery.noConflict();

$j(document).ready(function(){
  // BodyFade();
 
  ImageCycle();
  
  
     $j('.hover').hover(function()
     {
     $j(this).children("a").animate( { marginLeft: "5px" }, 200  );
     },
     function()
     {
     $j(this).children("a").animate( { opacity: 1.0, marginLeft: "0px" }, 200  );
     });
	 
	 
	 
	 
	 					$j('#news').innerfade({
						animationtype: 'fade',
						speed: 1250,
						timeout: 3000,
						type: 'random',
						containerheight: '20px'
					});
					
					$j('ul#portfolio').innerfade({
						speed: 1000,
						timeout: 5000,
						type: 'sequence',
						containerheight: '220px'
					});
					
					$j('.fade').innerfade({
						speed: 1000,
						timeout: 6000,
						type: 'random_start',
						containerheight: '1.5em'
					});
					
					$j('.adi').innerfade({
						speed: 'slow',
						timeout: 5000,
						type: 'random',
						containerheight: '150px'
					});
					
					
					
	   
	   
  
  if( detectBrowser())
  {// browser Check Start
  // if not IE 6 then do this Code.
		ImageFadeinOut()// 
  } // browser Check Start 

});




















/*-----------------------------------------------------------------------------------------------------------------------------
* Function: detectBrowser
* Description: This function Check browser and verson for IE 6  and Return True or false
* Return Type: True(1)/ False(null) 
* Author: Tanvir Ahmad Ronty
    ---------------------------------------------------------------------------------------------------------------------------*/

function detectBrowser()
{
var browser=navigator.appName;
var b_version=navigator.appVersion;
var version=parseFloat(b_version);
if ((browser=="Microsoft Internet Explorer") && (version<=6))
	{
	return false;
	}
else
	{
	return true;
	}
}


/*-----------------------------------------------------------------------------------------------------------------------------
* Function: ImageCycle
* Description: This funciton displays case stufy images one after another.
* Notes: Add 'imagehide' class to all of your image except first image.
* Author: Tanvir Ahmad Ronty
    ---------------------------------------------------------------------------------------------------------------------------*/

function ImageCycle()
{
	$j('#preview img').removeClass("imghide");
	
	$j('#preview').cycle({ 
    fx:    'fade', 
     speed:  500,
	 timeout:  7000 
	 });
}





/*-----------------------------------------------------------------------------------------------------------------------------
* Function: ImageFadeInOut
* Description: This funciton fades in CouchCreative logo and our work thumbnails.
* Notes: Does not work in IE6
* Author: Dhruv Raniga
    ---------------------------------------------------------------------------------------------------------------------------*/

function ImageFadeinOut()
{
	 // img item au demarrage
	$j("img.item").each(function () {
      $j(this).stop().fadeTo(1, 0.4);
    });
	
	// img item au survol
   	$j("img.item").mouseover(function () {
      $j(this).stop().fadeTo("slow", 1);
    });
	
// img item au retour
	$j("img.item").mouseout(function () {
      $j(this).stop().fadeTo("slow", 0.4);
    });
	
	// fading
	$j("img.fading").mouseover(function () {
    	$j(this).stop().fadeTo("slow", 0.4);
    });

	$j("img.fading").mouseout(function () {
     	$j(this).stop().fadeTo("slow", 1);
    });
}








$j(document).ready(function() {
	hoverOpacity.init()
});

hoverOpacity = {
	init : function(){
		$j('a.linkFader').css({

			backgroundPosition:"0px 0px",
			cursor:"pointer"
		})
		$j('a.linkFader').each(function(){
			
			spanFader = document.createElement('span');
			myBG = $j(this).css("background-image")
			
			$j(this).append(spanFader);
		
			myBG = $j(this).css("background-image")
			spanWidth =  $j(this).css("width")
			spanHeight =  $j(this).css("height")
				
			$j(this).find("span").css({
				backgroundImage:myBG,
				backgroundPosition:"bottom right",
				position:"absolute",
				display:"block",
				cursor:"pointer",
				top:"0px",
				left:"0px",
				width:spanWidth,
				height:spanHeight,
				opacity:0,
				visibility:"visible"
			})
		})
		$j("a.linkFader").hover(function () {
			$j(this).find("span").stop()
			$j(this).find("span:not(:animated)").animate({opacity: 1}, 400)
		},
		function () {
			$j(this).find("span").animate({opacity: 0},250)
		});
	}
}























