/* preload images */
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 MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function openImageWindow(url){
  window.open(url,'Image', 'width=475,height=400,location=no,status=no,menubar=no,resizable=yes,scrollbars=yes');
}

function changeFlashSize(objID,width,height){
	if (objID && width && height) {
		
		var fObj = document.getElementById('FlashTeaser_'+objID);
		var fEmb = document.getElementById('FlashTeaser_embed_'+objID);
		
		if (fObj && fObj.style) {
			fObj.setAttribute('width',width);
			fObj.setAttribute('height',height);
			fObj.style.width = width+'px';
			fObj.style.height = height+'px';
		}
		
		if (fEmb != null) { 
			fEmb.width = width;
			fEmb.height = height;
			
			if (fEmb.style) { 
				fEmb.style.width = width+'px';
				fEmb.style.height = height+'px';
			}
		}
	}
}

function superchallenge_pass(form) {
		var pass = form.pass.value;
		if (pass) {
			var enc_pass = MD5(pass);
			var str = form.user.value+":"+enc_pass+":"+form.challenge.value;
			form.pass.value = MD5(str);
			return true;
		} else {
			return false;
		}
}

//-->
//<!--

// chCounter
// settings:
cstatus = "active";
visible = "0";
page_title = "";
url_of_counter_file = "http://www.voiceobjects.com/scripts/counter/counter.php";

////////////////
page_url = unescape( location.href );
referrer = ( document.referrer ) ? document.referrer : "";
page_title = ( page_title.length == 0 ) ? document.title : page_title;
document.write( "<script type=\"text/javascript\" src=\"" );
document.write( url_of_counter_file + "?chCounter_mode=js&amp;jscode_version=3.0.0RC2&amp;status=" + cstatus + "&amp;visible=" + visible + "&amp;page_title=" + encodeURIComponent( page_title ) );
document.write( "&amp;page_url=" + encodeURIComponent( page_url ) + "&amp;referrer=" + encodeURIComponent( referrer ) + "&amp;res_width=" + screen.width + "&amp;res_height=" + screen.height + "\"></" + "script>" );
//-->

//open browser window

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// yaromat form validation

function YY_checkform() { //v4.71
//copyright (c)1998,2002 Yaromat.com
  var a=YY_checkform.arguments,oo=true,v='',s='',err=false,r,o,at,o1,t,i,j,ma,rx,cd,cm,cy,dte,at;
  for (i=1; i<a.length;i=i+4){
    if (a[i+1].charAt(0)=='#'){r=true; a[i+1]=a[i+1].substring(1);}else{r=false}
    o=MM_findObj(a[i].replace(/\[\d+\]/ig,""));
    o1=MM_findObj(a[i+1].replace(/\[\d+\]/ig,""));
    v=o.value;t=a[i+2];
    if (o.type=='text'||o.type=='password'||o.type=='hidden'){
      if (r&&v.length==0){err=true}
      if (v.length>0)
      if (t==1){ //fromto
        ma=a[i+1].split('_');if(isNaN(v)||v<ma[0]/1||v > ma[1]/1){err=true}
      } else if (t==2){
        rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-zA-Z]{2,4}$");if(!rx.test(v))err=true;
      } else if (t==3){ // date
        ma=a[i+1].split("#");at=v.match(ma[0]);
        if(at){
          cd=(at[ma[1]])?at[ma[1]]:1;cm=at[ma[2]]-1;cy=at[ma[3]];
          dte=new Date(cy,cm,cd);
          if(dte.getFullYear()!=cy||dte.getDate()!=cd||dte.getMonth()!=cm){err=true};
        }else{err=true}
      } else if (t==4){ // time
        ma=a[i+1].split("#");at=v.match(ma[0]);if(!at){err=true}
      } else if (t==5){ // check this 2
            if(o1.length)o1=o1[a[i+1].replace(/(.*\[)|(\].*)/ig,"")];
            if(!o1.checked){err=true}
      } else if (t==6){ // the same
            if(v!=MM_findObj(a[i+1]).value){err=true}
      }
    } else
    if (!o.type&&o.length>0&&o[0].type=='radio'){
          at = a[i].match(/(.*)\[(\d+)\].*/i);
          o2=(o.length>1)?o[at[2]]:o;
      if (t==1&&o2&&o2.checked&&o1&&o1.value.length/1==0){err=true}
      if (t==2){
        oo=false;
        for(j=0;j<o.length;j++){oo=oo||o[j].checked}
        if(!oo){s+='* '+a[i+3]+'\n'}
      }
    } else if (o.type=='checkbox'){
      if((t==1&&o.checked==false)||(t==2&&o.checked&&o1&&o1.value.length/1==0)){err=true}
    } else if (o.type=='select-one'||o.type=='select-multiple'){
      if(t==1&&o.selectedIndex/1==0){err=true}
    }else if (o.type=='textarea'){
      if(v.length<a[i+1]){err=true}
    }
    if (err){s+='* '+a[i+3]+'\n'; err=false}
  }
  if (s!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+s)}
  document.MM_returnValue = (s=='');
}


