



















































































































































































































































































































































































































































































































































































































function startUp(){
    initPage();
    initSlides();
    updateClock();
    correctPNG();
    addressPage();
    setInterval('updateClock()', 1000);
    
}

//Allow for bookmarks...

function addressPage(){
    var getVars = new Array();
    var pages = new Array('history', 'consulting', 'resale', 'animation', 'networking', 'purchasing', 'support', 'contact','VC','data','tf2');
    var noneSet = true;
    var page = (window.location.href.indexOf("#") + 1) ? window.location.href.substr(window.location.href.indexOf("#") + 1) : "";
    page = page.split("#");

    for (var x = 0; x < page.length; x++) {
        var address = page[x].split("/");
        getVars[unescape(address[0])] = unescape(address[address.length-1]);
		whichGet = address[address.length-1];
    }
    for (var i = 0; i < pages.length; i++) {
		if ((getVars[unescape(address[0])]).replace(".html", "").indexOf(pages[i]) != -1) {
			if (/VC/.test(getVars[unescape(address[0])])) {
				changePage("systems/" + getVars[unescape(address[0])], 'mainInnerContent');
				noneSet = false;
			}
			else {
				changePage(getVars[unescape(address[0])], 'mainInnerContent');
				noneSet = false;	
			}		
		}
	}
    if (noneSet) 
        changePage('main.html', 'mainInnerContent');
}


///////////////////////////////////////////////
var isOpen = new Array();
var isMoving = new Array();
var objHeight = new Array();
var objTime = new Array();
var menuTimeOut;
///////////////////////////////////////////////

function openMenu(object, now, height){
    if (!(height)) {
        aniLength = 1050; //old was 750
        height = 250;
    }
    else 
        if (height) {
            aniLength = 350; //old was 450
            minHeight = 35;
        }
    objTime[object] = ((new Date()).getTime()) - now;
    var menu = document.getElementById(object);
    var d = Math.floor(objTime[object] / aniLength * height);
    objHeight[object] = parseInt(menu.style.height);
    
    if (!(objTime[object] < aniLength) && objHeight[object] >= height) {
        isOpen[object] = true;
        isMoving[Object] = false;
        objTime[object] = 0;
        return;
    }
    else 
        if (!(objTime[object] < aniLength) && objHeight[object] <= 1) {
            isOpen[object] = false;
            isMoving[Object] = false;
            objTime[object] = 0;
            return;
        }
        else 
            if (isOpen[object]) {
                d = Math.round(objHeight[object] - (objTime[object] / aniLength) * objHeight[object]);
                menu.style.height = d + 'px';
                isMoving[Object] = true;
                menuTimeOut = setTimeout('openMenu(\'' + object + '\',' + now + ',' + height + ');', 13);
            }
            else 
                if (!(isOpen[object])) {
                    menu.style.height = d + 'px';
                    isOpen[object] = false;
                    isMoving[Object] = true;
                    menuTimeOut = setTimeout('openMenu(\'' + object + '\',' + now + ',' + height + ');', 13);
                }
    /* Old timeout values open: 14, closed: 6 */
}

function isMenuOpen(){
    for (all in isOpen) {
        if (isOpen[all] && !(isMoving[all])) {
            openMenu(all, (new Date()).getTime());
        }
    }
}

/* ------------------------------------------ Main Ajax ------------------------------------------ */
/* ------------------------------------------ Main Ajax ------------------------------------------ */
/* ------------------------------------------ Main Ajax ------------------------------------------ */
function validate(id, type){
    formVal = document.getElementById(id);
    if (document.getElementById(id) != null) {
        fetchData('pages/repairsValidation.php', id + '=' +
        (type == "select" ? formVal.options[formVal.selectedIndex].text : formVal.value), id + '-error');
    }
}

function send(form, id){
    var str = "";
    var valueArr = null;
    for (var i = 0; i < form.elements.length; i++) {
        switch (form.elements[i].type) {
            case "text":
                str += form.elements[i].name + "=" + escape(form.elements[i].value) + "&";
                break;
                
            case "select-one":
                str += form.elements[i].name + "=" + form.elements[i].options[form.elements[i].selectedIndex].value + "&";
                break;
                
            case "textarea":
                str += form.elements[i].name + "=" + escape(form.elements[i].value) + "&";
                break;
                
            case "checkbox":
                str += form.elements[i].name + "=" + escape(form.elements[i].checked) + "&";
                break;
        }
    }
    str += (id == 'eComplete' ? "type=eSend&" : "type=send&");
    str = str.substr(0, (str.length - 1));
    fetchData('pages/repairsValidation.php', str, id);
    
}

