// JavaScript Document
var pos;
var slide_state=false;
var tester =false;
var tester1 =false;
var check=0;
var video=0;
$(function()
{
	
				
//----------------------------------------------------------------------	
	var header = ["img/header/modern.jpg","img/header/classic.jpg","img/header/simple.jpg","img/header/eclectic.jpg","img/header/reality.jpg","img/header/dream1.jpg","img/header/timeline.jpg"];
	
	var homeimages = ["img/home/modern.jpg","img/home/classic.jpg","img/home/simple.jpg","img/home/eclectic.jpg","img/home/reality.jpg"];
	
	for(var i=0; i<header.length;i++)
	{
		$('#placeholder').append("<img  src='"+header[i]+"' />");
		}
		for(var d=0; d<homeimages.length;d++)
	{
		$('#placeholder').append("<img  src='"+homeimages[d]+"' />");
		}
	
});
function main()
{
var counter = 0;
var array = ["img/home/modern.jpg","img/home/classic.jpg","img/home/simple.jpg","img/home/eclectic.jpg","img/home/reality.jpg"];




function mainIMG()
{counter ==5 ? counter =0 : counter ++;
	$('#main').find('#omg').attr("src",array[counter]).animate({opacity:1},4999).animate({opacity:0.5},999);
	
		
};

setInterval(function(){
mainIMG();

},6*1000);

};
//---------------------------------------------
//------------------------------------------
$(document).ready(function() {
var position=0;
var full_position=0;
var slide_state1="false";
var thums,thum_width,doc_width;
var cord_right=0;var cord_left=0;

var location = $('#thums').css("margin-left");	
	
	
var kitchen =["img/gallery/kitchen/1.jpg","img/gallery/kitchen/2.jpg","img/gallery/kitchen/3.jpg","img/gallery/kitchen/4.jpg","img/gallery/kitchen/5.jpg","img/gallery/kitchen/6.jpg","img/gallery/kitchen/7.jpg","img/gallery/kitchen/8.jpg","img/gallery/kitchen/9.jpg","img/gallery/kitchen/10.jpg","img/gallery/kitchen/11.jpg","img/gallery/kitchen/12.jpg","img/gallery/kitchen/13.jpg","img/gallery/kitchen/14.jpg","img/gallery/kitchen/15.jpg","img/gallery/kitchen/16.jpg","img/gallery/kitchen/17.jpg","img/gallery/kitchen/18.jpg","img/gallery/kitchen/19.jpg","img/gallery/kitchen/20.jpg"];

var bath =["img/gallery/bath/30.jpg","img/gallery/bath/31.jpg","img/gallery/bath/32.jpg","img/gallery/bath/33.jpg","img/gallery/bath/34.jpg","img/gallery/bath/35.jpg","img/gallery/bath/36.jpg","img/gallery/bath/37.jpg","img/gallery/bath/1.jpg","img/gallery/bath/2.jpg","img/gallery/bath/3.jpg","img/gallery/bath/25.jpg","img/gallery/bath/26.jpg","img/gallery/bath/4.jpg","img/gallery/bath/5.jpg","img/gallery/bath/6.jpg","img/gallery/bath/7.jpg","img/gallery/bath/8.jpg","img/gallery/bath/9.jpg","img/gallery/bath/10.jpg","img/gallery/bath/24.jpg","img/gallery/bath/11.jpg","img/gallery/bath/12.jpg","img/gallery/bath/13.jpg","img/gallery/bath/14.jpg","img/gallery/bath/15.jpg","img/gallery/bath/16.jpg","img/gallery/bath/17.jpg","img/gallery/bath/18.jpg","img/gallery/bath/19.jpg","img/gallery/bath/20.jpg","img/gallery/bath/21.jpg","img/gallery/bath/22.jpg","img/gallery/bath/23.jpg"];

var office =["img/gallery/office/11.jpg","img/gallery/office/12.jpg","img/gallery/office/13.jpg","img/gallery/office/14.jpg","img/gallery/office/15.jpg","img/gallery/office/16.jpg","img/gallery/office/17.jpg","img/gallery/office/18.jpg","img/gallery/office/19.jpg","img/gallery/office/20.jpg","img/gallery/office/21.jpg","img/gallery/office/1.jpg","img/gallery/office/2.jpg","img/gallery/office/3.jpg","img/gallery/office/4.jpg","img/gallery/office/5.jpg","img/gallery/office/6.jpg","img/gallery/office/7.jpg","img/gallery/office/8.jpg","img/gallery/office/9.jpg","img/gallery/office/10.jpg"];

var living =["img/gallery/living/1.jpg","img/gallery/living/2.jpg","img/gallery/living/3.jpg","img/gallery/living/4.jpg","img/gallery/living/5.jpg","img/gallery/living/6.jpg","img/gallery/living/7.jpg","img/gallery/living/8.jpg","img/gallery/living/9.jpg","img/gallery/living/10.jpg","img/gallery/living/11.jpg","img/gallery/living/12.jpg","img/gallery/living/13.jpg","img/gallery/living/14.jpg","img/gallery/living/15.jpg","img/gallery/living/16.jpg","img/gallery/living/17.jpg","img/gallery/living/18.jpg","img/gallery/living/19.jpg","img/gallery/living/20.jpg","img/gallery/living/21.jpg","img/gallery/living/22.jpg","img/gallery/living/23.jpg"];

var bed =["img/gallery/bed/12.jpg","img/gallery/bed/1.jpg","img/gallery/bed/2.jpg","img/gallery/bed/3.jpg","img/gallery/bed/4.jpg","img/gallery/bed/5.jpg","img/gallery/bed/6.jpg","img/gallery/bed/7.jpg","img/gallery/bed/8.jpg","img/gallery/bed/9.jpg","img/gallery/bed/10.jpg","img/gallery/bed/11.jpg"];

var dining =["img/gallery/dining/1.jpg","img/gallery/dining/2.jpg","img/gallery/dining/3.jpg","img/gallery/dining/4.jpg","img/gallery/dining/5.jpg"];

var patio =["img/gallery/patio/1.jpg","img/gallery/patio/2.jpg","img/gallery/patio/3.jpg","img/gallery/patio/4.jpg"];

var after_home = ["img/after_home/1.jpg","img/after_home/2.jpg","img/after_home/3.jpg","img/after_home/4.jpg","img/after_home/5.jpg","img/after_home/6.jpg","img/after_home/7.jpg","img/after_home/8.jpg","img/after_home/9.jpg","img/after_home/10.jpg","img/after_home/11.jpg","img/after_home/12.jpg"];

var gallery = kitchen;



//submenu loading galleries
$('#sub-menu li:eq(0)').mousedown(function()
{
	gallery = kitchen;
	
	position=0;
	$('#img').find('img').attr('src',gallery[position]);
	});
	
$('#sub-menu li:eq(1)').mousedown(function()
{
	gallery = bath;
	
	position=0;
	$('#img').find('img').attr('src',gallery[position]);
	});
$('#sub-menu li:eq(2)').mousedown(function()
{
	gallery = living;
	
	position=0;
	$('#img').find('img').attr('src',gallery[position]);
	});	
$('#sub-menu li:eq(3)').mousedown(function()
{
	gallery = dining;
	
	position=0;
	$('#img').find('img').attr('src',gallery[position]);
	});	
$('#sub-menu li:eq(4)').mousedown(function()
{
	gallery = bed;
	
	position=0;
	$('#img').find('img').attr('src',gallery[position]);
	});	
$('#sub-menu li:eq(5)').mousedown(function()
{
	gallery = office;
	
	position=0;
	$('#img').find('img').attr('src',gallery[position]);
	});		
$('#sub-menu li:eq(6)').mousedown(function()
{
	gallery = patio;
	
	position=0;
	$('#img').find('img').attr('src',gallery[position]);
	});

//---
for(var x=0; x<gallery.length;x++)
{
	$('#ul-thums').append("<li><img  src='"+gallery[x]+"' width='105' height='79' /></li>");
	}
//left and right	
$('#left').find('img').mousedown(function()
{
	
	if(position==0 )
	{
		position = gallery.length-1;
		}else position --;
		$('#img').find('img').attr('src',gallery[position]);
	});
	
$('#right').find('img').mousedown(function()
{
	
	
	if(position==gallery.length-1 )
	{
		position = 0;
		}else position ++;
		$('#img').find('img').attr('src',gallery[position]);
	});	


//---------------------------------------------	
$('#img-menu li:eq(0)').mouseover(function()
{
	$('#sub-menu').show('slow');
	}).mouseout(function()
	{
		//$('#sub-menu').hide('slow');
	
		check=0;
		$('#flashContent').hide();	
		$('#img_holder').show();
		
		
		});
		
$('#sub-menu').mouseover(function()
{
	$(this).css("display","block");
}).mouseout(function()
{
	$(this).css("display","none");
	});
$('#img-menu li:eq(1)').mousedown(function()	
{
	var data,temp;
	data = $(this).find('img').attr('alt');
	temp = $(this).find('img').attr('src');
	$(this).find('img').attr('src',data);
	$(this).find('img').attr('alt',temp);
	//alert(slide_state);
	
	show1();
	
		check=0;
		$('#flashContent').hide();	
		$('#img_holder').show();
		
		
	/*if(slide_state==false){
	slide_state = true; show1(true);}
	else if(slide_state==true) {show1(false);}//show(slide_state);}*/
	
	//alert(slide_state);
});
$('#img-menu li:eq(2)').mousedown(function()	
{
	$('#fullscreen').css("display","block");
	
		check=0;
		$('#flashContent').hide();	
		$('#img_holder').show();
		
		
	//if($('#fullscreen'))
	//{$('#fullscreen').remove();}
});
$('#img-menu li:eq(3)').mousedown(function()	
{
	
	//alert(check);
	if(check==0)
	{
		check=1;
		$('#img_holder').hide();
		$('#flashContent').show();		
	}else
	{
		check=0;
		$('#flashContent').hide();	
		$('#img_holder').show();
		
		}
	
	//if($('#fullscreen'))
	//{$('#fullscreen').remove();}
});
	

//--------FULLSCREEN-------------------
//submenu loading galleries
$('#sub-menu1 li:eq(0)').mousedown(function()
{
	gallery = kitchen;
	
	position=0;
	$('#main-img').find('#img1').attr('src',gallery[position]);
	$('#ul-thums').html("");
	for(var x=0; x<gallery.length;x++)
{
	$('#ul-thums').append("<li><img  src='"+gallery[x]+"' width='105' height='79' /></li>");
	}
	$('#thums').css("margin-left","0px!important");
cord_right=0;pos=0;	

//$('#thums').css("margin-left","0px");
	//doc_width = $(window).width();
	//thum_width = totalwidth(gallery.length);
//	thumMovement(thum_width);
	//alert(thum_width+" and "+doc_width);
	});
	
$('#sub-menu1 li:eq(1)').mousedown(function()
{
	gallery = bath;
	
	position=0;
	$('#main-img').find('#img1').attr('src',gallery[position]);
	$('#ul-thums').html("");
	for(var x=0; x<gallery.length;x++)
{
	$('#ul-thums').append("<li><img  src='"+gallery[x]+"' width='105' height='79' /></li>");
	}
	$('#thums').css("margin-left","0px!important");
	});
	
$('#sub-menu1 li:eq(2)').mousedown(function()
{
	gallery = living;
	
	position=0;
	$('#main-img').find('#img1').attr('src',gallery[position]);
	$('#ul-thums').html("");
	for(var x=0; x<gallery.length;x++)
{
	$('#ul-thums').append("<li><img  src='"+gallery[x]+"' width='105' height='79' /></li>");
	}
	$('#thums').css("margin-left","0px!important");
	});	
$('#sub-menu1 li:eq(3)').mousedown(function()
{
	gallery = dining;
	
	position=0;
	$('#main-img').find('#img1').attr('src',gallery[position]);
	$('#ul-thums').html("");
	for(var x=0; x<gallery.length;x++)
{
	$('#ul-thums').append("<li><img  src='"+gallery[x]+"' width='105' height='79' /></li>");
	}
	$('#thums').css("margin-left","0px!important");
	});	
$('#sub-menu1 li:eq(4)').mousedown(function()
{
	gallery = bed;
	
	position=0;
	$('#main-img').find('#img1').attr('src',gallery[position]);
	$('#ul-thums').html("");
	for(var x=0; x<gallery.length;x++)
{
	$('#ul-thums').append("<li><img  src='"+gallery[x]+"' width='105' height='79' /></li>");
	}
	$('#thums').css("margin-left","0px!important");
	});	
$('#sub-menu1 li:eq(5)').mousedown(function()
{
	gallery = office;
	
	position=0;
	$('#main-img').find('#img1').attr('src',gallery[position]);
	$('#ul-thums').html("");
	for(var x=0; x<gallery.length;x++)
{
	$('#ul-thums').append("<li><img  src='"+gallery[x]+"' width='105' height='79' /></li>");
	}
	$('#thums').css("margin-left","0px!important");
	});		
$('#sub-menu1 li:eq(6)').mousedown(function()
{
	gallery = patio;
	
	position=0;
	$('#main-img').find('#img1').attr('src',gallery[position]);
	$('#ul-thums').html("");
	for(var x=0; x<gallery.length;x++)
{
	$('#ul-thums').append("<li><img  src='"+gallery[x]+"' width='105' height='79' /></li>");
	}
	$('#thums').css("margin-left","0px!important");
	});
//---------------THUM ROLLER--------------------
$('#thums').mouseover(function(){
	thumIMG();
});


//---------------------------------------------	

//----------------------------------------------
$('#img-menu1 li:eq(0)').mouseover(function()
{
	$('#sub-menu1').show('slow');
	}).mouseout(function()
	{
		//$('#sub-menu').hide('slow');
		});
$('#img-menu1 li:eq(1)').mousedown(function()	
{
	var data1,temp1;
	data1 = $(this).find('img').attr('alt');
	temp1 = $(this).find('img').attr('src');
	$(this).find('img').attr('src',data1);
	$(this).find('img').attr('alt',temp1);
	
	show2();
});		
$('#sub-menu1').mouseover(function()
{
	$(this).css("display","block");
}).mouseout(function()
{
	$(this).css("display","none");
	});

$('#img-menu1 li:eq(2)').mousedown(function()	
{
	$('#fullscreen').css("display","none");
	
	
	//if($('#fullscreen'))
	//{$('#fullscreen').remove();}
});

//left1 and right	1
$('#left1').find('img').mousedown(function()
{
	
	if(position==0 )
	{
		position = gallery.length;
		}else position --;
		$('#main-img').find('#img1').attr('src',gallery[position]);
	});
	
$('#right1').find('img').mousedown(function()
{
	
	
	if(position==gallery.length )
	{
		position = 0;
		}else position ++;
		$('#main-img').find('#img1').attr('src',gallery[position]);
	});	


//---------------------------------------------	
//--Player------------------
if(slide_state == true)
{
	//alert("STATE "+slide_state);
setInterval(function(){
slideshow(slide_state);

},3*1000);	
}
//-------SlideSHow
function slideshow(state)
{
	//alert("SHOW "+state);
	if(state == true)
	{
	position==gallery.length ? position =0 : position++;
	$('#img').find('img').attr("src",gallery[position]).animate({opacity:0.5},999).animate({opacity:1},999);
	}
		
};
//-------------------
function show1()
{	
//alert("Cur "+tester);
if(tester==false)
{
	tester= true;
}else tester = false;
//alert("STATE "+tester);
if(tester == true)
{
setInterval(function(){
slideshow(tester);

},3*1000);	
}else {slideshow(tester);}
}
//-------SlideSHow
function slideshow(state1)
{
	//alert("SHOW "+state1);
	if(state1 == true)
	{
	position==gallery.length ? position =0 : position++;
	$('#img').find('img').attr("src",gallery[position]).animate({opacity:0.5},999).animate({opacity:1},999);
	}else $('#img').find('img').attr("src",gallery[position]);
		
}
//-------------------
function show2()
{	
//alert("Cur "+position);
if(tester1==false)
{
	tester1= true;
}else tester1 = false;
//alert("STATE "+position);
if(tester1 == true)
{
setInterval(function(){
slideshow2(tester1);

},6*1000);	
}else {slideshow2(tester1);}
}
//-------SlideSHow
function slideshow2(state2)
{
	//alert("SHOW "+position);
	if(state2 == true)
	{
	position==gallery.length ? position =0 : position++;
	$('#main-img').find('#img1').attr("src",gallery[position]).animate({opacity:0.5},999).animate({opacity:1},999);
	}else $('#main-img').find('#img1').attr("src",gallery[position]);
		
}
	

function totalwidth(len)
{
	var total_len = len * 125;
	return total_len;
}

//function thumMovement(totalen)
//{
function thumIMG()
{	
	$('#ul-thums li img').mousedown(function(e)
{
	var thumy = $(this).attr("src");
	$("#main-img").find('#img1').attr("src",thumy);
	});
}
	//-------------------------------
//	 $(window).resize(function()
//{
	var win_width = $(window).width();
	var win_height = $(window).height();
	var doc_height =$(document).height();
	var img = 578/2;
	var menu_pos = win_height-(win_height*0.15);
	//$('#sub-menu').css("top",win_height/2+"px");
	//$('#sub-menu').css("left",win_width/2+"px");
	
	$('#fullscreen').css("height",doc_height+"px");
	
	$('#menu1').css("top",menu_pos+"px");
	$('#sub-menu1').css("top",(menu_pos-150)+"px");
	$('#thums').css("top",(menu_pos+37)+"px");
	
	$('#main-img').css("top",(win_height-win_height*0.85)+"px");
	$('#main-img').css("left",(win_width/2-img)+"px");
	
	$('#holder').css("height",(win_height/1.19)+"px");
	$('#holder').css("width",win_width+"px");
	
	$('#holder').mouseover(function(e)
	{
	 $('#left1').animate({opacity:1.0},800);
	 $('#right1').animate({opacity:1.0},800);
	})
	$('#menu1').mouseout(function(e)
	{
		 $('#left1').animate({opacity:0.0},100);
	 $('#right1').animate({opacity:0.0},100);
	});
	$('#thums').mouseout(function(e)
	{
		 $('#left1').animate({opacity:0.0},100);
	 $('#right1').animate({opacity:0.0},100);
	});
	/*
	$('#left1').css("top",(win_height/3)+"px");
	$('#left1').css("left",(win_width-win_width*0.9)+"px");
	
	$('#right1').css("top",(win_height/3)+"px");
	$('#right1').css("left",(win_width-win_width*0.1)+"px");*/
//});
 $(window).resize(function()
{
	win_width = $(window).width();//screen.width
	win_height = $(window).height();
	var doc_height =$(document).height();
	var menu_pos = win_height-(win_height*0.15);
	
	$('#fullscreen').css("height",doc_height+"px");
	
	$('#menu1').css("top",menu_pos+"px");
	$('#sub-menu1').css("top",(menu_pos-150)+"px");
	$('#thums').css("top",(menu_pos+37)+"px");
	
	$('#main-img').css("top",(win_height-win_height*0.85)+"px");
	$('#main-img').css("left",(win_width/2-img)+"px");
	
	$('#holder').css("height",(win_height/1.19)+"px");
	$('#holder').css("width",win_width+"px");
	/*$('#left1').css("top",(win_height/3)+"px");
	$('#left1').css("left",(win_width-win_width*0.9)+"px");
	
	$('#right1').css("top",(win_height/3)+"px");
	$('#right1').css("left",(win_width-win_width*0.1)+"px");*/
	//alert(win_height+" and "+menu_pos+" and "+ win_width);
});
//	location = $('#thums').css("margin-left");	
	
//	location.replace("px"," ");
//alert(win_height+" and "+menu_pos+" and "+ win_width);
	//alert(location);
	
		
	$('#thums').mouseover(function(e)
	{
		var difference = ((gallery.length*125) - win_width);
		//alert("Difference : "+difference+" Gallery Length"+gallery.length*125+" Window "+win_width+"Gallery # "+gallery.length+"");
		if (e.pageX > win_width/2)
		{
		if((cord_right*-1) <= difference)
			{
				cord_right-=25;
			//	$('#tester').text(($('#thums').css("margin-left"))+" "+difference+" "+e.pageX);
			 $('#thums').animate({marginLeft: "-=25px"},100);
			}
		}
			//alert(cord_right+" and "+e.pageX+" and "+ win_width/2);
			//for(cord_right;cord_right<=difference;cord_right+=25)
			//{
				/*if((cord_right*-1) <= difference)
				{
					cord_right-=1;
					
					$('#tester').text(pos+" "+cord_right);
				$('#thums').css("margin-left",cord_right+"px");
				*/
				
			/*	setInterval(function()
				{
					
					if((cord_right*-1) <= difference)
					{
					moveleft(cord_right);
					}
				},1*400);
			
			}*/
			
			//	}
			/*
			cord_right+= 25;
			//alert(cord_right);
			//alert(cord_right+" and "+difference+" and "+ totalen);
			if(cord_right <= difference)
			{
		 	$('#thums').css("margin-left","-"+cord_right+"px");
			}
			
		}*/
		
		
		
	});
	
	
$('#thums').mousemove(function(e)
	{	
	//alert(gallery.length);
	if (e.pageX < win_width/2)
		{
			//alert(cord_right);
			if((cord_right) < 0)
			{
				cord_right+=25;
			//	$('#tester').text(($('#thums').css("margin-left"))+" "+difference+" "+e.pageX);
			 $('#thums').animate({marginLeft: "+=25px"},100);
			}
			//for(cord_right;cord_right<=difference;cord_right+=25)
			//{
				/*$('#tester').text(e.pageX+" "+win_width/2+"and pos"+pos+" cord_right"+cord_right);
				//alert(pos);
				if(cord_right<0)
				{
					//alert(location+" "+e.pageX+" "+win_width/2);
					cord_right+=1;
					$('#thums').css("margin-left",cord_right+"px");
				/*setInterval(function()
				{
					
					
					
					if(cord_right < 0)
					{
					
					moveright(cord_right);
					}
				},1*400);
				
				}*/
		}
	});
//}

function moveleft(cordy)
{
	
	$('#thums').css("margin-left",cordy+"px");
}
function moveright(cordy)
{
		
	//alert(location+" and "+change);
	$('#thums').css("margin-left",cordy+"px");
	$('#tester').text("going left"+cordy+" "+pos +" "+(cordy+change));
}

//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------	
//--Stalling
$('#dream').animate({opacity:1},1700);
$('#logo').animate({opacity:1},1700,'easeInQuad',function()
		{
			$('.hlist').show(2000);
			},2500);
//-----Animation----------------------	

	$('div #dream').animate({
		opacity:1,
		left:'+=50'
		
		},2500);
		/*,'easeInQuad',function()
		{
			$('.hlist').show(2000);
			},2500);
			
		*/
					
					
		
		$('#logo').animate({
			right:'+=50',
		opacity:0.0
		},2500).animate({opacity:0.0},400,'easeInQuad', function()
		{
			$(this).find('img').attr("src","img/header/spacious.jpg");
			$(this).css('right','-0px');
			},1).animate({opacity:1.0},2500);
			
		$('#logo').animate({
		opacity:0.0,
        right:'+=50',
		},2500).animate({opacity:0.0},400,'easeInQuad', function()
		{
			$(this).find('img').attr("src","img/header/unique.jpg");
			$(this).css('padding-top','1px');	
			$(this).css('right','-0px');
			},1).animate({opacity:1.0},2500);
			
		$('#logo').animate({
		opacity:0.0,
        right:'+=50',
		},2500).animate({opacity:0.0},400,'easeInQuad', function()	
		{
			$(this).find('img').attr("src","img/header/simple.jpg");
			$(this).css('padding-top','5px');	
			$(this).css('right','-0px');
			},1).animate({opacity:1.0},2500);
			
		$('#logo').animate({
		opacity:0.0,
		right:'+=50',
		},2500).animate({opacity:0.0},400,'easeInQuad', function()		
		{
			$(this).find('img').attr("src","img/header/eclectic.jpg");	
			$(this).css('padding-top','5px');
			$(this).css('right','-0px');
			},1).animate({opacity:1.0},2500);
		
		$('#logo').animate({
		opacity:0.0,
		right:'+=50',
		},2500).animate({opacity:0.0},400,'easeInQuad', function()	
		{
			$(this).find('img').attr("src","img/header/reality.jpg");
			$(this).css('padding-top','0px');
			$(this).css('right','-0px');	
			},1).animate({opacity:1.0},2500);
			
		
			
		$('#logo').animate({
		opacity:0.0,
		right:'+=50',
		},2500).animate({opacity:0.0},400,'easeInQuad', function()	
		{
			
			$('#dream').find('img').attr("src","img/header/dream1.jpg");
			$('#logo').css("padding-top","7px");
			$(this).find('img').attr("src","img/header/timeline.jpg");	
			$('#dream').queue(function()
			{
				$(this).animate({
					left:'-=30'
					},2500)
				 $(this).dequeue();
				});
		
		$('#logo').animate({
		opacity:1.0
		},2500,'easeOutBounce',function()
		{
			$('#topnav').append("<div id='test'><img  src='img/header/renovation.jpg'  /></div>");
			},2000);	
			
			},1);
//			$('#logo').queue(function() {
// $('#topnav').append("<div id='test'><img  src='img/header/renovation.jpg'  /></div>");
 // $(this).dequeue();
//});


//------------main Images ---------------------------------------------			
		$('#main').animate({
		opacity:0.3
		},4000,'easeInQuad',function()
		{
			$('#main').find('#omg').attr("src","img/home/space.jpg");
			
			},0);
			$('#main').animate({
		opacity:1,
		},2500);
		
		$('#main').animate({
		opacity:0.3
		},3100,'easeInQuad',function()
		{
			$('#main').find('#omg').attr("src","img/home/unique.jpg");
			},0);
			$('#main').animate({
		opacity:1,
		},2500);
		
		$('#main').animate({
		opacity:0.3
		},3100,'easeInQuad',function()
		{
			$('#main').find('#omg').attr("src","img/home/simple.jpg");
			},1000);
			$('#main').animate({
		opacity:1,
		},2500);
		
		$('#main').animate({
		opacity:0.3
		},3100,'easeInQuad',function()
		{
			$('#main').find('#omg').attr("src","img/home/eclectic.jpg");
			},1000);
			$('#main').animate({
		opacity:1,
		},2500);
		
		$('#main').animate({
		opacity:0.3
		
		},3100,'easeInQuad',function()
		{
			$('#main').find('#omg').attr("src","img/home/reality.jpg");
			},1000);
			$('#main').animate({
		opacity:1,
		},2500);
	
		
		
		
		//--------Border Animations
		$('#logo').queue(function() {
			
		$('#header-main').animate({
			opacity:1,
			borderTopColor:'#848282',
			borderRightColor:'#848282',
			borderLeftColor:'#848282',
			borderBottomColor:'#848282'
			},2000,'easeInQuad',function()
			{
			$('.hlist').animate({
			opacity:1,
			borderTopColor:'#848282',
			borderRightColor:'#848282',
			borderLeftColor:'#848282',
			borderBottomColor:'#848282'
				},100,'easeInQuad',function(){
					opacity:1,
					$('#omg').remove();
					$('#rightside').fadeIn(5000);
					homepageFade();
					},2000);
		});
			 $(this).dequeue();
		});
		
		$('#main').queue(function() {
		main();
		});


function homepageFade()
{

	setInterval(function(){
	Change();
	},5*1000);	
	
	
			
function Change()
{
	//alert("IT IS HAPPENING");
	var rand_left = randomOne();
	var rand_right = randomOne1();
	var list = listy();
	var list1 = listy();
	
	var left_css;
	var right_css;
	
	left_css = $('#home_left li:eq('+(rand_left-1)+')').find('img').attr("alt");
	$('#home_left li:eq('+(rand_left-1)+')').find('div').css("background-image","url("+left_css+")");
	right_css = $('#home_right li:eq('+(rand_right-1)+')').find('img').attr("alt");
	$('#home_right li:eq('+(rand_right-1)+')').find('div').css("background-image","url("+right_css+")");
	
	
	$('#home_left li:eq('+(rand_left-1)+')').find('img').animate({opacity:0.1},2000,function(){
		var left_img = $(this).attr("src");
		$(this).attr("src",left_css);
		$('#home_left li:eq('+(rand_left-1)+')').find('div').css("background-image",left_img);
		$('#home_left li:eq('+(rand_left-1)+')').find('img').attr("alt",left_img);
		}).animate({opacity:1},2000);
		
		$('#home_right li:eq('+(rand_right-1)+')').find('img').animate({opacity:0.1},2000,function(){
		var right_img = $(this).attr("src");
		$(this).attr("src",right_css);
		$('#home_right li:eq('+(rand_right-1)+')').find('div').css("background-image",right_img);
		$('#home_right li:eq('+(rand_right-1)+')').find('img').attr("alt",right_img);
		}).animate({opacity:1},2000);	
		
		
	/*$('#home_left li:eq('+(rand_left-1)+')').find('div').css("background-image","url("+after_home[list-1]+")").find('img').animate({opacity:0.1},2000,function(){$(this).attr("src",after_home[list-1]); }).animate({opacity:1},2000);
	$('#home_right li:eq('+(rand_right-1)+')').find('div').css("background-image","url("+after_home[list1-1]+")").find('img').animate({opacity:0.1},2000,function(){$(this).attr("src",after_home[list1-1]); }).animate({opacity:1},2000);
	
	/*$('#home_left li:eq('+(rand_left-1)+')').find('> img').animate({opacity:0.1},2000,function(){$(this).css("background-image","url("+after_home[list1-1]+")");}).animate({opacity:1},2000); 
    $('#home_right li:eq('+(rand_right-1)+')').find('> img').animate({opacity:0.5}).attr('src',after_home[list1-1]).animate({opacity:1},2000); */
}
	
}			

function randomOne()
{
 return (Math.floor(Math.random()*3)+1);
}
function randomOne1()
{
 return (Math.floor(Math.random()*3)+1);
}
function listy()
{
 return (Math.floor(Math.random()*12)+1);
}			
	
	
	
//------Menues---------------------------------------	
$('#testimonials').mouseover(function()
{
	$(this).find('img').attr("src","img/menues/testimonials1.jpg");	
	
}).mouseout(function()
	{
	$(this).find('img').attr("src","img/menues/testimonials.jpg");	
	});
	
$('#services').mouseover(function()
{
	$(this).find('img').attr("src","img/menues/services1.jpg");	
	
}).mouseout(function()
	{
	$(this).find('img').attr("src","img/menues/services.jpg");	
	});
$('#home').mouseover(function()
{
	$(this).find('img').attr("src","img/menues/home1.jpg");	
	
}).mouseout(function()
	{
	$(this).find('img').attr("src","img/menues/home.jpg");	
	});	
$('#gallery').mouseover(function()
{
	$(this).find('img').attr("src","img/menues/gallery1.jpg");	
	
}).mouseout(function()
	{
	$(this).find('img').attr("src","img/menues/gallery.jpg");	
	});	
$('#contactus').mouseover(function()
{
	$(this).find('img').attr("src","img/menues/contactus1.jpg");	
	
}).mouseout(function()
	{
	$(this).find('img').attr("src","img/menues/contactus.jpg");	
	});
			
$('#share').mouseover(function()
{
	$(this).find('img').attr("src","img/menues/share_over.png");	
	
}).mouseout(function()
	{
	$(this).find('img').attr("src","img/menues/share.png");	
	});		


	for(var x=0;x<kitchen.length;x++)
	{
		$('#placeholder').append("<img src='"+kitchen[x]+"' />");
	}
	for(var x=0;x<bath.length;x++)
	{
		$('#placeholder').append("<img src='"+bath[x]+"' />");
	}
	for(var x=0;x<office.length;x++)
	{
		$('#placeholder').append("<img src='"+office[x]+"' />");
	}
	for(var x=0;x<living.length;x++)
	{
		$('#placeholder').append("<img src='"+living[x]+"' />");
	}
	for(var x=0;x<bed.length;x++)
	{
		$('#placeholder').append("<img src='"+bed[x]+"' />");
	}
	for(var x=0;x<dining.length;x++)
	{
		$('#placeholder').append("<img src='"+dining[x]+"' />");
	}
	for(var x=0;x<dining.length;x++)
	{
		$('#placeholder').append("<img src='"+dining[x]+"' />");
	}
	for(var x=0;x<patio.length;x++)
	{
		$('#placeholder').append("<img src='"+patio[x]+"' />");
	}
	for(var x=0;x<after_home.length;x++)
	{
		$('#placeholder').append("<img src='"+after_home[x]+"' />");
	}


});
