function CreateControl(DivID, inWidth, inHeight, inURL, inWmode, inQuality, inScale, inBorder, inBGColor)
{
    if (inWmode == "") {
        inWmode = "transparent";
    }
    if (inQuality == "") {
        inQuality = "high";
    }
    if (inScale == "") {
        inScale = "showall";
    }
    if (inBorder == "") {
        inBorder = "0";
    }
    if (inBGColor == "") {
        inBGColor = "FFFFFF";
    }
    flashCode = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" height=" + inHeight + " width=" + inWidth + " border=" + inBorder + ">";
    flashCode = flashCode + "<param NAME=\"movie\" VALUE=" + inURL + ">";
    flashCode = flashCode + "<param name=\"wmode\" value=\"" + inWmode +"\">";
    flashCode = flashCode + "<param NAME=\"quality\" VALUE=\"" + inQuality +"\">";		 
    flashCode = flashCode + "<param NAME=\"SCALE\" VALUE=\"" + inScale + "\">";
    flashCode = flashCode + "<param NAME=\"bgcolor\" VALUE=\"" + inBGColor + "\">";
    flashCode = flashCode + "<embed src=" + inURL +" wmode=\"" + inWmode + "\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"" + inWidth + "\" height=\"" + inHeight + "\" bgcolor=#\"" + inBGColor +"\"></embed>";
    flashCode = flashCode + "</object>";
    //flashCode = flashCode + "<BR>" + DivID + "<BR>" + inWidth + "<BR>" + inHeight + "<BR>" + inURL + "<BR>" + inWmode + "<BR>" + inQuality + "<BR>" + inScale + "<BR>" + inBorder + "<BR>" + inBGColor;
    
    if (document.all||document.getElementById){
      if (document.getElementById) {document.getElementById(DivID).innerHTML = flashCode}
         else {DivID.innerHTML = flashCode}
    }
}
function CreateControlWav(DivID, inURL, inAutostart, inLoop, inVisibility)
{
    if (inAutostart == "") {
        inAutostart = "TRUE";
    }
    if (inLoop == "") {
        inLoop = "FALSE";
    }
    if (inVisibility == "") {
        inVisibility = "False";
    }
    
    flashCode = "<embed src=\"" + inURL + "\" AUTOSTART=\"" + inAutostart + "\" LOOP=\"" + inLoop + "\" HIDDEN=\"" + inVisibility + "\"></embed>";
    
    if (document.all||document.getElementById){
      if (document.getElementById) {document.getElementById(DivID).innerHTML = flashCode}
         else {DivID.innerHTML = flashCode}
    }
}

function CreateControlMOV(DivID, inURL, inAutostart, inLoop, inScale, inController, inWidth, inHeight)
{
    if (inAutostart == "") {
        inAutostart = "TRUE";
    }
    if (inLoop == "") {
        inLoop = "FALSE";
    }
    if (inController == "") {
        inController = "TRUE";
    }
    if (inScale == "") {
        inScale = "tofit";
    }

    flashCode = "<embed src=\"" + inURL + "\" pluginspage=\"http://www.apple.com/quicktime/\" controller=\"" + inController + "\" loop=\"" + inLoop + "\" height=\"" + inHeight + "\" width=\"" + inWidth + "\" autoplay=\"" + inAutostart + "\" scale=\"" + inScale + "\"> </EMBED>";
    
    if (document.all||document.getElementById){
      if (document.getElementById) {document.getElementById(DivID).innerHTML = flashCode}
         else {DivID.innerHTML = flashCode}
    }
}

