/*<![CDATA[*/
		   
/*****************************************************************************
//-> START General Functions
*****************************************************************************/
// --> Start label2value
this.label2value = function(){
	// function
	$("label.quick").each(function(){
		obj = document.getElementById($(this).attr("for"));
		if(($(obj).attr("type") == "text") || (obj.tagName.toLowerCase() == "textarea")){
			//$(obj).addClass(inactive);
			var text = $(this).text();
			$(this).css("display","none");
			$(obj).val(text);
			$(obj).focus(function(){
				//$(this).addClass(focused);
				//$(this).removeClass(inactive);
				//$(this).removeClass(active);
				if($(this).val() == text) $(this).val("");
			});
			$(obj).blur(function(){
				//$(this).removeClass(focused);
				if($(this).val() == "") {
					$(this).val(text);
					//$(this).addClass(inactive);
				} else {
					//$(this).addClass(active);
				};
			});
		};
	});
};

function CreateBookmarkLink() {

 title = "Webpage Title"; 
  // Blogger - Replace with <$BlogItemTitle$> 
  // MovableType - Replace with <$MTEntryTitle$>

 url = "Webpage URL";
  // Blogger - Replace with <$BlogItemPermalinkURL$> 
  // MovableType - Replace with <$MTEntryPermalink$>
  // WordPress - <?php bloginfo('url'); ?>

	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
 }
/*****************************************************************************
//-> END General Functions
*****************************************************************************/

/*****************************************************************************
//-> START Window Load
*****************************************************************************/

$(document).ready(function(){

	
// Start Fade Images
	/*
	$('div.image img, a[rel*="pop"] img').css({"opacity":"1"});
	$('div.image img, a[rel*="pop"] img').hover(function() {
		$(this).fadeTo("fast", 0.9);
	}, function() {
		$(this).fadeTo("slow", 1);
	});
*/
// --> Start Cycle
	// Add 'scrollVert' functionality for scroll boxe
	(function($) {

		$.fn.cycle.transitions.scrollVert = function($cont, $slides, opts) {
		    $cont.css('overflow','hidden');
		    opts.before.push(function(curr, next, opts, fwd) {
		        $(this).show();
		        var currH = curr.offsetHeight, nextH = next.offsetHeight;
		        opts.cssBefore = fwd ? { top: -nextH } : { top: nextH };
		        opts.animIn.top = 0;
		        opts.animOut.top = fwd ? currH : -currH;
		        $slides.not(curr).css(opts.cssBefore);
		    });
		    opts.cssFirst = { top: 0 };
		    opts.cssAfter = { display: 'none' }
		};

	})(jQuery);
	
	$('#sub-menu a.selected').next().css({"display":"block"});
	/*
// --> Start Sub Menu
	if($.browser.name == "msie" && $.browser.versionX <= "8"){
		
		$('#sub-menu ul').hide();
		$('#sub-menu a.selected').next().show();
		$('#sub-menu li a.lnk').click(
			function() {
				
				var checkElement = $(this).next();
				if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
					$('#sub-menu ul:visible').css({"display":"none"}).prev().removeClass("selected"); // this line enables closing an open li
					return false;
				}
				if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
					$('#sub-menu ul:visible').css({"display":"none"}).prev().removeClass("selected");
					checkElement.css({"display":"block"}).prev().addClass("selected");
					return false;
				}
			}
		);
		
	}else{
		
		$('#sub-menu ul').hide();
		$('#sub-menu a.selected').next().show();
		$('#sub-menu li a.lnk').click(
			function() {
				
				var checkElement = $(this).next();
				if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
					$('#sub-menu ul:visible').slideUp('normal').prev().removeClass("selected"); // this line enables closing an open li
					return false;
				}
				if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
					$('#sub-menu ul:visible').slideUp('normal').prev().removeClass("selected");
					checkElement.slideDown('normal').prev().addClass("selected");
					return false;
				}
			}
		);

	}
	*/
// --> Init LightBoxes
	if($.browser.name == "msie" && $.browser.versionX <= "7"){
		
		// --> Init ColorBox
		$("a[rel*='pop']").colorbox({
			opacity		:	0.0
		});
		
		}else{
			
		// --> Init FancyBox
		$("a[rel*='pop']").fancybox({
			titleShow		:false,
			transitionIn	:'elastic',
			transitionOut	:'elastic',
			easingIn		:'easeOutBack',
			easingOut		:'easeInBack',
			overlayOpacity	:0.0
		});
	
	}

// --> START FAQ's
	$("dl.faq").find('dd').hide().end().find('dt').append('<span class="expand">+ show</span>')
		.toggle(function(){
			$(this).find('span').attr('class','collapse').html('- hide').end()
			.next('dd').slideDown()
			.prev('dt').attr('class','selected').end();
		},function(){
			$(this).find('span').attr('class','expand').html('+ show').end()
			.next('dd').slideUp()
			.prev('dt').removeAttr('class').end();
		});
	
// --> Start hp slider
	// Init scroll
	$('div#wrapper-slide #bottom-sec #slide #upper').cycle({ 
		fx:     'fade', 
		speed: 850,
		timeout: 6000
	});

// --> Init Image cycle
	var headingsChildCount = $("#lower span").length;
	
	if(headingsChildCount <= 1){
		$("div#wrapper-slide #bottom-sec #slide #lower span").css({"display":"block"});
	}else{
		$("div#wrapper-slide #bottom-sec #slide #lower").cycle({ 
			fx: 'scrollVert',
			rev: true,
			speed:  850, 
			timeout: 6000, 
			sync:1
		});
	}
// --> Init Image cycle
	var newsChildCount = $("#newSlide li").length;
	
	if(newsChildCount <= 1){
		$("#pre-links ul.list li ul#newSlide li").css({"display":"block"});
	}else{
		$("#newSlide").cycle({ 
			fx: 'scrollVert',
			rev: true,
			speed:  850, 
			timeout: 6000
		});
	}
// --> Start Project slider
	$('#slider').nivoSlider({
		effect:'fade', //Specify sets like: 'fold,fade,sliceDown'
		slices:15,
		animSpeed:800,
		pauseTime:6000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:true, //Next & Prev
		directionNavHide:true, //Only show on hover
		controlNav:true, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
		controlNavThumbsFromRel:false, //Use image rel for thumbs
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});
	
	$("ul.topnav.m2 li:last").addClass("contact_btn");

// --> Start Disable '#' links from being clicked
	$("a[href^='#']").click(function() {
		return false;
	});

// --> Init External Links
	$("a[rel*='external']").attr("target","_blank");
	
// --> Stripping a tags with: class="remove"
	$("a[class*='strip']").each(function(){
		$(this).replaceWith($(this).html()); 
	});
	
// --> Init SPAM Email links
	$("a[href^='mailto:']").each(function(){
		var mail = $(this).attr("href").replace("mailto:","");
		var replaced = mail.replace("/at/","@");
		$(this).attr("href","mailto:"+replaced);
		if($(this).text() == mail){ 
			$(this).text(replaced);
		}
	});

// --> Init Label2Value
	label2value();
});

/*****************************************************************************
//-> END Window Load
*****************************************************************************/

/*]]>*/
