/**
 * @package digital distribution
 * @version 1.000
 */
/***************************************************************************************
 * Media Intel Services, LLC.
 * (Written for FanCorps.com)
 * Copyright (c) 2007, Media Intel Services, LLC.  
 * All Rights Reserved.
 *
 * This file and the source codes contained herein are the property
 * of Media Intel Services, LLC.  
 *
 * Media Intel Services, LLC.
 * http://www.mediaintelservices.com/
 * sales@mediaintelservices.com
 * 
 * FanCorps
 * http://digital.fancorps.com
 * webmaster@fancorps.com
 *
 * File: /js/scripts.js
 * 		
 * Revision 1.000	1/1/2008	jem
 *		Initial Release
 *
 ***************************************************************************************/
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function displayWindow(url, width, height, resizable, scrollbars, menubar, status, screenX, screenY, left, top) {
	var Win = window.open(url,"displayWindow3",'width=' + width + ',height=' + height + ',resizable=' + resizable + ',scrollbars=' + scrollbars + ',menubar=' + menubar + ',status=' + status + ',left=' + left + ',top=' + top + ',screenX=' + screenX + ',screenY=' + screenY + '' );
}

function HideContentDisplay(d) {
		document.getElementById(d).style.display = "none";
}
function ShowContentDisplay(d) {
	document.getElementById(d).style.display = "block";
}
function ReverseContentDisplay(d) {
	if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
	else { document.getElementById(d).style.display = "none"; }
}
/* Used for top level BULLET buttons */
function changeButtonColorParent(divid_link,when){
	if(when == 'over'){
		parent_cur_class = document.getElementById(divid_link).className
		document.getElementById(divid_link).className = 'nav_parent_button_on';
	} else {
		document.getElementById(divid_link).className = parent_cur_class;
	}
}
/* Use for the normal SQUARE buttons */
function changeButtonColor(divid_link,when){
	if(when == 'over'){
		cur_class = document.getElementById(divid_link).className
		document.getElementById(divid_link).className = 'nav_button_on';
	} else {
		document.getElementById(divid_link).className = cur_class;
	}
}
function checkUncheckAll(theElement) {
	var theForm = theElement.form, z = 2;
	for(z=2; z<theForm.length;z++){
		if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
			theForm[z].checked = theElement.checked;
		}
	}
}

// checkUncheckAllByDiv(this,'divid');
function checkUncheckAllByDiv(theElement,divid) {
	 var boxes = document.getElementById(divid).getElementsByTagName("input"), z = 1;
	 for(z=1; z<boxes.length;z++){
      if(boxes[z].type == 'checkbox' && boxes[z].name != 'checkall' && boxes[z].name != 'change_purchase_status'){
	  	boxes[z].checked = document.getElementById(theElement).checked;
	  }
    }
}

/* Trigger Div Fade */
function fadeDivContent(divid){
	setTimeout("beginFadeDivContent('"+divid+"')",3000);
}
/* Begin Fading of Div */
function beginFadeDivContent(divid){
	NLBfadeBg(divid,'#f8f8f8','#008000','6000');
	setTimeout("hideDivContent('"+divid+"')",6000);
}
/* Hide Div */
function hideDivContent(divid){
	new Effect.Fade($(divid));
}
function highlightFieldError(field_id) {
	$(field_id).className = 'textinput_error';
	$(field_id).focus();
}