// PRICE SWAPPING

	function sumitall_essential() {
		
				//------------------------------------------------//
		//STATIONARY/FLYER
		
	    var sfval = document.getElementById('Stationary_Flyer').checked; //IS BOX CHECKED?//
		if (sfval==0)//BOX IS NOT CHECKED//
		{
		document.getElementById('Stationary_Addon').value="No";
		document.priceform.Stationary_Comps.value="0";
		document.getElementById('Stationary_Price_Total').value=0;
		document.getElementById('Stationary_Comps_Total').value=0;
		document.priceform.Stationary_Comps.disabled=true; //disable comps and return to 0
		document.priceform.Stationary_Revisions.value="0";
		document.priceform.Stationary_Revisions.disabled=true; //disable revisions and return to 0
		}
		else //BOX IS CHECKED//
		{
		document.getElementById('Stationary_Addon').value="Yes";
		document.getElementById('Stationary_Price_Total').value=129;
		document.getElementById('Stationary_Comps_Total').value=1;
		document.priceform.Stationary_Comps.disabled=false; //reactivate comps//
		document.priceform.Stationary_Revisions.disabled=false;//reactivate revisions//
		}
		if(sfval == 1)  //IF BOX IS CHECKED
		{document.getElementById('Stationary_Flyer').value=129} //ITS VALUE IS 129
		else (document.getElementById('Stationary_Flyer').value=0); //OTHERWISE ITS 0
		var cpsf = eval(document.getElementById('Stationary_Flyer').value);
		
		var e1 = eval(document.priceform.Logo_Comps.value);
		var e2 = eval(document.priceform.Logo_Revisions.value);
		var e3 = eval(document.priceform.Business_Card_Comps.value);
		var e4 = eval(document.priceform.Business_Card_Revisions.value);
		var e5 = eval(document.priceform.Basic_Website_Comps.value);
		var e6 = eval(document.priceform.Basic_Website_Revisions.value);
		var e7 = eval(document.priceform.Stationary_Comps.value);
		var e8 = eval(document.priceform.Stationary_Revisions.value);
		var e9 = eval(document.priceform.Hosting.value);
		var e10 = eval(document.priceform.Maintenance_Package.value);
		var over15pages = eval(document.priceform.Over_15.value);
		var flashanimation = eval(document.priceform.Flash_Animation.value);
			document.priceform.Full_Price.value=999.00+e1+e2+e3+e4+e5+e6+e7+e8+over15pages+flashanimation+cpsf+".00";
			document.priceform.Annual_Price.value=e9+e10+".00";
			
	}
	function sumitall_3d() {
		var v1 = eval(document.priceform.Logo_Comps.value);
		var v2 = eval(document.priceform.Logo_Revisions.value);
		var v3 = eval(document.priceform.Business_Card_Comps.value);
		var v4 = eval(document.priceform.Business_Card_Revisions.value);
		var v5 = eval(document.priceform.CMS_Comps.value);
		var v6 = eval(document.priceform.CMS_Revisions.value);
		var v7 = eval(document.priceform.Stationary_Comps.value);
		var v8 = eval(document.priceform.Stationary_Revisions.value);
		var v9 = eval(document.priceform.Hosting.value);
		var v10 = eval(document.priceform.Maintenance_Package.value);
		var over15pages = eval(document.priceform.Over_15.value);
		var flashanimation = eval(document.priceform.Flash_Animation.value);
			document.priceform.Full_Price.value=1899.00+v1+v2+v3+v4+v5+v6+v7+v8+over15pages+flashanimation+".00";
			document.priceform.Annual_Price.value=v9+v10+".00";
	}
	
	function sumitall_custom() {
		//LOGOS
	    var logoval = document.getElementById('Logo').checked; //IS LOGO BOX CHECKED?//
		if (logoval==0)//LOGO BOX IS NOT CHECKED//
		{
		document.getElementById('Logo_Addon').value="No";
		document.priceform.Logo_Comps.value="0";
		document.priceform.Logo_Comps.disabled=true; //disable comps and return to 0
		document.priceform.Logo_Revisions.value="0";
		document.priceform.Logo_Revisions.disabled=true; //disable revisions and return to 0
		document.getElementById('Logo_Price_Total').value="0";
		document.getElementById('Logo_Comps_Total').value="0";
		document.getElementById('Logo_Comps_Price').value="0";
		document.getElementById('Logo_Revisions_Total').value="0";
		document.getElementById('Logo_Revisions_Price').value="0";
		}
		else //LOGO BOX IS CHECKED//
		{
		document.getElementById('Logo_Addon').value="Yes";
		document.priceform.Logo_Comps.disabled=false; //reactivate comps//
		document.priceform.Logo_Revisions.disabled=false;//reactivate revisions//
		}
		if(logoval == 1)  //IF LOGO BOX IS CHECKED
		{document.getElementById('Logo').value=149} //ITS VALUE IS 149
		else (document.getElementById('Logo').value=0); //OTHERWISE ITS 0
		var cplogo = eval(document.priceform.Logo.value);
		
		//------------------------------------------------//
		//BUSINESS CARDS
		
	    var buscardval = document.getElementById('Business_Card').checked; //IS BOX CHECKED?//
		if (buscardval==0)//BOX IS NOT CHECKED//
		{
		document.getElementById('Business_Card_Addon').value="No";
		document.priceform.Business_Card_Comps.value="0";
		document.priceform.Business_Card_Comps.disabled=true; //disable comps and return to 0
		document.priceform.Business_Card_Revisions.value="0";
		document.priceform.Business_Card_Revisions.disabled=true; //disable revisions and return to 0
		document.getElementById('Business_Card_Price_Total').value="0";
		document.getElementById('Business_Card_Comps_Total').value="0";
		document.getElementById('Business_Card_Comps_Price').value="0";
		document.getElementById('Business_Card_Revisions_Total').value="0";
		document.getElementById('Business_Card_Revisions_Price').value="0";
		}
		else //BOX IS CHECKED//
		{
		document.getElementById('Business_Card_Addon').value="Yes";
		document.priceform.Business_Card_Comps.value="1";
		document.priceform.Business_Card_Comps.disabled=false; //reactivate comps//
		document.priceform.Business_Card_Revisions.disabled=false;//reactivate revisions//
		}
		if(buscardval == 1)  //IF BOX IS CHECKED
		{document.getElementById('Business_Card').value=99} //ITS VALUE IS 99
		else (document.getElementById('Business_Card').value=0); //OTHERWISE ITS 0
		var cpbc = eval(document.getElementById('Business_Card').value);
		
		
		//------------------------------------------------//
		//STATIONARY/FLYER
		
	    var sfval = document.getElementById('Stationary_Flyer').checked; //IS BOX CHECKED?//
		if (sfval==0)//BOX IS NOT CHECKED//
		{
		document.getElementById('Stationary_Addon').value="No";
		document.priceform.Stationary_Comps.value="0";
		document.priceform.Stationary_Comps.disabled=true; //disable comps and return to 0
		document.priceform.Stationary_Revisions.value="0";
		document.priceform.Stationary_Revisions.disabled=true; //disable revisions and return to 0
		document.getElementById('Stationary_Price_Total').value="0";
		document.getElementById('Stationary_Comps_Total').value="0";
		document.getElementById('Stationary_Comps_Price').value="0";
		document.getElementById('Stationary_Revisions_Total').value="0";
		document.getElementById('Stationary_Revisions_Price').value="0";
		}
		else //BOX IS CHECKED//
		{
		document.getElementById('Stationary_Addon').value="Yes";
		document.priceform.Stationary_Comps.disabled=false; //reactivate comps//
		document.priceform.Stationary_Revisions.disabled=false;//reactivate revisions//
		}
		if(sfval == 1)  //IF BOX IS CHECKED
		{document.getElementById('Stationary_Flyer').value=129} //ITS VALUE IS 129
		else (document.getElementById('Stationary_Flyer').value=0); //OTHERWISE ITS 0
		var cpsf = eval(document.getElementById('Stationary_Flyer').value);
		
		
		//------------------------------------------------//
		//BASIC WEBSITE
		
	    var bwval = document.getElementById('Basic_Website').checked; //IS BOX CHECKED?//
		if (bwval==0)//BOX IS NOT CHECKED//
		{
		document.getElementById('Basic_Website_Addon').value="No";
		document.priceform.Basic_Website_Comps.value="0";
		document.priceform.Basic_Website_Comps.disabled=true; //disable comps and return to 0
		document.priceform.Basic_Website_Revisions.value="0";
		document.priceform.Basic_Website_Revisions.disabled=true; //disable revisions and return to 0
		document.getElementById('Basic_Website_Price_Total').value="0";
		document.getElementById('Basic_Website_Comps_Total').value="0";
		document.getElementById('Basic_Website_Comps_Price').value="0";
		document.getElementById('Basic_Website_Revisions_Total').value="0";
		document.getElementById('Basic_Website_Revisions_Price').value="0";
		}
		else //BOX IS CHECKED//
		{
		document.getElementById('Basic_Website_Addon').value="Yes";
		document.priceform.Basic_Website_Comps.disabled=false; //reactivate comps//
		document.priceform.Basic_Website_Revisions.disabled=false;//reactivate revisions//
		}
		if(bwval == 1)  //IF BOX IS CHECKED
		{document.getElementById('Basic_Website').value=650} //ITS VALUE
		else (document.getElementById('Basic_Website').value=0); //OTHERWISE ITS 0
		var bwsf = eval(document.getElementById('Basic_Website').value);
		
				
		//------------------------------------------------//
		//CMS WEBSITE
		
	    var cmsval = document.getElementById('CMS_Website').checked; //IS BOX CHECKED?//
		if (cmsval==0)//BOX IS NOT CHECKED//
		{
		document.getElementById('CMS_Addon').value="No";
		document.priceform.CMS_Comps.value="0";
		document.priceform.CMS_Comps.disabled=true; //disable comps and return to 0
		document.priceform.CMS_Revisions.value="0";
		document.priceform.CMS_Revisions.disabled=true; //disable revisions and return to 0
		document.getElementById('CMS_Price_Total').value="0";
		document.getElementById('CMS_Comps_Total').value="0";
		document.getElementById('CMS_Comps_Price').value="0";
		document.getElementById('CMS_Revisions_Total').value="0";
		document.getElementById('CMS_Revisions_Price').value="0";
		}
		else //BOX IS CHECKED//
		{
		document.getElementById('CMS_Addon').value="Yes";
		document.priceform.CMS_Comps.disabled=false; //reactivate comps//
		document.priceform.CMS_Revisions.disabled=false;//reactivate revisions//
		}
		if(cmsval == 1)  //IF BOX IS CHECKED
		{document.getElementById('CMS_Website').value=1250} //ITS VALUE
		else (document.getElementById('CMS_Website').value=0); //OTHERWISE ITS 0
		var cmssf = eval(document.getElementById('CMS_Website').value);

		var cp1 = eval(document.priceform.Logo_Comps.value);
		var cp2 = eval(document.priceform.Logo_Revisions.value);
		var cp3 = eval(document.priceform.Business_Card_Comps.value);
		var cp4 = eval(document.priceform.Business_Card_Revisions.value);
		var cp5 = eval(document.priceform.Basic_Website_Comps.value);
		var cp6 = eval(document.priceform.Basic_Website_Revisions.value);
		var cp7 = eval(document.priceform.CMS_Comps.value);
		var cp8 = eval(document.priceform.CMS_Revisions.value);
		var cp9 = eval(document.priceform.Stationary_Comps.value);
		var cp10 = eval(document.priceform.Stationary_Revisions.value);
		var cp11 = eval(document.priceform.Hosting.value);
		var cp12 = eval(document.priceform.Maintenance_Package.value);
		var over15pages = eval(document.priceform.Over_15.value);
		var flashanimation = eval(document.priceform.Flash_Animation.value);
				
			document.priceform.Full_Price.value=cp1+cp2+cp3+cp4+cp5+cp6+cp7+cp8+cp9+cp10+cplogo+cpbc+cpsf+bwsf+cmssf+over15pages+flashanimation+".00";
			document.priceform.Annual_Price.value=cp11+cp12+".00";
	}
	
