/*
 * function for properly preparing the menu items
 */
function PrepMainUi(){
	
	/*
	 * prepare the rollover effect for icon-based menu items
	 */
	$(function() {
		
		// -- set opacity on each span to 0%
		$(".rollover").css({'opacity':'0'});
		 
		$('#navigation li, #social-nav li').hover(
			function() {
				// -- if hovering over an icon image
				if ($(this).hasClass('nav-icon')){
					$(this).find('.rollover').stop().fadeTo(500, 1);
				// -- if hovering over the icon's associated text
				}else{
					$(this).prev().find('.rollover').stop().fadeTo(500, 1);	
				}
			},
			function() {
				// -- if hovering over an icon image
				if ($(this).hasClass('nav-icon')){
					$(this).find('.rollover').stop().fadeTo(500, 0);
				// -- if hovering over the icon's associated text
				}else{
					$(this).prev().find('.rollover').stop().fadeTo(500, 0);	
				}
			}
		)
	});
	
	/*
	 * apply the rounded corners for the header
	 */
	$(function() {
		$("#header").corner("top 8px");
	});
	
	/*
	 * apply the rounded corners to the body
	 */
	$(function() {
		$("#page-container").corner("10px");	
	});
	
	/*
	 * apply links to the menu items
	 */
	$('#navigation li:nth-child(1),#navigation li:nth-child(2)').click(function(){
	   document.location.href="/KodWebApp/home.do";
	});
	$('#navigation li:nth-child(3),#navigation li:nth-child(4)').click(function(){
	   document.location.href="/KodWebApp/about.do";
	});
	$('#navigation li:nth-child(5),#navigation li:nth-child(6)').click(function(){
	   document.location.href="/KodWebApp/solutions.do";
	});
	$('#navigation li:nth-child(7),#navigation li:nth-child(8)').click(function(){
	   document.location.href="/KodWebApp/contact.do";
	});
	
	/*
	 * apply click/url functionality to social media icons
	 */
	$(function(){
	    $('#fb').click(function(){
	        window.open("http://www.facebook.com/pages/Kod-Integrations-LLC/150322921649232");
	        return false;
		});
	    
	    $('#li').click(function(){
	        window.open("http://www.linkedin.com/company/2433869?trk=tyah");
	        return false;
		});
	    
	    $('#google').click(function(){
	        window.open("https://plus.google.com/u/0/b/109213594790927034325/");
	        return false;
		});
	});
	
	/*
	 * social bar rendering code
	 */
	
	(function(d, s, id) {
		var js, fjs = d.getElementsByTagName(s)[0];
	  	if (d.getElementById(id)) return;
	  	js = d.createElement(s); js.id = id;
	  	js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
	  	fjs.parentNode.insertBefore(js, fjs);
	}(document, 'script', 'facebook-jssdk'));
	
	// -- for rendering google +1 button
  	(function() {
    	var po = document.createElement('script'); 
    	po.type = 'text/javascript'; po.async = true;
    	po.src = 'https://apis.google.com/js/plusone.js';
    	
    	var s = document.getElementsByTagName('script')[0]; 
    	s.parentNode.insertBefore(po, s);
  	})();
  	
}
