var GB_ANIMATION = true;
$estamadre(document).ready(function(){
	$estamadre("a.grey_temas").click(function(){
		var t = this.title || $estamadre(this).text() || this.href;
		GB_show(t,this.href,640,600,'confirm_leave');
		return false;
	});
});

var GB_ANIMATION = true;
$estamadre(document).ready(function(){
	$estamadre("a.greyboxes").click(function(){
		var t = this.title || $estamadre(this).text() || this.href;
		GB_show(t,this.href,360,600,'confirm_leave');
		return false;
	});
});

$estamadre(document).ready(function(){
	$estamadre("a.greybox_mission").click(function(){
		var t = this.title || $estamadre(this).text() || this.href;
		GB_show(t,this.href,400,500,'mission_details');
		return false;
	});
});

$estamadre(document).ready(function(){
	$estamadre("a.greybox_add_friends").click(function(){
		var t = this.title || $estamadre(this).text() || this.href;
		GB_show(t,this.href,245,515,'add_friends');
		return false;
	});
});

// added by brad:
function trackMedia(media_location)
{	
	pageTracker._trackPageview(media_location);
    //alert ("tracking: " + media_location);
}


function set_page_as_default() {
	document.cookie = "page_default=; expires=Thu 26 Feb 2009 12:00:12 America/Los_Angeles";
	//writeSessionCookie ('page_default', );
	alert('This page has been set as your default.');
}


function add_this() {
	GB_show('', 'http://www.callofduty.com/add_this/', 750, 595, 'add_this');
}

// added by brad
function show_xlarge_video(id){
    GB_show('', 'http://www.callofduty.com/video_player#'+ id, 642, 946, 'video_player');
}

function forgot_password() {
	GB_show('', 'http://www.callofduty.com/forgot_password/', 245, 515, 'forgot_password');
}

function official_rules() {
	GB_show('', 'http://www.callofduty.com/official_rules/', 560, 515, 'official_rules');
}

function sweepstakes_detail() {
	GB_show('', 'http://www.callofduty.com/sweepstakes_detail/', 560, 515, 'sweepstakes_detail');
	return false;
}

function confirm_leave(url) {
	GB_show('', 'http://www.callofduty.com/confirm_leave/?url='+ escape(url), 245, 515, 'confirm_leave');
	return false;
}

function confirm_leave_to_activision(url) {
	GB_show('', 'http://www.callofduty.com/confirm_leave/?url='+ escape(url) +'&activision=1', 245, 515, 'confirm_leave');
	//return false;
}

function image_popup(image) {
	GB_show('', 'http://www.callofduty.com/image_popup/?image='+ escape(image), 420, 639, 'image_popup');
	//return false;
}

function openRecruitFriend(){
	GB_show('', 'http://www.callofduty.com/recruit-friend', 420, 639, 'mission_details');
}

function confirm_leave_flash(url) {
	GB_show('', 'http://www.callofduty.com/confirm_leave/?url='+ escape(url), 245, 515, 'confirm_leave');
}
var swfobject_params = { wmode: true };

function send_to_friend(param, type) {
	if (type == null) {
		type = '';
	}
	if (param == null) {
		param = document.location;
	}
	var url = 'http://www.callofduty.com';
	switch (type) {
	default:
		url = param;
		break;
	case 'video':
	case 'screenshots':
	case 'concept_art':
	case 'wallpapers':
		url += '/reconnaissance/' + type + '#' + param;
		break;
	}
	alert('Send to Friend: ' + url);
}
function set_url_id(id) {
	var loc = document.location.toString();
	var newLoc;
	if (loc.match('#')) {
		newLoc = loc.split('#')[0];
	} else {
		newLoc = loc;
	}
	document.location = newLoc + '#' + id;
}
function get_url_id() {
	var loc = document.location.toString();
	var id = 0;
	if (loc.match('#')) {
		id = loc.split('#')[1];
	}
	return id;
}

$estamadre(document).ready(function(){
	$estamadre("a.external_link").click(function(){
		var t = this.title || $estamadre(this).text() || this.href;
		GB_show(t,'/confirm_leave/?url='+ escape(this.href),245,515,'confirm_leave');
		return false;
	});
});


$estamadre(document).ready(function(){
	$estamadre("a.intel_image").click(function(){
		var t = this.title || $estamadre(this).text() || this.href;
		GB_show('', 'http://www.callofduty.com/image_popup/?filename='+ escape(this.href), 638, 430, 'image_popup');
		return false;
	});
});