function save_paper() {
	var paperval = document.getElementById('Deliver_by_Snail_Mail').checked; //IS BOX CHECKED?//
	
	if (paperval==0)//BOX IS NOT CHECKED//
		{
		}
	else //BOX IS CHECKED//
		{
			alert('Please consider the environment before requesting a paper copy by snail mail.  Email is not only as effective - but also FASTER.')
		}
}
	
	function ss_fixAllLinks() {   
 // Get a list of all links in the page   
 var allLinks = document.getElementsByTagName('a');   
 // Walk through the list   
 for (var i=0;i<allLinks.length;i++) {   
   var lnk = allLinks[i];   
   if ((lnk.href && lnk.href.indexOf('#') != -1) &&    
       ( (lnk.pathname == location.pathname) ||   
   ('/'+lnk.pathname == location.pathname) ) &&    
       (lnk.search == location.search)) {   
     // If the link is internal to the page (begins in #)   
     // then attach the smoothScroll function as an onclick   
     // event handler   
     ss_addEvent(lnk,'click',smoothScroll);   
   }   
 }   
}   
  
function smoothScroll(e) {   
 // This is an event handler; get the clicked on element,   
 // in a cross-browser fashion   
 if (window.event) {   
   target = window.event.srcElement;   
 } else if (e) {   
   target = e.target;   
 } else return;   
    
 // Make sure that the target is an element, not a text node   
 // within an element   
 if (target.nodeType == 3) {   
   target = target.parentNode;   
 }   
    
 // Paranoia; check this is an A tag   
 if (target.nodeName.toLowerCase() != 'a') return;   
    
 // Find the <a name> tag corresponding to this href   
 // First strip off the hash (first character)   
 anchor = target.hash.substr(1);   
 // Now loop all A tags until we find one with that name   
 var allLinks = document.getElementsByTagName('a');   
 var destinationLink = null;   
 for (var i=0;i<allLinks.length;i++) {   
   var lnk = allLinks[i];   
   if (lnk.name && (lnk.name == anchor)) {   
     destinationLink = lnk;   
     break;   
   }   
 }   
    
 // If we didn't find a destination, give up and let the browser do   
 // its thing   
 if (!destinationLink) return true;   
    
 // Find the destination's position   
 var destx = destinationLink.offsetLeft;    
 var desty = destinationLink.offsetTop;   
 var thisNode = destinationLink;   
 while (thisNode.offsetParent &&    
       (thisNode.offsetParent != document.body)) {   
   thisNode = thisNode.offsetParent;   
   destx += thisNode.offsetLeft;   
   desty += thisNode.offsetTop;   
 }   
    
 // Stop any current scrolling   
 clearInterval(ss_INTERVAL);   
    
 cypos = ss_getCurrentYPos();   
    
 ss_stepsize = parseInt((desty-cypos)/ss_STEPS);   
 ss_INTERVAL = setInterval('ss_scrollWindow('+ss_stepsize+','+desty+',"'+anchor+'")',10);   
    
 // And stop the actual click happening   
 if (window.event) {   
   window.event.cancelBubble = true;   
   window.event.returnValue = false;   
 }   
 if (e && e.preventDefault && e.stopPropagation) {   
   e.preventDefault();   
   e.stopPropagation();   
 }   
}   
  