function CreateControlWMV(
    //DivID, inURL, inAutostart, inController, inWidth, inHeight, inAlign, inHspace, inVolume
    DivID,
    inURL,
    inShowControls, 
    inSendPlayStateChangeEvents, 
    inShowAudioControls, 
    inShowPositionControls,
    inShowTracker,
    inShowStatusBar,
    inAnimationatStart,
    inAutoSize,
    inAutoStart,
    inWidth,
    inHeight,
    inVolume,
    inshowcontrolsW,
    inShowAudioControlsW,
    inShowPositioncontrolsW,
    inShowTrackerW,
    inAutoStartW,
    inShowStatusBarW,
    inAnimationatStartW
    )
{
    /*if (inAutoStart == "") {
        inAutoStart = "1";
    }
    if (inShowControls == "") {
        inShowControls = "1";
    }*/
    

    flashCode = "<object \n";
    flashCode = flashCode + "name=\"Player\" \n";
    flashCode = flashCode + "classid=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\" \n";
    //flashCode = flashCode + "classid=\"CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95\" \n";
    //flashCode = flashCode + "codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701\" \n";
    flashCode = flashCode + "type=\"application/x-oleobject\" \n";
    flashCode = flashCode + "align=\"center\" \n";
    flashCode = flashCode + "width=\"" + inWidth + "\" \n";
    flashCode = flashCode + "height=\"" + inHeight + "\"> \n";
    flashCode = flashCode + "<param name=\"URL\" value=\"" + inURL + "\"></param> \n";
    flashCode = flashCode + "<param name=\"ShowControls\" value=\"" + inShowControls + "\"></param> \n";
    flashCode = flashCode + "<param name=\"ShowAudioControls\" value=\"" + inShowAudioControls + "\"></param> \n";
    flashCode = flashCode + "<param name=\"ShowPositionControls\" value=\"" + inShowPositionControls + "\"></param> \n";
    flashCode = flashCode + "<param name=\"ShowTracker\" value=\"" + inShowTracker + "\"></param> \n";
    flashCode = flashCode + "<param name=\"ShowStatusBar\" value=\"" + inShowStatusBar + "\"></param> \n";
    flashCode = flashCode + "<param name=\"AnimationatStart\" value=\"" + inAnimationatStart + "\"></param> \n";
    flashCode = flashCode + "<param name=\"AutoStart\" value=\"" + inAutoStart + "\"></param> \n";
    flashCode = flashCode + "<param name=\"volume\" value=\"" + inVolume + "\"></param> \n";
    flashCode = flashCode + "<param name=\"SendPlayStateChangeEvents\" value=\"" + inSendPlayStateChangeEvents + "\"></param> \n";
    flashCode = flashCode + "<embed type=\"application/x-oleobject\" \n";
    flashCode = flashCode + "pluginspage=\"http://www.microsoft.com/windowsmedia/\" \n";
    flashCode = flashCode + "SRC=\"" + inURL + "\" \n";
    flashCode = flashCode + "showcontrols=\"" + inshowcontrolsW + "\"  \n";
    flashCode = flashCode + "SendPlayStateChangeEvents=\"" + inSendPlayStateChangeEvents + "\" \n";
    flashCode = flashCode + "showaudiocontrols=\"" + inShowAudioControlsW + "\"  \n";
    flashCode = flashCode + "showpositioncontrols=\"" + inShowPositioncontrolsW + "\"  \n";
    flashCode = flashCode + "showtracker=\"" + inShowTrackerW + "\" \n";
    flashCode = flashCode + "showstatusbar=\"" + inShowStatusBarW + "\"  \n";
    flashCode = flashCode + "animationatstart=\"" + inAnimationatStartW + "\"  \n";
    flashCode = flashCode + "autosize=\"" + inAutoSize + "\"  \n";
    flashCode = flashCode + "AUTOSTART=\"" + inAutoStartW + "\" \n";
    flashCode = flashCode + "width=\"" + inWidth + "\" \n";
    flashCode = flashCode + "height=\"" + inHeight + "\" \n";
    flashCode = flashCode + "name=\"MediaPlayer\" \n";
    flashCode = flashCode + "volume=\"" + inVolume + "\"> \n";
    flashCode = flashCode + "</embed> \n";
    flashCode = flashCode + "</object> \n";

    //flashCode = "<object NAME=\"Player\" showpositioncontrols=0 WIDTH=\"" + inWidth + "\" HEIGHT=\"" + inHeight + "\"  align=\"absmiddle\" type=\"application/x-oleobject\" volume=\"" + inVolume + "\" CLASSID=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\">"
    //flashCode = flashCode + "<param NAME=\"URL\" VALUE=\"" + inURL + "\"><param><param name=\"showpositioncontrols\" value=0></param><param NAME=\"AUTOSTART\" VALUE=\"1\"><param NAME=\"VOLUME\" VALUE=\"" + inVolume + "\"></param><param name=\"showControls\" value=\"1\"></param><embed WIDTH=\"" + inWidth + "\" HEIGHT=\"" + inHeight + "\"  align=\"absmiddle\" SRC=\"" + inURL + "\" TYPE=\"application/x-oleobject\" AUTOSTART=\"1\"></embed></object>";

    if (document.all||document.getElementById){
      if (document.getElementById) {document.getElementById(DivID).innerHTML = flashCode}
         else {DivID.innerHTML = flashCode}
    }
    //document.tForm.tArea.value = flashCode;
}

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];}
}

var ptcHost = (("www.paetec.com" == document.location.hostname) ? true : false);

