// JavaScript Document

var path = "http://www.netrep.co.za/scripts/ajaxfunction.php";
var content_loader = "<div id='loading'><img src='http://www.netrep.co.za/images/loading.gif' /></div>";

//build ajaxRequest variable
function get_ajaxRequest()	{
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
		
		return ajaxRequest;
		
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
}

//display Content
function displayContent(nav_id)	{
	var ajaxRequest = get_ajaxRequest();  // The variable that makes Ajax possible!
		
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState < 4){
			document.getElementById('content').innerHTML = content_loader;
		}
		if(ajaxRequest.readyState == 4){
			document.getElementById('content').innerHTML = ajaxRequest.responseText;
		}
		//handle sliders
		$(document).ready(function() {
			$("#wallpaper-slider").easySlider({
				prevText : '<div class=\'forback\'><img src=\'images/prev.jpg\' alt=\'\' /></div>',
				nextText : '<div class=\'forback\'><img src=\'images/next.jpg\' alt=\'\' /></div>',
				orientation:'horizontal'
			});
			
			$("#showcase-slider").easySlider({
				prevText : '<div class=\'forback\'><img src=\'images/prev.jpg\' alt=\'\' /></div>',
				nextText : '<div class=\'forback\'><img src=\'images/next.jpg\' alt=\'\' /></div>',
				orientation:'horizontal'
			});
			
			$("#social-resp-slider").easySlider({
				prevText : '<div class=\'forback\'><img src=\'images/prev.jpg\' alt=\'\' /></div>',
				nextText : '<div class=\'forback\'><img src=\'images/next.jpg\' alt=\'\' /></div>',
				orientation:'horizontal'
			});
		});
		$(function() {
			// Select all links whose attribute rel starts with lightbox
			$('a[rel^=lightbox]').lightBox();
		});
	}
	
	var queryString = "http://www.netrep.co.za/content/" + nav_id + ".txt";
	ajaxRequest.open("GET", queryString);
	ajaxRequest.send(null); 
}

//show selected nav element
function show_nav(active_element)	{
	
	var aElem = document.getElementsByTagName('li');
	for(var i=0; i<aElem.length; i++) {
		aElem[i].className = '';
	}
	document.getElementById(active_element).className = "active";
	
	$(document).ready(function() {
		$("#grey-bottom").height($(document).height() - ($('#containment').height() + $('#footer-containment').height()) );
	});
}

//show selected nav element
function showcase_nav(active_element)	{
	
	document.getElementById("showcase_websites").className = "";
	document.getElementById("showcase_logos").className = "";
	document.getElementById("showcase_signatures").className = "";

	document.getElementById(active_element).className = "active";
}

function displayShowcase(nav_id)	{
	var ajaxRequest = get_ajaxRequest();  // The variable that makes Ajax possible!
		
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState < 4){
			document.getElementById('showcase-content').innerHTML = content_loader;
		}
		if(ajaxRequest.readyState == 4){
			document.getElementById('showcase-content').innerHTML = ajaxRequest.responseText;
		}
		//handle sliders
		$(document).ready(function() {
			$("#showcase-slider").easySlider({
				prevText : '<div class=\'forback\'><img src=\'images/prev.jpg\' alt=\'\' /></div>',
				nextText : '<div class=\'forback\'><img src=\'images/next.jpg\' alt=\'\' /></div>',
				orientation:'horizontal'
			});
		});
		$(function() {
			// Select all links whose attribute rel starts with lightbox
			$('a[rel^=lightbox]').lightBox();
		});
	}
	
	var queryString = "http://www.netrep.co.za/content/" + nav_id + ".txt";
	ajaxRequest.open("GET", queryString);
	ajaxRequest.send(null); 
}

