/*\
 * Array Functionality
 * script: array.js
 * for: browsers not implementing the full array functionality of ECMA262-3
\*/

if(typeof Array.prototype.copy=='undefined')
    Array.prototype.copy=function(a){
        var
            i=0,
            b=[];
        for(i;i<this.length;i++)
            b[i]=(typeof this[i].copy!='undefined')?
                this[i].copy():
                this[i];
        return b
    };

if(typeof Array.prototype.concat=='undefined')
    Array.prototype.concat=function(a){
        var
            i=0,
            b=this.copy();
        for(i;i<a.length;i++)
            b[b.length]=a[i];
        return b
    };
    
if(typeof Array.prototype.pop=='undefined')
    Array.prototype.pop=function(){
        var
            b=this[this.length-1];
        this.length--;
        return b
    };

if(typeof Array.prototype.push=='undefined')
    Array.prototype.push=function(){
        var
            i=0,
            b=this.length,
            a=arguments;
        for(i;i<a.length;i++)
            this[b+i]=a[i];
        return this.length
    };

if(typeof Array.prototype.shift=='undefined')
    Array.prototype.shift=function(){
        var
            i=0,
            b=this[0];
        for(i;i<this.length-1;i++)
            this[i]=this[i+1];
        this.length--;
        return b
    };

if(typeof Array.prototype.slice=='undefined')
    Array.prototype.slice=function(a,c){
        var
            i=0,
            b,
            d=[];
        if(!c)
            c=this.length;
        if(c<0)
            c=this.length+c;
        if(a<0)
            a=this.length-a;
        if(c<a){
            b=a;
            a=c;
            c=b
        }
        for(i;i<c-a;i++)
            d[i]=this[a+i];
        return d
    };

if(typeof Array.prototype.splice=='undefined')
    Array.prototype.splice=function(a,c){
        var
            i=0,
            e=arguments,
            d=this.copy(),
            f=a;
        if(!c)
            c=this.length-a;
        for(i;i<e.length-2;i++)
            this[a+i]=e[i+2];
        for(a;a<this.length-c;a++)
            this[a+e.length-2]=d[a-c];
        this.length-=c-e.length+2;
        return d.slice(f,f+c)
    };

if(typeof Array.prototype.unshift=='undefined')
    Array.prototype.unshift=function(a){
        var
            b;
        this.reverse();
        b=this.push(a);
        this.reverse();
        return b
    };



function rollSetup() {
 /** string added to "on" state images */
 var post = "_o";

 /** fetch the image tag array from the DOM */
 var imgTags = document.getElementsByTagName("img");

 /** loop through the images for find appropriate preloads */
 for (i=0; i < imgTags.length; i++) {
  /** make sure there is a source defined */
  if (imgTags[i].src != '') {
   /** make sure the image tag has a class */
   tmpClass = imgTags[i].className;
   if (tmpClass) {
    /** match the image rollover class */  
    if (tmpClass.match("rollover")) {
     /** store the image source to the 'imgOut' attribute */    
     imgTags[i].imgOut = new Image();
     imgTags[i].imgOut.src = imgTags[i].src;
	
     /** pull apart the source string */
     srcLength = imgTags[i].src.length;

     srcName = imgTags[i].src.substr(0, srcLength-4);
     srcExt = imgTags[i].src.substr(srcLength-4, srcLength);

     /** store the image source to the 'imgOver' attribute */
     imgTags[i].imgOver = new Image();
     imgTags[i].imgOver.src = srcName + post + srcExt;

     /** set up the 'onmouseover' and 'onmouseout' event handlers */     
     imgTags[i].onmouseover = function() {
      this.src = this.imgOver.src;
     }
     imgTags[i].onmouseout = function() {
      this.src = this.imgOut.src;
     }
    }
   }
  }
 }
}

function show(id) {
		var p = document.getElementById(id);
		p.style.display = "block";
	}

	function hide(id) {
		var p = document.getElementById(id);
		p.style.display = "none";
	}

if(typeof Array.prototype.splice=='undefined')
    Array.prototype.splice=function(a,c){
        var
            i=0,
            e=arguments,
            d=this.copy(),
            f=a;
        if(!c)
            c=this.length-a;
        for(i;i<e.length-2;i++)
            this[a+i]=e[i+2];
        for(a;a<this.length-c;a++)
            this[a+e.length-2]=d[a-c];
        this.length-=c-e.length+2;
        return d.slice(f,f+c)
    };

function stopError() {
  return true;
}

function getRandomNum(lbound, ubound) {
return (Math.floor(Math.random() * (ubound - lbound)) + lbound);
}

var timeDelay = 9500; // change delay time in seconds
var counter = 0;

function startPix(func) {
setInterval(func, timeDelay);
}

var init = false;
function slideshow() {
	if(init == false || choices.length == 0){
	//alert("creating array");
	choices = new Array("01.gif", "02.gif", "03.gif", "04.gif", "05.gif", "06.gif", "07.gif", "08.gif", "09.gif", "10.gif", "11.gif", "12.gif", "13.gif", "14.gif", "15.gif");
	init = true;
	}
	var path = "./img/quotes/"
	var selected= getRandomNum(0, choices.length);
	var imagePath =  choices.splice(selected,1);
	//alert("pic: "+imagePath + " length: "+choices.length);
	document.quote.src = path + imagePath;
}


