	

	$(document).ready(function(){

	//	$.preload( ["img/logo_grey.png,img/title_about_us.png,img/title_communication.png,img/title_company.png,img/title_contact_us.png,img/title_design_branding.png,img/title_services.png,img/title_web_development.png"]);

		if($.browser.safari){

			if($("#content").height() > 711){

				$("#content").css("height","100%")

			}else{

				$("#content").css("height","711px")

			}

		}else{

			resizeFlash()

		}

		if(location.href.search("#") == -1){
document.location.hash = "#";
					$('.hash').ajaxify({

					   target: '#siteContentBG',

					   loadHash: 'attr:href',

					   tagToload: '#pagecontent'

					   });

					}
						

		

		

		//$("#siteContent").dropShadow({left: 2, top: 2, opacity:.7, blur: 1});

		$("#siteOverlay").animate({"opacity":"0"},1)

		var topLoc = ($(document).height() / 2 ) - ($("#siteContent").height() / 2)

		var leftLoc = ($(document).width() / 2 ) - ($("#siteContent").width() / 2)

		if(leftLoc < 200){

			leftLoc = 300

		}

		//$("#siteContent").css("top",topLoc+"px")

		//$("#siteContent").css("left",leftLoc+"px")

	

		

		

		var navHoverCongfig = {    

		 sensitivity: 100, // number = sensitivity threshold (must be 1 or higher)    

		 interval: 1, // number = milliseconds for onMouseOver polling interval    

		 over: navMoveUp, // function = onMouseOver callback (REQUIRED)    

		 timeout: 1, // number = milliseconds delay before onMouseOut    

		 out: navMoveDown // function = onMouseOut callback (REQUIRED)    

		};

		

		$("#mainNav h3 a").hoverIntent( navHoverCongfig );

		function navMoveUp(){

			$(this).animate({color: 'hsl(200,99%,39%)',"margin":"0px"},700);

			//$(this).find("span").css("color","#0085C7")

		}

		function navMoveDown(){

			$(this).animate({color: 'hsl(0,0%,60%)',"margin":"0px"},300);

			//$(this).find("span").css("color","#666666")

		}

		

	





		var navHoverCongfig2 = {    

		 sensitivity: 1000, // number = sensitivity threshold (must be 1 or higher)    

		 interval: 1, // number = milliseconds for onMouseOver polling interval    

		 over: navMoveUp2, // function = onMouseOver callback (REQUIRED)    

		 timeout: 300, // number = milliseconds delay before onMouseOut    

		 out: navMoveDown2 // function = onMouseOut callback (REQUIRED)    

		};

		

		$("#mainNav div ul li").hoverIntent( navHoverCongfig2 );

		function navMoveUp2(){

			$(this).find("a").animate({color: 'hsl(200,99%,39%)'},300);

		

			}

		function navMoveDown2(){

			$(this).find("a").animate({color: 'hsl(0,0%,50%)'},300);

		}

		

		

	

	/*************  Side Bar Action ***************/

	var SidebarHoverCongfig = {    

		 sensitivity: 1000, // number = sensitivity threshold (must be 1 or higher)    

		 interval: 500, // number = milliseconds for onMouseOver polling interval    

		 over: sidebarShow, // function = onMouseOver callback (REQUIRED)    

		 timeout: 1000, // number = milliseconds delay before onMouseOut    

		 out: sidebarHide // function = onMouseOut callback (REQUIRED)    

		};

		

		

		function sidebarShow(){

			$(".sidebar").animate({"width":"20px"},500)

			$(".sidebarline").animate({"left":"-40px"},{duration:500,easing:"easeOutCubic"})

			//$(".logo").animate({"left":"+=10px"},{duration:1000,easing:"easeOutCubic"})

			$("#pagecontent").animate({"left":"240px"},{duration:500,easing:"easeOutCubic"})

			

		}

		function sidebarHide(){

			$(".sidebar").animate({"width":"13px"},500)

			$(".sidebarline").animate({"left":"-250px"},500,"easeInOutBack",function(){

			 $("#pagecontent").animate({"left":"215px"},{duration:500,easing:"easeInOutCubic"})

			 })

			//$(".logo").animate({"left":"-=10px"},{duration:1000,easing:"easeOutCubic"})

			//$("#pagecontent").animate({"left":"215px"},{duration:500,easing:"easeInOutCubic"})

		}

		

		

		var SlideNavActivate = false;

		$(".mainItem").click(function(){

			$(this).parent().next('div').slideDown(500)

			.siblings('div:visible').slideUp(500);  

			activateSideBar()

		})

			//

			activateSideBar()

		function  activateSideBar(){

		

			if(SlideNavActivate  == false){

					$("#navPanel").hoverIntent( SidebarHoverCongfig );

					sidebarHide()

					SlideNavActivate = true;

				}	

		}

	})

	

	

		function getFlashMovie(movieName) {

		  var isIE = navigator.appName.indexOf("Microsoft") != -1;

		  return (isIE) ? window[movieName] : document[movieName];

		 }

		function formSend() {

	

		

		  getFlashMovie("SiteBG").sendTextToFlash(text);

		  

		 }

	function reSizeStage(){

	

			if($(document).height() < 711){

				$("#content, #navPanel").css("height","711px")

			}else{

				$("#content, #navPanel").css("height","100%")

			}

			if($(document).width() < 1280){

				$("#content").css("width","1280px")

			}else{

				$("#content").css("width","100%")

			}

			

		

	}

	

	function loadPage(){

	

	}

	

	function showSub(target){

			$(target).parent().next('div').slideDown(500)

			.siblings('div:visible').slideUp(500);

			

	}

	

	

	var viewMode = "default";

	var currentTotal = 0;

	/*************  AJAX Load Page Action ***************/

	function returnIndex(){

		$("#siteContent div#pagecontent").fadeOut(500,function(){

			viewMode = "default";

			randomPos()							   

												   })

			



	}

	var isDimed = false;

	var isGallery = false;

	function loadPageContent(data){

	

		

		viewMode = $(data).find("h1 span").html()

	

//alert(viewMode)

		if(viewMode == "Work"){

			

			if(isDimed){ speed = 1000}else{speed = 1}

			$("#siteContent").animate({left:"-700px"},speed,function(){

				getFlashMovie("SiteBG").fUnDimCity();

				isDimed = false

				imgArray = new Array

				var pName = ""

				//$("#siteContentBG").html(data)

				

				$(data).find("#gallery li img").each(function(i){

				  imgArray.push($(this).attr("src").toString())

				 });

				pName = $(data).find("#Project_Name").text().toString().toUpperCase()

				

				pURL = $(data).find("#project_site").attr("href")

				if(pURL == null){

					pURL = "none";

				}

			

				 getFlashMovie("SiteBG").fShowGallery(imgArray,pName,$(data).find("#subDes").html(),$(data).find("#pDes").html(),$(data).find("#serviceItem").html(),pURL );

				 

				 

				isGallery = true

				

				//$("#siteContent").append("<div id='siteContentBG'></div>")

				//$("#siteContent").animate({width:"100%", height:"500px" ,left:"0px",top:"180px"},1000)

			})

		}

		

		if(viewMode == "Services"){

	

			 	if(isGallery){
				
					 getFlashMovie("SiteBG").fHideGallery();

					 isGallery = false

				}

			

			   if(!isDimed){

				getFlashMovie("SiteBG").fDimCity();

				  isDimed = true;

			   }

			 

				$("#siteContent").animate({left:"-700px"},1000,function(){

				 $("#siteContentBG").hide()
				
				
				
				$("#siteContentBG").html(data)	

				$("#siteContent").animate({left:"0px"},1000,function(){

				

				

				  $("#siteContentBG").fadeIn(500)

				

																 })})

			

			

		}

		

	}

	

	

	

	function browser_fullscreen(){

		window.moveTo(0,0);

		window.resizeTo(screen.availWidth,screen.availHeight);	

	}

	function returnToDefault(){

		

		document.title = "Cios Communications Group - Building Around Innovation";

		 getFlashMovie("SiteBG").fHideGallery();

		$(".logoBlue").fadeIn(1000)

		$(".logoGrey").fadeOut(1000)

		 $("#siteContent").animate({left:"-700px"},500,function(){

			 getFlashMovie("SiteBG").fUnDimCity();	

			 isDimed = false

		})

	}

	

	function randomnumber(num1, num2)

	{

		num1 = parseInt(num1);

		num2 = parseInt(num2);

		if(num1 >= num2)

		{

			alert("Number 2 should be greater than Number 1");

		}

		else

		{

			var generator = Math.random()*(num2-num1);

			generator = Math.round(num1+generator);

			return generator;

		}

	}





	function shwoService(num){

		$("#siteContent").animate({left:"0px"},1000)

	}

	function swapLogo(){

		

		//

	}

	function hideSideBar(){

	$(".sidebar").animate({"width":"13px"},500)

			$(".sidebarline").animate({"left":"-250px"},500,"easeInOutBack",function(){

			 $("#pagecontent").animate({"left":"215px"},{duration:500,easing:"easeInOutCubic"})

			 })	

	}

	function activeNav(){

		

		$("#navPanel").animate({left:"0px"},500,function(){

		

			$(".sidebarline").animate({"left":"-40px"},{duration:500,easing:"easeOutCubic"})

				$(".sidebar").animate({"width":"20px"},500,function(){

			$(".logoGrey, .logoBlue").css("background","#FFF")

		 		$(".logoGrey").fadeOut(2000)

				$(".logoBlue").fadeIn(2000,function(){

									$(".logoGrey, .logoBlue").css("background","none")					

				})

				})

					if(location.href.search("#") != -1){

						 $('.hash').ajaxify({

					   target: '#siteContentBG',

					   loadHash: 'attr:href',

					   tagToload: '#pagecontent'

					   });

					}

		 })

	}

	function checkIfBookmarked(){

 

  	

			if(location.href.search("#") != -1){

				 getFlashMovie("SiteBG").fSkipAnimate();

			}

	}

	function resizeFlash(){

		

		//$("#content").css("height","1000px")

		$("#content").css("height",$("#navPanel").height()+"px")

		

		

	}