/*
* ==========================================================
* Product: The 7 Figure Networker System
* Version: 1.7
* Usage Auth: All
* Purpose: General User JS Functions
* Location: /js
* Last Updated: February 01, 2010
* Created By & Copyright 2008 (c): James Delcamp
* Contact: phpfrog at gmail dot com
* ==========================================================
*/

function $$() {
  return $A(arguments).map(function(expression) {
        return expression.strip().split(/\s+/).inject([null], function(results, expr) {
          var selector = new Selector(expr);
          return results.map(selector.findElements.bind(selector)).flatten();
        });
   }).flatten();
}

// Add items that need to be loaded
// after page completely loads
$(document).ready(function() {

	$('.vid_box').colorbox( {width:"800", height:"700", iframe:true});
	$("select#refid").searchable();
    if ( $('#errorMsg') ) { $("#errorMsg").fadeIn().click( function(){$(this).animate({opacity: 1.0}, 950).fadeOut()}); }
    if ( $('#successMsg') ) { $("#successMsg").fadeIn().click( function(){$(this).animate({opacity: 1.0}, 950).fadeOut()}); }
    if ( $('#noticeMsg') ) { $("#noticeMsg").fadeIn().click( function(){$(this).animate({opacity: 1.0}, 950).fadeOut()}); }

/*
	decoGreyboxLinks();

    try {
        //$('#container').css("display", "block");
		$('#container').show();
		$('#footer').show();
	} catch (e) {}
*/
	$('.stripe tr:odd:not(".skip",".deleted_row")').addClass('alt');
	$('.stripe tr:odd:not(".alt",".deleted_row")').addClass('altdef');

	/* CRollover Images */
	$(".rollover_bttn").hover( function (){
		$(this).attr("src", $(this).attr("src").split(".png").join("_pressed.png"));
//		this.src = this.src.replace("_off","_on");
	}, function () {
		$(this).attr("src", $(this).attr("src").split("_pressed.png").join(".png"));
//		this.src = this.src.replace("_on","_off");
	});

	$("a").find("#save_bttn").hover( function (){
		$(this).attr("src", $(this).attr("src").split(".png").join("_pressed.png"));
	}, function () {
		$(this).attr("src", $(this).attr("src").split("_pressed.png").join(".png"));
	});

	$("a").find("#action_viewbttn").hover( function (){
		$(this).attr("src", $(this).attr("src").split(".png").join("_pressed.png"));
	}, function () {
		$(this).attr("src", $(this).attr("src").split("_pressed.png").join(".png"));
	});
	
	$("a.webopti").click(function(){
		$(this).parent().parent().find('div.inner_container').toggle();
	});
	
	try {
		  $('.prog_row').hover( function() {
			  $(this).css('cursor', 'pointer');
		  }, function() {
			  $(this).css('cursor', 'default');
		  });
		}catch(e){}

	try { $("#name").focus(); }catch(e){}

	// For pages displaying the prog rating
	try { $('input.wow').rating(); }catch(e){}
});