function ss_scrollWindow(scramount,dest,anchor) {   
 wascypos = ss_getCurrentYPos();   
 isAbove = (wascypos < dest);   
 window.scrollTo(0,wascypos + scramount);   
 iscypos = ss_getCurrentYPos();   
 isAboveNow = (iscypos < dest);   
 if ((isAbove != isAboveNow) || (wascypos == iscypos)) {   
   // if we've just scrolled past the destination, or   
   // we haven't moved from the last scroll (i.e., we're at the   
   // bottom of the page) then scroll exactly to the link   
   window.scrollTo(0,dest);   
   // cancel the repeating timer   
   clearInterval(ss_INTERVAL);   
   // and jump to the link directly so the URL's right   
   location.hash = anchor;   
 }   
}   
  
function ss_getCurrentYPos() {   
 if (document.body && document.body.scrollTop)   
   return document.body.scrollTop;   
 if (document.documentElement && document.documentElement.scrollTop)   
   return document.documentElement.scrollTop;   
 if (window.pageYOffset)   
   return window.pageYOffset;   
 return 0;   
}   
  
function ss_addEvent(elm, evType, fn, useCapture)   
// addEvent and removeEvent   
// cross-browser event handling for IE5+,  NS6 and Mozilla   
// By Scott Andrew   
{   
 if (elm.addEventListener){   
   elm.addEventListener(evType, fn, useCapture);   
   return true;   
 } else if (elm.attachEvent){   
   var r = elm.attachEvent("on"+evType, fn);   
   return r;   
 }   
}    
  