function clearCheck(){
    allSpan = document.getElementsByTagName('span');
    generatebuttons;
    for (i = 0; i < allSpan.length; i++) {
        if (allSpan[i].id.indexOf("-error") != -1) {
            allSpan[i].innerHTML = '';
        }
    }
}

function changePage(pageName, objectID,startPage){
    var url = "pages/" + pageName;
    thisObjectID = ((objectID != null) ? objectID : "mainInnerContent")
    window.location.hash = url;
    setTimeout('fetchData(\'' + url + '\',' + null + ',\'' + thisObjectID + '\',' + startPage + ');',275 );
}

//Optional to avoid having onlick info on page

function whichPage(evt){
    var evt = (evt) ? evt : ((window.event) ? event : null);
    var objectClass = (evt.target) ? evt.target.className : ((evt.srcElement) ? evt.srcElement.className : null);
    var objectID = (evt.target) ? evt.target.id : ((evt.srcElement) ? evt.srcElement.id : null);
    var details = ((objectClass.indexOf('details') != -1 || objectClass.indexOf('laptopImages') != -1) ? document.getElementById(objectID) : null);
    if (details) {
        var url = "pages/systems/" + details.id;
        window.location.hash = url;
        fetchData(url, null, 'mainInnerContent');
    }
    details = null;
}

function filterData(pageRequest, objectID, url){
    if (pageRequest.readyState == 4) {
        if ((pageRequest.status == 200 || window.location.href.indexOf("http") == -1) && (objectID != null)) {
            if (document.getElementById(objectID) != null) 
                document.getElementById(objectID).innerHTML = pageRequest.responseText;
				if(/purchasing/.test(url)){
					generatebuttons();
				}
        }
    }
    /* else  document.getElementById('').innerHTML = '<img id="waiting" src="/Images/waiting.gif"'; */
    
}
function pageExists(pageRequest, objectID, url){
	
	var state=false
    if (pageRequest.readyState == 4) {
        if ((pageRequest.status == 200 || window.location.href.indexOf("http") == -1) && (objectID != null)) {
                state = true;
        }
    }
	return state;
}

function fetchData(url, dataRequested, objectID){
    if (dataRequested) 
        var dataRequest = /*"dataRequest="+*/ dataRequested;
    var pageRequest = false
    if (window.XMLHttpRequest) {
        pageRequest = new XMLHttpRequest()
    }
    else 
        if (window.ActiveXObject) {
            try {
                pageRequest = new ActiveXObject("Msxml2.XMLHTTP")
            } 
            catch (e) {
                try {
                    pageRequest = new ActiveXObject("Microsoft.XMLHTTP")
                } 
                catch (e) {
                }
            }
        }
        else 
            return false
    pageRequest.onreadystatechange = function(){
        filterData(pageRequest, objectID, url)
    }
 if (dataRequested) {
        pageRequest.open('POST', url, true);
        pageRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
        pageRequest.send(dataRequest);
    }
    else {
        var cacheFix = parseInt(Math.random() * 1999);
        pageRequest.open('GET', url + "?cacheFix=" + cacheFix, true)
        pageRequest.send(null)
    }
    return (null);
}

/* -------------------------------------- End Main Ajax ------------------------------------------ */
/* -------------------------------------- End Main Ajax ------------------------------------------ */
/* -------------------------------------- End Main Ajax ------------------------------------------ */
var objectSlide;
var objectCover;
var objectpopUpLayer;


function findLivePageWidth(){
    if (window.innerWidth) 
        return window.innerWidth;
    if (document.body.clientWidth) 
        return document.body.clientWidth;
    return (null);
}

function findLivePageHeight(){
    if (window.innerHeight) 
        return window.innerHeight;
    if (document.body.clientHeight) 
        return document.body.clientHeight;
    return (null);
}

function initSlides(){
    objectSlide = document.getElementById('slide').style;
    objectCover = document.getElementById('cover').style;
    objectpopUpLayer = document.getElementById('popUpLayer');
}


