/* General VisualMIX info/box and auth routines by Freaking Wildchild */


  function _ajax_request(url, data, callback, type, method) {
    if (jQuery.isFunction(data)) {
      callback = data;
      data = {};
    }

  return jQuery.ajax({
      type: method,
      url: url,
      data: data,
      success: callback,
      dataType: type
    });
  }

     jQuery.fn.fademylinks = function(settings) {
	settings = jQuery.extend({ color: '#ff8c00',duration: 200}, settings);
	return this.each(function() {
		var original = $(this).css('color');  var blinkval = settings.duration / 4;
		$(this).mouseover(function() { $(this).animate({ color: settings.color },settings.duration).fadeOut(blinkval).fadeIn(blinkval).fadeOut(blinkval).fadeIn(blinkval).fadeOut(blinkval).fadeIn(blinkval); });
		$(this).mouseout(function() { $(this).animate({ color: original },settings.duration); });
	});
     };

     function infobox(message) {
        $("#autoAuthList").html(message);
        $('.authBox').css('opacity', 0);
        $('.authBox').show();
        $('.authBox').animate({opacity: 0.85}, {queue: false, duration: 'slow'});
        $(".authBox").fadeIn(600).animate({bottom:"20px"},2000).fadeOut(1200);
      }

      function Box(el,id, idmember){
        if(!document.getElementById) return false;
        var div = document.getElementById(el+id);
        var curDiv = document.getElementById(el+current[idmember]);
        curDiv.style.display = "none";
        div.style.display = "block";
        current[idmember] = id;
      }

      function processAuth(responseXML) {
        var message = $('msg',responseXML).text();
        var header = $('head',responseXML).text();
        var form = $('form',responseXML).text();

        if($('code',responseXML).text() > 203) {
           $.jGrowl(message, { header: header, life: 10000 });
        } else {
           $.jGrowl(message, { header: header, life: 8000, sticky: false });
        }

        $("#autoAuthLists").html(message);
        $("#loginresult").html(message);
        $("pass").val();


        if($('code',responseXML).text() == 200) {
           $("#authbut").load("/auth/button");
           $.cookie('inUser', $('id',responseXML).text(),{ path: '/', expires: 1, domain: $('cookiedom',responseXML).text() });
           $.cookie('inKey', $('key',responseXML).text(),{ path: '/', expires: 1, domain: $('cookiedom',responseXML).text() });
           $.cookie('inChal', $('hash',responseXML).text(),{ path: '/', expires: 1, domain: $('cookiedom',responseXML).text() });
           $.cookie('inRealm', $('realm',responseXML).text(),{ path: '/', expires: 1, domain: $('cookiedom',responseXML).text() });
           $("#authForm").fadeOut('slow');
        }
      
          if($('reload',responseXML).text()) { window.history.go(0); } else {
          if($('returl',responseXML).text()) {
            window.location.replace("http://" + $('returl',responseXML).text());
          }
        }
      }


     $("#statusbox").ready(function() {
        $("#object").fadeIn(100).animate({top:"-=20px"},100).animate({top:"+=20px"},100).animate({top:"-=20px"},100).animate({top:"+=20px"},100).animate({top:"-=20px"},100).animate({top:"+=20px"},100).animate({top:"-=20px;"},100);
     });

        $(document).ready(function() {
          $(".cardbox").colorbox({width:"75%", height:"70%", iframe:true});
          $(".video").colorbox({iframe:true, innerWidth:425, innerHeight:344});
          $(".loginbox").colorbox({width:"50%", inline:true, href:"#inline_auth"});
          $("#hovercolor tr").hover(function() {
            $(this).addClass("highlight");
          },function() {
            $(this).removeClass("highlight");
          });
        });
