var currHomePortIMGMask_XPos = -204;
var currentImageIndex = 1;
var SearchUtilities = $("#SearchUtilities");

$(document).ready(document_Ready);


function document_Ready(){
	functions_assignEventHandlers();
	
	var SoMeColLinkSmall_FaceBook = $('#SoMeColLinkSmall_FaceBook');
	var SoMeColLinkSmall_LinkedIn = $('#SoMeColLinkSmall_LinkedIn');
	var SoMeColLinkSmall_Twitter = $('#SoMeColLinkSmall_Twitter');
	var SoMeColLinkSmall_RSS = $('#SoMeColLinkSmall_RSS');
	var SoMeColLinkSmall_Youtube = $('#SoMeColLinkSmall_Youtube');
	
	var SoMeColLinkLarge_FaceBook = $('#SoMeColLinkLarge_FaceBook');
	var SoMeColLinkLarge_LinkedIn = $('#SoMeColLinkLarge_LinkedIn');
	var SoMeColLinkLarge_Twitter = $('#SoMeColLinkLarge_Twitter');
	var SoMeColLinkLarge_RSS = $('#SoMeColLinkLarge_RSS');
	var SoMeColLinkLarge_Youtube = $('#SoMeColLinkLarge_Youtube');
	
	/*SoMeColLinkLarge_FaceBook.animate({opacity: 0}, 0);
	SoMeColLinkLarge_LinkedIn.animate({opacity: 0}, 0);
	SoMeColLinkLarge_Twitter.animate({opacity: 0}, 0);
	SoMeColLinkLarge_RSS.animate({opacity: 0}, 0);
	SoMeColLinkLarge_Youtube.animate({opacity: 0}, 0);*/
	
	SoMeColLinkSmall_FaceBook.bind("mouseover", function(){
		document.getElementById('SoMeColLinkLarge_FaceBook').style.display = 'block';
		/*SoMeColLinkLarge_FaceBook.animate({opacity: 100}, 200);*/
	});
	SoMeColLinkLarge_FaceBook.bind("mouseout", function(){
		document.getElementById('SoMeColLinkLarge_FaceBook').style.display = 'none';
		/*SoMeColLinkLarge_FaceBook.animate({opacity: 0}, 200);*/
	});
	
	
	SoMeColLinkSmall_LinkedIn.bind("mouseover", function(){
		document.getElementById('SoMeColLinkLarge_LinkedIn').style.display = 'block';
		/*SoMeColLinkLarge_LinkedIn.animate({opacity: 100}, 200);*/
	});
	SoMeColLinkLarge_LinkedIn.bind("mouseout", function(){
		document.getElementById('SoMeColLinkLarge_LinkedIn').style.display = 'none';
		/*SoMeColLinkLarge_LinkedIn.animate({opacity: 0}, 200);*/
	});
	
	
	SoMeColLinkSmall_Twitter.bind("mouseover", function(){
		document.getElementById('SoMeColLinkLarge_Twitter').style.display = 'block';
		/*SoMeColLinkLarge_Twitter.animate({opacity: 100}, 200);*/
	});
	SoMeColLinkLarge_Twitter.bind("mouseout", function(){
		document.getElementById('SoMeColLinkLarge_Twitter').style.display = 'none';
		/*SoMeColLinkLarge_Twitter.animate({opacity: 0}, 200);*/
	});
	
	
	SoMeColLinkSmall_RSS.bind("mouseover", function(){
		document.getElementById('SoMeColLinkLarge_RSS').style.display = 'block';
		/*SoMeColLinkLarge_RSS.animate({opacity: 100}, 200);*/
	});
	SoMeColLinkLarge_RSS.bind("mouseout", function(){
		document.getElementById('SoMeColLinkLarge_RSS').style.display = 'none';
		/*SoMeColLinkLarge_RSS.animate({opacity: 0}, 200);*/
	});
	
	
	SoMeColLinkSmall_Youtube.bind("mouseover", function(){
		document.getElementById('SoMeColLinkLarge_Youtube').style.display = 'block';
		/*SoMeColLinkLarge_Youtube.animate({opacity: 100}, 200);*/
	});
	SoMeColLinkLarge_Youtube.bind("mouseout", function(){
		document.getElementById('SoMeColLinkLarge_Youtube').style.display = 'none';
		/*SoMeColLinkLarge_Youtube.animate({opacity: 0}, 200);*/
	});
	
}


function functions_assignEventHandlers(){
	$("#SearchUtilities_Search").click(toggleSearch);
	$("#closeSearchBtn").click(toggleSearch);
	$("#SearchField_Close").click(hideSearch);
}


function toggleSearch(){
	var util = $("#mainSearchField");
	if(util.attr("Open") == null){
		showSearch();
	}
	else{
		hideSearch();
	}
}

function showSearch(){
	var util = $("#mainSearchField");
	util.animate({width:120}, {duration: 250, easing: "linear"});
	util.attr("Open", true);
}

function hideSearch(){
	var util = $("#mainSearchField");
	util.animate({width:0}, {duration: 250, easing: "linear"});
	util.removeAttr("Open");
}


function showDropDownNav(ID1, ID2, Img){
	$(ID1).css({display:'block'});
	document.getElementById(ID2).src = 'graphics/' + Img + '_on.gif';
}

function hideDropDownNav(ID1, ID2, Img){
	$(ID1).css({display:'none'});
	document.getElementById(ID2).src = 'graphics/' + Img + '.gif';
}

function showUtilitieDiv(ID1){
	//$(ID1).css({display:'block'});
}

function hideUtilitieDiv(ID1){
	//$(ID1).css({display:'none'});
}
function stopTimer(timerID){
	//timerID.stop();
}
function resetTimer(timerID, TimeVal){
	//timerID.reset(TimeVal);
}


function browser_AddBookmark(argTitle, argUrl){
	var title = document.title;
	var url = location.href;
	if (argTitle != null) {
		title = argTitle;
	}
	if(argUrl != null){
		url = argUrl;
	}
	
    if (window.sidebar != null && window.sidebar.addPanel != null){
        window.sidebar.addPanel(title, url,"");
    }
	else if( window.external != null){
        try{
			window.external.AddFavorite(url, title);
		}
		catch(e){
			alert("Press Ctrl D to bookmark this page.");
		}
	}
    else{
		alert("Press Ctrl D to bookmark this page.");
	}
}

function collapseClients(cat){
	$('.'+cat+'').slideToggle('normal');	
}

function initVerticalAccordion(e){
	$('.AccordionBlade').toggle(function(){
			$(this).addClass('Opened');
			$(this).next('.QBlock').slideDown("fast");
		}, function () {
			$(this).removeClass('Opened');
			$(this).next('.QBlock').slideUp("fast");
	});
}
