// Are you looking for me?  Thinkcyber.com visit us! JavaScript Document    <select onchange="JumpToIt(this)"> 
function JumpToIt(list) {
    var newPage = list.options[list.selectedIndex].value
    if (newPage != "None") {
        location.href=newPage
    }
}


$(document).ready(function() {
	
		$('#fb-like').attr({ 
		scrolling: 'no',
		frameborder: '0',
		allowTransparency: 'true'
		});


		function onChange() {
			var desiredName = $(this).attr('name');
			if ($('#'+desiredName).val()=='other') {
				$('#subject_input').show();
				$('#txtSubject').hide();
			} else {
			
			}
		}
		$('#txtSubject').change(onChange);
	
		// Expand Panel
		$("#open").click(function(){
			if(typeof document.body.style.maxHeight === "undefined") {  //if ie6
			  if ($("#pulldown_form").length) { // implies *not* zero
				  $('#pulldown_form').hide();
			  } 
			}
			$("div#panel").slideDown("slow");

		});	
		
		// Collapse Panel
		$("#close").click(function(){
			if(typeof document.body.style.maxHeight === "undefined") {  //if ie6
			  if ($("#pulldown_form").length) { // implies *not* zero
				  $('#pulldown_form').show();
			  } 
			}
			$("div#panel").slideUp("slow");	
		});		
		
		// Switch buttons from "Log In | Register" to "Close Panel" on click
		$("#toggle a").click(function () {
			$("#toggle a").toggle();
			$("#hello").hide();
		});		
		$(".toggle2 a").click(function () {
			$("#toggle a").toggle();
			$("div#panel").slideDown("slow");
			$("#hello").hide();
		});		
		
		// easyslider
		if ($("#slider").length) { 
		$("#slider").easySlider({
			auto: true,
			continuous: true,
			controlsFade:true,
			numeric: true
		});
		}
		//feedback
		var y_fixo = $("div[id^='div_feedback']").offset().top;
		$(window).scroll(function () {
			var mtScroll = getScrollXY();
			$("div[id^='div_feedback']").animate({top: y_fixo+mtScroll[1]+"px"},{duration:500,queue:false});
		});
		
		$("div[id^='div_feedback_lateral']").click(
				function() {
					if($("div[id^='div_feedback']").css('left') == "0px")
						//$(this).css({right:-180});
						$("div[id^='div_feedback']").animate({left:-182},400);
					else
						//$(this).css({right:0});
						$("div[id^='div_feedback']").animate({left:0},400);
				}
			);
});

function getScrollXY() {
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	return [ scrOfX, scrOfY ];
}

function swapImage(img_name1, img_src1, img_name2, img_src2) {
		document[img_name1].src = img_src1;
		document[img_name2].src = img_src2;
}
	function createCookie(name,value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}
	
	function readCookie(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}
	
	function eraseCookie(name) {
		createCookie(name,"",-1);
	}

	function saveCookie(location) {
		createCookie("ThinkcyberCountryDefault", location, 365);
	}

	function initLoad() {
		
		var location = readCookie("ThinkcyberCountryDefault");
		
		if(location){
			
			if(location == 'US'){
				window.location.replace('http://www.thinkcyber.com/pages/contact.asp?office=New%20York');
			}
			else if(location == 'LA'){
				window.location.replace('http://www.thinkcyber.com/pages/contact.asp?office=Rio%20de%20Janeiro');
			}
			else if(location == 'EU'){
				window.location.replace('http://www.thinkcyber.com/pages/contact.asp?office=Zuerich');
			}
			else if(location == 'AP'){
				window.location.replace('http://www.thinkcyber.com//pages/contact.asp?office=Los%20Angeles');
			}
		}
	}


