function $() {

	var elements = new Array();

	for (var i = 0; i < arguments.length; i++) {

		var element = arguments[i];

		if (typeof element == 'string')

			element = document.getElementById(element);

		if (arguments.length == 1)

			return element;

		elements.push(element);

	}

	return elements;

}



function addEvent( obj, type, fn ) {

	if (obj.addEventListener)

		obj.addEventListener( type, fn, false );

	else if (obj.attachEvent) {

		obj['e'+type+fn] = fn;

		obj[type+fn] = function() { obj['e'+type+fn]( window.event ); }

		obj.attachEvent( 'on'+type, obj[type+fn] );

	}

}



function removeEvent( obj, type, fn ) {

	if (obj.removeEventListener)

		obj.removeEventListener( type, fn, false );

	else if (obj.detachEvent) {

		obj.detachEvent( 'on'+type, obj[type+fn] );

		obj[type+fn] = null;

		obj['e'+type+fn] = null;

	}

}



Array.prototype.shuffle= function(times){

	var i,j,t,l=this.length;

	while(times--) {

		with(Math) {

			i=floor(random()*l);

			j=floor(random()*l);

		}

		t=this[i];

		this[i]=this[j];

		this[j]=t;

	}

	return this;

}



function externalLinks() {

	if (!document.getElementsByTagName) return;

	var a = document.getElementsByTagName("a");

	for (var i = 0; i < a.length; i++) {

		var link = a[i];

		if (link.getAttribute("href") && link.getAttribute("rel") == "external") {

			link.target = "_blank";

		}

	}

}



function validateRequestForm(f) {

	var errors = new Array();

	if (isEmpty(f.elements["items[Name]"].value)) {

		errors.push("Name missing");

	}

	if (isEmpty(f.elements["items[Title]"].value)) {

		errors.push("Title missing");

	}

	if (isEmpty(f.elements["items[Organization]"].value)) {

		errors.push("Organization missing");

	}

	if (isEmpty(f.elements["items[Phone]"].value)) {

		errors.push("Phone missing");

	}

	if (isEmpty(f.elements["email"].value)) {

		errors.push("E-mail address missing");

	} else if (!isValidEmail(f.elements["email"].value)) {

		errors.push("E-mail must be valid (format: username@example.com)");

	}

	return !errorAlert(errors);

}



function init() {

	// Setup fading text area for Looking? and Hiring? pages.

	if ($("textScroller")) {

		if ($("looking")) {

			textContent.push("Many experienced marketing, advertising and communications professionals have yet to discover MarketPro, the recruiting industry&#8217;s leading firm that specializes in identifying and placing highly qualified marketing talent with the right careers and contract assignments.");

			textContent.push("MarketPro&#8217;s sophisticated, Web-based talent recruiting technology is the only system of its kind available to established marketing, advertising and communications talent. We are able to receive, store, and match in seconds, a candidate&#8217;s fully categorized qualifying criteria and special skill sets &#8212; for immediate and ongoing matches with companies nationwide.");

			textContent.push("MarketPro works with numerous Fortune 500 and Global 2000 companies, which rely on us to quickly fill their marketing and communications staffing needs. Professionals who maintain a connection to MarketMatch have the best connections on the job market today.");

		} else {

			textContent.push("Many companies are limited in the number of qualified employees they can hire to achieve their marketing goals. More and more organizations are discovering MarketPro&#8217;s flexibility in offering expert contractors to take on temporary marketing, advertising and communications functions &#8212; without the commitment of a long-term, full-time employee.");

			textContent.push("MarketPro is the leading recruiter specializing exclusively in recruiting and staffing marketing, advertising and communications professionals &#8212; offering the recruiting industry&#8217;s widest variety of marketing staffing options, including contractors, direct-hire, contract-to-hire, and full- and part-time positions.");

			textContent.push("Employers and human resources professionals tasked with filling specialized marketing positions within their companies are normally not marketing experts. This creates challenges for companies in finding and hiring qualified individuals with pertinent skills. MarketPro closes that gap for companies because we are marketing professionals who specialize in recruiting and placing qualified marketing talent in the right jobs.");

		}

		textContent.shuffle(5);

		changecontent();

	}

	

	externalLinks();

	if (navigator.userAgent.indexOf("MSIE 7.0") > 0) {

		$("intro").style.height = "300px";

	}

}

	

addEvent(window, "load", init);





/***********************************************

* Fading Scroller-  Dynamic Drive DHTML code library (www.dynamicdrive.com)

* This notice MUST stay intact for legal use

* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code

***********************************************/



var delay = 20000; //set delay between message change (in miliseconds)

var maxsteps=30; // number of steps to take to change from start color to endcolor

var stepdelay=40; // time in miliseconds of a single step

//**Note: maxsteps*stepdelay will be total time in miliseconds of fading effect

var startcolor= new Array(255,255,255); // start color (red, green, blue) (#FFFFFF)

var endcolor=new Array(102,102,102); // end color (red, green, blue) (#666666)



var textContent=new Array();

///No need to edit below this line/////////////////

var ie4=document.all&&!document.getElementById;

var DOM2=document.getElementById;

var faderdelay=0;

var index=0;





/*Rafael Raposo edited function*/

//function to change content

function changecontent(){

 	if (index >= textContent.length) {

 		index = 0;

 	}

 	

 	if (document.getElementById) {

	   // document.getElementById("textScroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")"

		 document.getElementById("textScroller").style.color="rgb("+endcolor[0]+","+endcolor[1]+", "+endcolor[2]+")"

	   	document.getElementById("textScroller").innerHTML=textContent[index]

	   colorfade(1, 15);

  	}



	index++

}



// colorfade() partially by Marcio Galli for Netscape Communications.  ////////////

// Modified by Dynamicdrive.com

/*Rafael Raposo edited function*/

var fadecounter;

function colorfade(step) {

  if(step<=maxsteps) {	

    document.getElementById("textScroller").style.color=getstepcolor(step);

    step++;

    fadecounter=setTimeout("colorfade("+step+")",stepdelay);

  }else{

    clearTimeout(fadecounter);

    document.getElementById("textScroller").style.color="rgb("+endcolor[0]+", "+endcolor[1]+", "+endcolor[2]+")";

    setTimeout("changecontent()", delay);

	

  }   

}



/*Rafael Raposo's new function*/

function getstepcolor(step) {

  var diff

  var newcolor=new Array(3);

  for(var i=0;i<3;i++) {

    diff = (startcolor[i]-endcolor[i]);

    if(diff > 0) {

      newcolor[i] = startcolor[i]-(Math.round((diff/maxsteps))*step);

    } else {

      newcolor[i] = startcolor[i]+(Math.round((Math.abs(diff)/maxsteps))*step);

    }

  }

  return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");

}

<!--
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_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_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];}
}
//-->