function showSlide(site, height, width){
    frameHeight = height - 15;
    frameWidth = width - 0;
    objectpopUpLayer.innerHTML = '<iframe src ="' + site + '" height=' + frameHeight + ' width=' + frameWidth + ' scrolling=none frameborder=0></iframe>';
    livePageWidth = findLivePageWidth();
    livePageHeight = findLivePageHeight();
    newTop = ((livePageHeight / 2) - (height / 2));
    newLeft = ((livePageWidth / 2) - (width / 2));
    objectSlide.top = newTop + 'px';
    objectSlide.left = newLeft + 'px';
    objectSlide.width = width + 'px';
    objectSlide.height = height + 'px';
    objectSlide.display = 'block';
    objectCover.display = 'block';
    myHeight = height;
    myWidth = width;
    /*	objectCover.style.height = livePageHeight + 'px'; */
}

function position(){
    if (objectCover.display == 'block') {
        livePageWidth = findLivePageWidth();
        livePageHeight = findLivePageHeight();
        newTop = ((livePageHeight / 2) - (myHeight / 2));
        newLeft = ((livePageWidth / 2) - (myWidth / 2));
        objectSlide.top = newTop + 'px';
        objectSlide.left = newLeft + 'px';
        objectSlide.display = 'block';
        objectSlide.width = myWidth + 'px';
        objectSlide.height = myHeight + 'px';
    }
}

function hideSlide(){
    objectSlide.display = 'none';
    objectCover.display = 'none';
}

function coverAnimationOpen(initVal, finalVal, millisec){
    var speed = Math.round(millisec / 100);
    var timeOut = 0;
    
    if (initVal < finalVal) {
        for (i = initVal; i <= finalVal; i++) {
            setTimeout("coverAnimation(" + i + ")", (timeOut * speed));
            timeOut++;
        }
    }
    if (initVal > finalVal) {
        for (i = initVal; i >= finalVal; i--) {
            setTimeout("coverAnimation(" + i + ")", (timeOut * speed));
            timeOut++;
        }
    }  
}

function coverAnimationClose(initVal, finalVal, millisec){
    var aniSpeed = 500;
    var timeOut = 0;
    
    if (initVal > finalVal) {
        for (i = initVal; i >= finalVal; i--) {
            setTimeout("coverAnimation(" + i + ")", (timeOut * speed));
            timeOut++;
            if (i == finalVal + 1) {
                objectCover.zIndex = 0;
            }
        }
    }
    setTimeout("openCheck()", 1000);
}