var ss_INTERVAL;   
var ss_STEPS = 25;   
  
ss_addEvent(window,"load",ss_fixAllLinks);


//POPULATE HIDDEN VALUES

function hiddenVal_whole (x)
{
	var thepriceval = x+"_Price_Total";  							//declare total price field
	var revisions = x+"_Revisions_Price"; 							//declare final cost of revisions
	var comps = x+"_Comps_Price"; 									//declare final cost of comps
	var totalrevprice = document.getElementById(revisions).value;	//declare final price of revisions
	var totalcompprice = document.getElementById(comps).value;		//declare final price of comps
	var totalprices = eval(totalrevprice)+eval(totalcompprice);		//calculate SUB TOTAL of comps and revisions
	document.getElementById(thepriceval).value=totalprices;			//set value of total price field
}

function hiddenVal_parts (x)
{
	var Current = document.getElementById(x).selectedIndex;
	var theVal = x+"_Total";
	var thePrice = x+"_Price";
	var theIndexval = document.getElementById(x).options[Current].text;
	var thePriceval = document.getElementById(x).value;
	document.getElementById(theVal).value=theIndexval;  			//set hidden number of revisions/comps
	document.getElementById(thePrice).value=thePriceval;  			//set hidden price of revisions/comps
}

function updateContactVal(x){
	var updatedVal = document.getElementById(x).value;					//find what the current value is - "updatedVal"
	var hiddenContactVal = x+"_Total";									//declare hidden field to be populated "hiddenContactVal"
	document.getElementById(hiddenContactVal).value=updatedVal;			//set value of hidden field with "udatedVal"
}