var career_init = false;
function career_slideshow() {
	if(career_init == false || choices.length == 0){
	//alert("creating array");
	choices = new Array("01.gif", "02.gif", "03.gif", "04.gif", "05.gif", "06.gif", "07.gif", "08.gif", "09.gif");
	career_init = true;
	}
	var path = "./img/career_quotes/"
	var selected= getRandomNum(0, choices.length);
	var imagePath =  choices.splice(selected,1);
	//alert("pic: "+imagePath + " length: "+choices.length);
	document.quote.src = path + imagePath;
}


}

function archiveATN(){
document.write("<form name=\"articlenavigator\">\n");
document.write("<select name=\"jump\" id=\"jump\" onChange=\"MM_jumpMenu('parent',this,0)\">\n");
document.write("<option value=\"\">Archived Accounting and Tax News</option>\n");
document.write("<option value=\"atn21.htm\">President Bush Signs Housing Bill with $15.1 Billion in Tax Incentives</option>\n");
document.write("<option value=\"atn20.htm\">IRS Creates Safe Harbor for 1031 Property With Limited Personal Use</option>\n");
document.write("</select></form>\n");
}

function archiveAPR(){
document.write("<form name=\"articlenavigator\">\n");
document.write("<select name=\"jump\" id=\"jump\" onChange=\"MM_jumpMenu('parent',this,0)\"> \n");
document.write("<option>Archived Press Releases</option>\n");
document.write("<option value=\"apr31.htm\">The Curchin Group to Host Third Annual Miniature Golf Tournament for Charity</option>\n");
document.write("<option value=\"apr30.htm\">Two Curchin Employees Appointed as Officers of NJ Society of CPAs for Monmouth / Ocean Chapter</option>\n");
document.write("<option value=\"apr29.htm\">Lynn Conover of The Curchin Group Honored by Northern Monmouth Chamber of Commerce with Crystal Beacon Award</option>\n");
document.write("<option value=\"apr28.htm\">Peter Pfister of The Curchin Group Speaks at Monmouth County Association of Realtors</option>\n");
document.write("<option value=\"apr27.htm\">Two CPAs of The Curchin Group Each Named Treasurer of Local Chambers of Commerce</option>\n");
document.write("<option value=\"apr26.htm\">The Curchin Group Welcomes Two New Staff Accountants</option>\n");
document.write("<option value=\"apr24.htm\">The Curchin Group to Host Second Annual Indoor Miniature Golf Tournament for Charity</option>\n");
document.write("<option value=\"apr23.htm\">The Curchin Group Welcomes Two Summer Interns</option>\n");
document.write("<option value=\"apr22.htm\">Curchin Director Admitted to the New Jersey Roster of Mediators for Family Law</option>\n");
document.write("<option value=\"apr20.htm\">Two Curchin Senior Professionals Present at the Medical Society of New Jersey</option>\n");
document.write("<option value=\"apr19.htm\">Curchin Exhibits at the New Jersey Credit Union League’s Annual Leadership Conference</option>\n");
document.write("<option value=\"apr18.htm\">The Curchin Group Hires a Director of Valuations &amp; Litigation Services</option>\n");
document.write("<option value=\"apr17.htm\">The Curchin Group Welcomes Anthony J. Turano as a New Associate</option>\n");
document.write("<option value=\"apr16.htm\">Curchin Partner Named President of the New Jersey Chapter of the Community Associations Institute</option>\n");
document.write("<option value=\"apr15.htm\">The Curchin Group Welcomes New Manager Joseph L. Marino, CPA</option>\n");
document.write("<option value=\"apr14.htm\">The Curchin Group Raised Over $7,500 at its First Annual Indoor Miniature Golf Tournament for Charity</option>\n");
document.write("<option value=\"apr13.htm\">The Curchin Group Welcomes Kimberly Melski as a Manager</option>\n");
document.write("<option value=\"apr12.htm\">The Curchin Group to Host its First Annual Indoor Miniature Golf Tournament for Charity</option>\n");
document.write("<option value=\"apr11.htm\">Curchin Partner to Receive Spinnaker Award from the Eastern Monmouth Area Chamber of Commerce</option>\n");
document.write("<option value=\"apr10.htm\">Curchin Partner Presents at the National Association of Credit Union Supervisory &amp; Auditing Committees&rsquo; Annual Conference &amp; Exposition</option>\n");
document.write("<option value=\"apr9.htm\">Curchin Exhibits at the Eastern Monmouth Chamber of Commerce&rsquo;s Annual Expo </option>\n");
document.write("<option value=\"apr8.htm\">Curchin Partner to be a Special Guest on CNBC&rsquo;s Tax Thursdays</option>\n");
document.write("<option value=\"apr7.htm\">Curchin Partner Presents the Benefits of Working for a Small Accounting Firm to his Alma Mater</option>\n");
document.write("<option value=\"apr6.htm\">The Curchin Group and Smith Barney to Host Joint Seminar on Year-End Tax Planning</option>\n");
document.write("<option value=\"apr5.htm\">Curchin Partner Goes National Talking About the Benefits of \"Like Kind Exchanges\"</option>\n");
document.write("<option value=\"apr4.htm\">The Curchin Group Celebrates its 50th Year</option>\n");
document.write("<option value=\"apr3.htm\">Curchin Group Professional Receives Young Leadership Award</option>\n");
document.write("<option value=\"apr2.htm\">Curchin Partner Doug Stives is Featured on \"Your Money\"</option>\n");
document.write("<option value=\"apr1.htm\">CNBC's Morning Call Show to Interview Curchin's Doug Stives</option>\n");
document.write("</select></form>\n");
document.write("\n");
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

window.onerror = stopError;