function coverAnimation(opacity){
    objectCover.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

/* -------------------------------------- Drag N' Drop ------------------------------------------ */
/* -------------------------------------- Drag N' Drop ------------------------------------------ */
/* -------------------------------------- Drag N' Drop ------------------------------------------ */

var object = null;
var cX = 0;
var cY = 0;

function initPage(){
    //onmousedown = pickIt;
    //document.onmousemove = dragIt;
    //document.onmouseup = dropIt;
    document.onmouseup = whichPage;
}

function doSomething(evt){
    var objectID;
    if (!evt) 
        var evt = window.event;
    if (evt.target) 
        objectID = evt.target.id;
    else 
        if (evt.srcElement) 
            objectID = evt.srcElement.id;
    if (objectID.indexOf('vLayer') != -1) 
        alert('working');
}

function pickIt(evt){
    var evt = (evt) ? evt : ((window.event) ? event : null);
    var objectID = (evt.target) ? evt.target.id : ((evt.srcElement) ? evt.srcElement.id : null);
    
    if (objectID.indexOf('vLayer') != -1) 
        object = document.getElementById(objectID);
    if (object) {
        object.style.zIndex = 100;
        cX = evt.clientX - object.offsetLeft;
        cY = evt.clientY - object.offsetTop;
        return;
    }
    else {
        object = null;
        return;
    }
}

function dragIt(evt){
	var  evt = (evt) ? evt : ((window.event) ? event : null);
    if (object) {
        object.style.position = 'absolute'
        object.style.left = evt.clientX - cX + 'px';
        object.style.top = evt.clientY - cY + 'px';
        return false;
    }
    
}

function dropIt(){
    if (object) {
        object.style.zIndex = 8;
        object = null;
        return false;
    }
}



/* ------------------------------------ End Drag N' Drop ---------------------------------------- */
/* ------------------------------------ End Drag N' Drop ---------------------------------------- */
/* ------------------------------------ End Drag N' Drop ---------------------------------------- */

/* --------------------------------------- Clock Drop ------------------------------------------- */
/* --------------------------------------- Clock Drop ------------------------------------------- */
/* --------------------------------------- Clock Drop ------------------------------------------- */

function updateClock(){
    correctPNG();
    var currentTime = new Date();
    var currentHours = currentTime.getHours();
    var currentMinutes = currentTime.getMinutes();
    var currentSeconds = currentTime.getSeconds();
    var currentDay = currentTime.getDay();
    var currentMonth = currentTime.getMonth();
    var currentDate = currentTime.getDate();
    var currentYear = currentTime.getFullYear();
    var myDays = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
    var myMonths = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
    
    // Pad the minutes and seconds with leading zeros, if required
    currentMinutes = (currentMinutes < 10 ? "0" : "") + currentMinutes;
    currentSeconds = (currentSeconds < 10 ? "0" : "") + currentSeconds;
    
    // Choose either "AM" or "PM" as appropriate
    var timeOfDay = (currentHours < 12) ? "AM" : "PM";
    
    // Convert the hours component to 12-hour format if needed
    currentHours = (currentHours > 12) ? currentHours - 12 : currentHours;
    
    // Convert an hours component of "0" to "12"
    currentHours = (currentHours == 0) ? 12 : currentHours;
    
    // Compose the string for display
    var currentTimeString = myDays[currentDay] + " " + myMonths[currentMonth] + " " + currentDate + ", " + currentYear + " " + currentHours + ":" + currentMinutes + /*":" + currentSeconds +*/ " " + timeOfDay;
    
    // Update the time display
    document.getElementById("clock").firstChild.nodeValue = currentTimeString;
}

/* -------------------------------------- Start Animation ------------------------------------------ */
/* -------------------------------------- Start Animation ------------------------------------------ */
/* -------------------------------------- Start Animation ------------------------------------------ */

function hideAnimation(){
    var now = (new Date()).getTime();
    var elapsed = ((new Date()).getTime()) - now;
    
    while (elapsed <= 550) {
        elapsed = ((new Date()).getTime()) - now;
        if ((elapsed >= 545) && (elapsed < 546)) {
            document.getElementById('aniStart').style.display = 'none';
            elapsed = 605;
        }
        
    }
    
}
/* -------------------------------------- End Animation ------------------------------------------ */
/* -------------------------------------- End Animation ------------------------------------------ */
/* -------------------------------------- End Animation ------------------------------------------ */
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
    var arVersion = navigator.appVersion.split("MSIE")
    var version = parseFloat(arVersion[1])
    if ((version >= 5.5) && (document.body.filters)) {
        for (var i = 0; i < document.images.length; i++) {
            var img = document.images[i]
            var imgName = img.src.toUpperCase()
            if (imgName.substring(imgName.length - 3, imgName.length) == "PNG") {
                var imgID = (img.id) ? "id='" + img.id + "' " : ""
                var imgClass = (img.className) ? "class='" + img.className + "' " : ""
                var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
                var imgStyle = "display:inline-block;" + img.style.cssText
                if (img.align == "left") 
                    imgStyle = "float:left;" + imgStyle
                if (img.align == "right") 
                    imgStyle = "float:right;" + imgStyle
                if (img.parentElement.href) 
                    imgStyle = "cursor:hand;" + imgStyle
                var strNewHTML = "<span " + imgID + imgClass + imgTitle +
                " style=\"" +
                "width:" +
                img.width +
                "px; height:" +
                img.height +
                "px;" +
                imgStyle +
                ";" +
                "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" +
                "(src=\'" +
                img.src +
                "\', sizingMethod='scale');\"></span>"
                img.outerHTML = strNewHTML
                i = i - 1
            }
        }
    }
}