//version 1.2

function spam_vaccine( theHREFArray, theTextArray, theQBulletPath) {
	var theHREF, theText, extraAttributes ;
	extraAttributes = "";
	if( theHREFArray.length == 1 ) {
		theHREF = theHREFArray[0] ;
	}
	else if (theHREFArray.length > 1 ) {
		theHREF = "mailto:" + theHREFArray[0] + "@" + theHREFArray[2] + "." + theHREFArray[4] + theHREFArray[3] ;
		extraAttributes = theHREFArray[5];
	}
	else {
		theHREF = "";
	}
	
	if( theTextArray.length == 1 ) {
		theText = theTextArray[0];
	}
	else if (theTextArray.length> 1 ) {
		theText = theTextArray[1] + theTextArray[0] + "@" + theTextArray[2] + "." + theTextArray[4] + theTextArray[3] ;
	}
	else {
		theText = theHREFArray[0] + "@" + theHREFArray[2] + "." + theHREFArray[4] ;
	}

	if(theHREF) {
		theText = "<a href=\"" + theHREF + "\"" + extraAttributes + ">" + theText ;
		if(theQBulletPath) {
			theText += '<img width="14" height="10" border="0" align="absmiddle" hspace="1" alt="" src="' + theQBulletPath + 'mailto.gif">' ;
		}
		theText += "</a>";
	}
	document.write(theText);
}


/* EMAIL ENCRYPTION SCRIPT */

// This script is (c) copyright 2006 Jim Tucek under the
// GNU General Public License (http://www.gnu.org/licenses/gpl.html)
// For more information, visit www.jracademy.com/~jtucek/email/ 
// Leave the above comments alone!
// CODE USED: P: 101  Q: 31
// see encryption_instructions.txt for explanation of usage

var decryption_cache = new Array();

function decrypt_string(crypted_string,n,decryption_key,just_email_address) {
	var cache_index = "'"+crypted_string+","+just_email_address+"'";

	if(decryption_cache[cache_index])					// If this string has already been decrypted, just
		return decryption_cache[cache_index];				// return the cached version.

	if(addresses[crypted_string])						// Is crypted_string an index into the addresses array
		var crypted_string = addresses[crypted_string];			// or an actual string of numbers?

	if(!crypted_string.length)						// Make sure the string is actually a string
		return "Error, not a valid index.";

	if(n == 0 || decryption_key == 0) {					// If the decryption key and n are not passed to the
		var numbers = crypted_string.split(' ');			// function, assume they are stored as the first two
		n = numbers[0];	decryption_key = numbers[1];			// numbers in crypted string.
		numbers[0] = ""; numbers[1] = "";				// Remove them from the crypted string and continue
		crypted_string = numbers.join(" ").substr(2);
	}

	var decrypted_string = '';
	var crypted_characters = crypted_string.split(' ');

	for(var i in crypted_characters) {
		var current_character = crypted_characters[i];
		var decrypted_character = exponentialModulo(current_character,n,decryption_key);
		if(just_email_address && i < 7)				// Skip 'mailto:' part
			continue;
		if(just_email_address && decrypted_character == 63)	// Stop at '?subject=....'
			break;
		decrypted_string += String.fromCharCode(decrypted_character);
	}
	
	decryption_cache[cache_index] = decrypted_string;			// Cache this string for any future calls

	return decrypted_string;
}