//show selected nav element
function show_QAContent(qa_id)	{

	var question = "";
	var answer = "";
	switch(qa_id)	{
		case 1: 
			question += "<span>Question 1. How long will it take for my web site to be designed?</span>";
			answer += "<p>Answer: The timeline of a website design project is often dictated by the client. If you have a deadline in mind we will endeavor to meet it for you. The most common delay in the creation and completion of a new website is waiting for content (text/images) to be sent to us by the client.</p>";
			break;
		case 2: 
			question += "<span>Question 2. How much will it cost to create my website?</span>";
			answer += "<p>Answer: There are three costs associated with building and maintaining a website:<br/><br/>";
			answer += "1) The domain name registration and yearly fee<br/>";
			answer += "2) Web hosting (a monthly fee)<br/>";
			answer += "3) Design of your website (Once off or Monthly)</p>";
			break;
		case 3: 
			question += "<span>Question 3. In what format should I supply words and photographs about my business for my new website?</span>";
			answer += "<p>Answer: It is helpful to us if you are able to provide text and photographs in an electronic form - for example, the files output by a digital camera and the words in MS word or similar format. If this is not possible, we can help get your information ready for use on the website but this will result in an additional charge.</p>";
			break;
		case 4: 
			question += "<span>Question 4. Do I have to keep my website with you forever, or can I move it to another supplier to host it if I wish?</span>";
			answer += "<p>Answer: You may move your website to another web hosting service at any time. On request once your website design has been completed and paid in full, we will send you a copy of the website. This copy of your website is for your retention</p>";
			break;
		case 5: 
			question += "<span>Question 5. Will my website design be \"Search Engine\" friendly?</span>";
			answer += "<p>Answer: All our websites are created with search engines in mind and the website design is compliant with search engine guidelines. It is a good idea for your website to be re-evaluated in time as over a period of time the search engines do alter their rules and algorithms and you will want to be certain that your website is kept up to date and complies with new rules etc.</p>";
			break;
		case 6: 
			question += "<span>Question 6. How do I update my website?</span>";
			answer += "<p>Answer: There are many different methods which can be used to update websites. The method you choose and the functionality we build into your website design is solely up to you , we will be glad to advise you which method will suit your needs.</p>";
			answer += "<p>If you have a small website consisting of just a few pages and will only wish to make changes very infrequently, then we will make these changes for you. Other methods which are frequently chosen are largely dependant upon how much data or information and pictures you have and how you store this information at present.</p>";
			answer += "<p>We can provide an on line content management system where you can either update individual products/pages/services or particular sections of your website. e.g. latest news.</p>";
			answer += "<p>Alternatively we can provide functionality such that you can upload your entire product ranges to the website in one action using spreadsheets etc. or  complete database driven content management.</p>";
			break;
		case 7: 
			question += "<span>Question 7. How do I advertise my site?</span>";
			answer += "<p>Answer: There are many ways to advertise your site, but the most effective way is \"word of mouth.\"  It\'s free and if people can recommend your site that makes it even more credible.</p>";
			answer += "<p>The more useful and unique you can make your site, the more others will want to bookmark and tell others about it.  The biggest mistake people make when building their sites is lack of content.</p>";
			answer += "<p>If your site is for information purposes and you want to reel in the traffic, then you need to start out with at least 30 pages of content and plan to keep building.  Giving people a reason to return.</p>";
			break;
		case 8: 
			question += "<span>Question 8. How do I get my site listed with the major search engines</span>";
			answer += "<p>Answer: These days, the keys to getting your site listed and ranked high with the popular engines like Google, Yahoo and Bing is all about links.  You want to get other sites that are related to your theme to link back to you using the keywords you are targeting.</p>";
			answer += "<p>For example, if your site is about bowling balls, you will want to get links from other bowling related sites. That\'s why putting out quality content and networking is so very important. </p>";
			answer += "<p>This helps provide a \"vote\" for your site and the search engines start to see that your site must be worthy of a good rank if other people are linking to it using certain relevant content.</p>";
			break;
		case 9: 
			question += "<span>Question 9. What is a web application or web based application?</span>";
			answer += "<p>Answer: Web application is a program that runs on the web. Typically interactive, the application accepts input from the web user, processes the input, and displays the results. Web applications usually have a multi-tier architecture and use technologies such as PHP, ASP, XML, JAVA, JAVASCRIPT, RUBY, PYTHON, etc  and database connectivity MYSQL, MSSQL, to perform the data processing. Web development firms should have established Procedural methods and a solid documented workflow for web based applications</p>";
			break;
		case 10: 
			question += "<span>Question 10. What is eCommerce?</span>";
			answer += "<p>Answer: eCommerce is a general term for any type of business, or commercial transaction, that involves the transfer of information and funds across the Internet. This covers a range of different types of selling, from consumer-based retail sites through auction and music sites, to business exchanges trading goods or services between corporations.</p>";
			break;
		case 11: 
			question += "<span>Question 11. What is E-Business development?</span>";
			answer += "<p>Answer: E-Business is slightly more than eCommerce. Doing business between suppliers and vendors or partners can be done online. The complete business transaction can be done and controlled by an E-Business site.</p>";
			break;
		case 12: 
			question += "<span>Question 12. Is web development and web design the same thing?</span>";
			answer += "<p>Answer: All websites are created using web design techniques but web development, or Web programming, is only used when a site needs to be interactive, dynamic or perform a function that is outside of the realm of static website design.</p>";
			break;
	}
	
	document.getElementById('faq-question').innerHTML = question;
	document.getElementById('faq-answer').innerHTML = answer;
}


/*
JQUERY
*/

$(document).ready(function() {
    $("#grey-bottom").height($(document).height() - ($('#containment').height() + $('#footer-containment').height()) );
});

$(function() {
	// Select all links whose attribute rel starts with lightbox
	$('a[rel^=lightbox]').lightBox();
});