function generatebuttons(){
    var allImages = document.getElementsByTagName('div');
	if (/buyNow/.test(allImages[15].className)) {
		var info = allImages[15].childNodes[0].name.split("|");
		var item = allImages[15].childNodes[0].id
		var itemName = info[0];
		var itemPrice = info[1];
	}
    for (i in allImages) {
        if (/buyNow/.test(allImages[i].className)) {
            var info = allImages[i].childNodes[0].name.split("|");
            var item = allImages[i].childNodes[0].id
            var itemName = info[0];
            var itemPrice = info[1];
            
            allImages[i].innerHTML = '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">\n ' +
            ' <input type="hidden" name="cmd" value="_xclick">\n ' +
            ' <input type="hidden" name="business" value="info@vortex-computing.net">\n ' +
            ' <input type="hidden" name="undefined_quantity" value="1">\n' +
            ' <input type="hidden" name="item_name" value="' +
            itemName +
            '">\n' +
            ' <input type="hidden" name="item_number" value="' +
            item +
            '">\n' +
            ' <input type="hidden" name="amount" value="' +
            itemPrice +
            '">\n' +
            ' <input type="hidden" name="page_style" value="Primary">\n' +
            ' <input type="hidden" name="no_shipping" value="0">\n' +
            ' <input type="hidden" name="return" value="http://www.vortexcomputing.net/Main.html#pages/purchasing.html">\n' +
            ' <input type="hidden" name="cancel_return" value="http://www.vortexcomputing.net/Main.html#pages/purchasing.html">\n' +
            ' <input type="hidden" name="currency_code" value="USD">\n' +
            ' <input type="hidden" name="lc" value="US">\n' +
            ' <input type="hidden" name="bn" value="PP-BuyNowBF">\n' +
            ' <input type="image" src="Images/buyNow.jpg" height=32 width=112 name="submit" title="You do not need a paypal account, click on the continue button in the center of the page to purchase without an account" alt="Make payments with PayPal - it\'s fast, free and secure!" >\n' +
            ' </form> ';
        }
    }
}