function updateOptionVal(x){
	var hiddenOptionVal = x+"_Total_Cost";
	var hiddenOptionOpt = x+"_Addon";
	var Current = document.getElementById(x).selectedIndex;
	var theIndexval = document.getElementById(x).options[Current].text;
	var updatedVal = document.getElementById(x).value;
	document.getElementById(hiddenOptionVal).value=updatedVal;
	document.getElementById(hiddenOptionOpt).value=theIndexval;
}

function updateTotalPrices (){
	var totalQuote = document.getElementById('Full_Price').value;
	var annualQuote = document.getElementById('Annual_Price').value;
	document.getElementById('Full_Price_Total').value=totalQuote;
	document.getElementById('Annual_Price_Total').value=annualQuote;
	
	//get date/time from client browser
	var currentTime = new Date();
	var currentmon = currentTime.getMonth();
	currentmon++;
	var currentday = currentTime.getDate();
	var currentyear = currentTime.getFullYear();
	document.getElementById('date').value=(currentyear+"-"+currentmon+"-"+currentday);
	
	//get timezone from client computer
   var date1 = new Date(currentTime.getFullYear(), 0, 1, 0, 0, 0, 0);
   var temp = date1.toGMTString();
   var date3 = new Date(temp.substring(0, temp.lastIndexOf(" ")-1));
   var hoursDiffStdTime = (date1 - date3) / (1000 * 60 * 60);
   document.getElementById('time_zone').value=hoursDiffStdTime;
   //alert(hoursDiffStdTime);
}