function decrypt_and_email(crypted_string,n,decryption_key) {
	if(!n || !decryption_key) { n = 0; decryption_key = 0; }
	if(!crypted_string) crypted_string = 0;

	var decrypted_string = decrypt_string(crypted_string,n,decryption_key,false);
	parent.location = decrypted_string;
}

function decrypt_and_echo(crypted_string,n,decryption_key) {
	if(!n || !decryption_key) { n = 0; decryption_key = 0; }
	if(!crypted_string) crypted_string = 0;

	var decrypted_string = decrypt_string(crypted_string,n,decryption_key,true);
	document.write(decrypted_string);
	return true;
}

// Finds base^exponent % y for large values of (base^exponent)
function exponentialModulo(base,exponent,y) {
	if (y % 2 == 0) {
		answer = 1;
		for(var i = 1; i <= y/2; i++) {
			temp = (base*base) % exponent;
			answer = (temp*answer) % exponent;
		}
	} else {
		answer = base;
		for(var i = 1; i <= y/2; i++) {
			temp = (base*base) % exponent;
			answer = (temp*answer) % exponent;
		}
	}
	return answer;
}

// email addresses: 

if(!addresses) var addresses = new Array();
addresses.push("3131 2143 1806 2806 830 1201 3129 1404 2495 282 2740 830 1327 808 1964 2935 830 3129 1750 3073 1327 1404 830 781 808 1404 439 456 808 781 3129 2935 209 781 1404 1806");  // #0 , university @ voiceobjects.com
addresses.push("6169 4243 194 6123 1543 1263 1889 3698 5750 3091 194 6123 2601 2601 3753 1314 2329 5357 3698 1543 4563 3753 3698 625 3091 3753 4563 1889 145 3278 4563 3698 194 125 145 2731 625 3091 3753 4563 1889 5362 6089 6139 6123 194 6139 1543 1314 1889 3753 5436 3753 145 1889 3753 2601 6139 1543 1314 6139 1889 2245 3753 6139 5087 3698 1543 4563 3753 4941 625 3091 3753 4563 1889 145 6139 2799 6123 5436 1889 1314 3753 5436 6139 2799 5436 3698 5910 5436 6123 194"); // #1 jmadden @ voiceobjects.com - Contact Us on Partner Page
addresses.push("18527 18523 3668 7566 12443 14963 17876 10563 17243 17768 13680 625 17876 11763 10563 4499 10720 17014 10563 12443 13680 17469 10563 9022 5727 17469 13680 17876 6511 15378 13680 10563 3668 12144 6511 5483 9022 5727 17469 13680 17876 5881 17469 3668 7566 12443 14963 7227 17789 11763 10563 3668 7227 18308 10563 12443 13680 17469 4644 9022 5727 17469 13680 17876 6511 15378 13680 10563 3668");  // #2 kcytron - at - voiceobjects.com
addresses.push("3379 3373 1744 2837 365 1852 2478 1652 1255 563 2610 135 2837 2478 2172 135 500 3125 1652 365 2610 2172 1652 563 456 2172 2610 2478 641 1790 2610 1652 1744");  // [3] bcrater - at - voiceobjects.com
addresses.push("3379 3373 1744 2837 365 1852 2478 1652 1255 641 987 365 2399 2478 2172 135 1073 2837 1744 2487 500 2235 1652 365 2610 2172 229 563 456 2172 2610 2478 641 1790 2610 1652 1744");  // [4] swinterkamp - at - VoiceObjects.com
addresses.push("3379 3373 1744 2837 365 1852 2478 1652 1255 456 2487 365 2172 135 135 2172 2478 500 2478 1744 2610 2399 2172 2478 1790 2610 1652 1744");  // [5] jpierret - at - tmcnet.com
addresses.push("3379 3373 1744 2837 365 1852 2478 1652 1255 563 135 1652 1652 1073 2172 500 1073 365 2399 2172 2478 365 2610 641 1790 2610 1652 1744 1790 2837 2297");  // [6] brooke - at - kinetics.com.au
addresses.push("2669 2663 760 551 2187 2037 516 2025 1933 760 407 273 551 984 1024 1155 2025 766 407 2025 330 108 2025 760");  // [7] megan - at - voxeo.com