function search(e){
	var key = e.keyCode? e.keyCode : e.charCode;
	if (key == 13) {
		value = document.getElementById('searchVal').value;
		fetchData("../../cgi-sys/entropysearch.cgi?query=" + value + "&user=vortexco&basehref=http%3A%2F%2Fvortexcomputing.net&template=default", null, "mainInnerContent");
	}
}
/* -------------------------------------- Start Esureit ------------------------------------------ */
/* -------------------------------------- Start Esureit ------------------------------------------ */
/* -------------------------------------- Start Esureit ------------------------------------------ */
function ValidateData() {

	var valid = true;
	var form = document.esureit;

	var regex=/^[a-zA-Z0-9_]{3,16}$/;
	var username = form.username.value;
	if (username.match(regex)) {
		form.username.style.borderColor = "#000000";
	} else {
		form.username.style.borderColor = "#FF0000";
		valid = false;
	}

	regex=/^[a-zA-Z0-9_!@]{6,16}$/;
	var pw = form.password1.value;
	if (pw.match(regex)) {
		if (form.password1.value = form.password2.value) {
			form.password1.style.borderColor = "#000000";
			form.password2.style.borderColor = "#000000";
		} else {
			form.password1.style.borderColor = "#FF0000";
			form.password2.style.borderColor = "#FF0000";
			valid = false;
		}
	} else {
		form.password1.style.borderColor = "#FF0000";
		form.password2.style.borderColor = "#FF0000";
		valid = false;
	}

	var email = form.contact_email.value;
	regex=/^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9})$/;
	if (email.match(regex)) {
		form.contact_email.style.borderColor = "#000000";
	} else {
		form.contact_email.style.borderColor = "#FF0000";
		valid = false;
	}

	var emailv = form.contact_email_v.value;
	if (emailv == email) {
		form.contact_email_v.style.borderColor = "#000000";
	} else {
		form.contact_email_v.style.borderColor = "#FF0000";
		valid = false;
	}
	
	var name = form.contact_name.value;
	regex=/^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
	if (name.match(regex)) {
		form.contact_name.style.borderColor = "#000000";
	} else {
		form.contact_name.style.borderColor = "#FF0000";
		valid = false;
	}

	if (form.contact_address.value.length > 3) {
		form.contact_address.style.borderColor = "#000000";
	} else {
		form.contact_address.style.borderColor = "#FF0000";
		valid = false;
	}

	if (form.contact_city.value.length > 2) {
		form.contact_city.style.borderColor = "#000000";
	} else {
		form.contact_city.style.borderColor = "#FF0000";
		valid = false;
	}

	if (form.contact_state.value.length > 1) {
		form.contact_state.style.borderColor = "#000000";
	} else {
		form.contact_state.style.borderColor = "#FF0000";
		valid = false;
	}

	if (form.contact_zip.value.length > 4 && form.contact_zip.value.length < 11) {
		form.contact_zip.style.borderColor = "#000000";
	} else {
		form.contact_zip.style.borderColor = "#FF0000";
		valid = false;
	}

	if (form.contact_country.value.length > 1) {
		form.contact_country.style.borderColor = "#000000";
	} else {
		form.contact_country.style.borderColor = "#FF0000";
		valid = false;
	}

	if (form.contact_phone.value.length > 9) {
		form.contact_phone.style.borderColor = "#000000";
	} else {
		form.contact_phone.style.borderColor = "#FF0000";
		valid = false;
	}

	if (form.plan_id.value == 33 || form.plan_id.value == 38) {
		form.contact_company.style.borderColor = "#000000";
	} else {
		if (form.contact_company.value.length > 3) {
			form.contact_company.style.borderColor = "#000000";
		} else {
			form.contact_company.style.borderColor = "#FF0000";
			valid = false;
		}
	}

	if (!(form.billing_same.checked)) {
		email = form.billing_email.value;
		regex=/^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9})$/;
		if (email.match(regex)) {
			form.billing_email.style.borderColor = "#000000";
		} else {
			form.billing_email.style.borderColor = "#FF0000";
			valid = false;
		}

		name = form.billing_name.value;
		regex=/^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
		if (name.match(regex)) {
			form.billing_name.style.borderColor = "#000000";
		} else {
			form.billing_name.style.borderColor = "#FF0000";
			valid = false;
		}

		if (form.billing_address.value.length > 3) {
			form.billing_address.style.borderColor = "#000000";
		} else {
			form.billing_address.style.borderColor = "#FF0000";
			valid = false;
		}

		if (form.billing_city.value.length > 2) {
			form.billing_city.style.borderColor = "#000000";
		} else {
			form.billing_city.style.borderColor = "#FF0000";
			valid = false;
		}

		if (form.billing_state.value.length > 1) {
			form.billing_state.style.borderColor = "#000000";
		} else {
			form.billing_state.style.borderColor = "#FF0000";
			valid = false;
		}

		if (form.billing_zip.value.length > 4 && form.billing_zip.value.length < 11) {
			form.billing_zip.style.borderColor = "#000000";
		} else {
			form.billing_zip.style.borderColor = "#FF0000";
			valid = false;
		}

		if (form.billing_country.value.length > 1) {
			form.billing_country.style.borderColor = "#000000";
		} else {
			form.billing_country.style.borderColor = "#FF0000";
			valid = false;
		}

		if (form.billing_phone.value.length > 9) {
			form.billing_phone.style.borderColor = "#000000";
		} else {
			form.billing_phone.style.borderColor = "#FF0000";
			valid = false;
		}

		if (form.plan_id.value == 33 || form.plan_id.value == 38) {
			form.billing_company.style.borderColor = "#000000";
		} else {
			if (form.billing_company.value.length > 3) {
				form.billing_company.style.borderColor = "#000000";
			} else {
				form.billing_company.style.borderColor = "#FF0000";
				valid = false;
			}
		}
	} else {
		form.billing_email.style.borderColor = "#000000";
		form.billing_name.style.borderColor = "#000000";
		form.billing_address.style.borderColor = "#000000";
		form.billing_city.style.borderColor = "#000000";
		form.billing_state.style.borderColor = "#000000";
		form.billing_zip.style.borderColor = "#000000";
		form.billing_country.style.borderColor = "#000000";
		form.billing_phone.style.borderColor = "#000000";
		form.billing_company.style.borderColor = "#000000";
	}

	if (form.payment_method[0].checked) {
		switch(form.cc_type.value)
		{
		case "MasterCard":
			regex=/^5[1-5][0-9]{14}$/; break;
		case "Visa":
			regex=/^4[0-9]{12}([0-9]{3})?$/; break;
		case "Amex":
			regex=/^3[47][0-9]{13}$/; break;
		case "Discover/Novus":
			regex=/^6011[0-9]{12}$/; break;
		}

		var cc_num = form.cc_number.value;
		var regdash = /-/g;
		var cc_clean = cc_num.replace(regdash, '');
		form.cc_number.value = cc_clean;
		if (cc_clean.match(regex)) {
			form.cc_number.style.borderColor = "#000000";
		} else {
			form.cc_number.style.borderColor = "#FF0000";
			valid = false;
		}
	} else {
		form.cc_number.style.borderColor = "#000000";
	}

	return valid;
}