function sumCustomPrices (){
			//logo total price
		var logoRevPrice = document.getElementById('Logo_Revisions_Price').value;
		var logoCompsPrice = document.getElementById('Logo_Comps_Price').value;
		var logoThePrice = document.getElementById('Logo').value;
		var logoTotal = eval(logoRevPrice)+eval(logoCompsPrice)+eval(logoThePrice);//+eval(149);
		document.getElementById('Logo_Price_Total').value = logoTotal;
		
			//business cards total price
		var Business_CardRevPrice = document.getElementById('Business_Card_Revisions_Price').value;
		var Business_CardCompsPrice = document.getElementById('Business_Card_Comps_Price').value;
		var Business_CardThePrice = document.getElementById('Business_Card').value;
		var Business_CardTotal = eval(Business_CardRevPrice)+eval(Business_CardCompsPrice)+eval(Business_CardThePrice);//+eval(99);
		document.getElementById('Business_Card_Price_Total').value = Business_CardTotal;
		
			//stationary/flyer total price
		var StationaryRevPrice = document.getElementById('Stationary_Revisions_Price').value;
		var StationaryCompsPrice = document.getElementById('Stationary_Comps_Price').value;
		var StationaryThePrice = document.getElementById('Stationary_Flyer').value;
		var StationaryTotal = eval(StationaryRevPrice)+eval(StationaryCompsPrice)+eval(StationaryThePrice);//+eval(129);
		document.getElementById('Stationary_Price_Total').value = StationaryTotal;
		
			//basic website total price
		var Basic_WebsiteRevPrice = document.getElementById('Basic_Website_Revisions_Price').value;
		var Basic_WebsiteCompsPrice = document.getElementById('Basic_Website_Comps_Price').value;
		var Basic_WebsiteThePrice = document.getElementById('Basic_Website').value;
		var Basic_WebsiteTotal = eval(Basic_WebsiteRevPrice)+eval(Basic_WebsiteCompsPrice)+eval(Basic_WebsiteThePrice);//+eval(650);
		document.getElementById('Basic_Website_Price_Total').value = Basic_WebsiteTotal;
		
			//cms total price
		var CMSRevPrice = document.getElementById('CMS_Revisions_Price').value;
		var CMSCompsPrice = document.getElementById('CMS_Comps_Price').value;
		var CMSThePrice = document.getElementById('CMS_Website').value;
		var CMSTotal = eval(CMSRevPrice)+eval(CMSCompsPrice)+eval(CMSThePrice);
		document.getElementById('CMS_Price_Total').value = CMSTotal;
}

function showCall ()
{
	document.getElementById('call_info').style.visibility = hidden;
	document.getElementById('call_info').style.height = "0px";
}

//SLIDE SCRIPT
var timerlen = 5;
var slideAniLen = 250;

var timerID = new Array();
var startTime = new Array();
var obj = new Array();
var endHeight = new Array();
var moving = new Array();
var dir = new Array();

function slidedown(objname){
        if(moving[objname])
                return;

        if(document.getElementById(objname).style.display != "none")
                return; // cannot slide down something that is already visible

        moving[objname] = true;
        dir[objname] = "down";
        startslide(objname);
}

function slideup(objname){
        if(moving[objname])
                return;

        if(document.getElementById(objname).style.display == "none")
                return; // cannot slide up something that is already hidden

        moving[objname] = true;
        dir[objname] = "up";
        startslide(objname);
}

function startslide(objname){
        obj[objname] = document.getElementById(objname);

        endHeight[objname] = parseInt(obj[objname].style.height);
        startTime[objname] = (new Date()).getTime();

        if(dir[objname] == "down"){
                obj[objname].style.height = "1px";
        }

        obj[objname].style.display = "block";

        timerID[objname] = setInterval('slidetick(\'' + objname + '\');',timerlen);
}

function slidetick(objname){
        var elapsed = (new Date()).getTime() - startTime[objname];

        if (elapsed > slideAniLen)
                endSlide(objname)
        else {
                var d =Math.round(elapsed / slideAniLen * endHeight[objname]);
                if(dir[objname] == "up")
                        d = endHeight[objname] - d;

                obj[objname].style.height = d + "px";
        }

        return;
}

function endSlide(objname){
        clearInterval(timerID[objname]);

        if(dir[objname] == "up")
                obj[objname].style.display = "none";

        obj[objname].style.height = endHeight[objname] + "px";

        delete(moving[objname]);
        delete(timerID[objname]);
        delete(startTime[objname]);
        delete(endHeight[objname]);
        delete(obj[objname]);
        delete(dir[objname]);

        return;
}

//END SLIDE SCRIPT

function moveScroller() {
  var a = function() {
    var b = $(window).scrollTop();
    var d = $("#scroller-anchor").offset({scroll:false}).top;
    var c=$("#alacarte_box_price");
    if (b>d) {
      c.css({position:"fixed",top:"0px"})
    } else {
      if (b<=d) {
        c.css({position:"relative",top:""})
      }
    }
  };
  $(window).scroll(a);a()
}