if (ptcHost) {
	var gaJsHost = (("https:" == document.location.protocol) ? 
	"https://ssl." : "http://www."); 
	document.write(unescape("%3Cscript src='" + gaJsHost + 
	"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
	var pageTracker = _gat._getTracker("UA-1044297-1"); 
	pageTracker._initData(); 
	pageTracker._trackPageview();
}

 /*-----------------------------------------------------------
    Toggles element's display value
    Input: any number of element id's
    Output: none 
    ---------------------------------------------------------*/
function toggleDisp() {
    for (var i=0;i<arguments.length;i++){
        var d = $(arguments[i]);
        if (d.style.display == 'none')
            d.style.display = 'block';
        else
            d.style.display = 'none';
    }
}
/*-----------------------------------------------------------
    Toggles tabs - Closes any open tabs, and then opens current tab
    Input:     1.The number of the current tab
                    2.The number of tabs
                    3.(optional)The number of the tab to leave open
                    4.(optional)Pass in true or false whether or not to animate the open/close of the tabs
    Output: none 
    ---------------------------------------------------------*/
function toggleTab(num,numelems,opennum,animate) {
    if ($('tabContent'+num).style.display == 'none'){
        for (var i=1;i<=numelems;i++){
            if ((opennum == null) || (opennum != i)){
                var temph = 'tabHeader'+i;
                var h = $(temph);
                if (!h){
                    var h = $('tabHeaderActive');
                    h.id = temph;
                }
                var tempc = 'tabContent'+i;
                var c = $(tempc);
                if(c.style.display != 'none'){
                    if (animate || typeof animate == 'undefined')
                        Effect.toggle(tempc,'blind',{duration:0.5, queue:{scope:'menus', limit: 3}});
                    else
                        toggleDisp(tempc);
                }
            }
        }
        var h = $('tabHeader'+num);
        if (h)
            h.id = 'tabHeaderActive';
        h.blur();
        var c = $('tabContent'+num);
        c.style.marginTop = '0px';
        if (animate || typeof animate == 'undefined'){
            Effect.toggle('tabContent'+num,'blind',{duration:0.5, queue:{scope:'menus', position:'end', limit: 3}});
        }else{
            toggleDisp('tabContent'+num);
        }
    }
}
                    
function searchFormSubmit() {
    document.SearchForm.submit();;
}
/******************
*  Added check for contact us form
******************/
function checkForm(){
		var theForm = document.inforequest;
    var z = 0;
    var fSkip = 0;
    var lastItem = 31;
    var zipRegEx = /^((\d{5}-\d{4})|(\d{5})|([A-Z]\d[A-Z]\s\d[A-Z]\d))$/;
    
    for  (z=0; z<lastItem; z++) {
      if (eval("theForm[" + z + "].name.search('First_Name')") != -1 || eval("theForm[" + z + "].name.search('Last_Name')") != -1 || eval("theForm[" + z + "].name.search('Company_Name')") != -1 || eval("theForm[" + z + "].name.search('Phone')") != -1 || eval("theForm[" + z + "].name.search('Address_1')") != -1 || eval("theForm[" + z + "].name.search('City')") != -1 || eval("theForm[" + z + "].name.search('State')") != -1 || eval("theForm[" + z + "].name.search('Zip')") != -1 || eval("theForm[" + z + "].name.search('heardAboutPaetec')") != -1) {
    	  if (theForm[z].name=="Phone") {
      	  	if (theForm[z].value != "") {
	  			   phoneName = "document.inforequest." +  eval("theForm[" + z + "].name");
	  			   var checkPhone = checkUSPhone(phoneName);
	  			   if (checkPhone != true) {
	  				   theForm[z].focus();
	  				   theForm[z].select();
	  				   fSkip = fSkip + 1;
	  				   break;
	  			   }
      	  		}
  		   }
  		   if (theForm[z].name=="Zip") {
  		   var testString = theForm[z].value;
  		   testString = testString.match(zipRegEx); 
  		   		if (testString == null) {
  		   			alert("This field must be a U.S. Zip Code or Canadian Post Code (like 12345). Please reenter it now.");
  					theForm[z].focus();
	  				theForm[z].select();
  	  				fSkip = fSkip + 1;
  	  				 break;		   
	  		   	}		   
  		   }
    	  if (theForm[z].name=="heardAboutPaetec") {
    		  	if (theForm[z].selectedIndex == 0) {
        	  		alert("You must select an option.");
	  				   theForm[z].focus();
	  				   theForm[z].select();
  	  				   fSkip = fSkip + 1;
  	  				   break;
  	  			   }
    		   } 
    	  
    	  if (eval("theForm[" + z +"].value") == ""){ 
          		var alertField = eval("theForm[" + z +"].name");
          		alertField = alertField.replace("_"," ");
           		alert("Your " + alertField + " is required.");
           		theForm[z].focus();
                theForm[z].select();
                fSkip = fSkip + 1;
                break;
           }
       }
    }
    if (fSkip == 0){
    	theForm.submit();
   }        
}