﻿// JScript File
/* Browser Check */

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();




/* Video Player Overlay */

function itemLoadCallbackFunction(carousel, state)
{
    state = "prev";
    carousel.add(0, "I'm item #");
      
};


function swapVideo(item, embed) {
    
    if(!item) {
        
        //jQuery('#celeb_carousel').jcarousel.add(0, "hi");
        //$("#celeb_carousel").prepend('<li><a class="carousel_item" href="#" onclick="swapVideo(this, \'<object width=REALQUOTE480REALQUOTE height=REALQUOTE385REALQUOTE><param name=REALQUOTEmovieREALQUOTE value=REALQUOTEhttp://www.youtube.com/v/ZmVgKcbm0KA&amp;hl=en&amp;fs=1&amp;REALQUOTE></param><param name=REALQUOTEallowFullScreenREALQUOTE value=REALQUOTEtrueREALQUOTE></param><param name=REALQUOTEallowscriptaccessREALQUOTE value=REALQUOTEalwaysREALQUOTE></param><embed src=REALQUOTEhttp://www.youtube.com/v/ZmVgKcbm0KA&amp;hl=en&amp;fs=1&amp;REALQUOTE type=REALQUOTEapplication/x-shockwave-flashREALQUOTE allowscriptaccess=REALQUOTEalwaysREALQUOTE allowfullscreen=REALQUOTEtrueREALQUOTE width=REALQUOTE480REALQUOTE height=REALQUOTE385REALQUOTE></embed></object>\');swapTitle(\'BrettSINGLEQUOTEs Video\');swapText(\'Here is my video!<br>\');return false;" title="bnooyen"><img src="http://i1.ytimg.com/vi/ZmVgKcbm0KA/default.jpg" alt="bnooyen"></a><span>bnooyen</span></li>'); 
        //$("#celeb_carousel").prepend('<li><a class="carousel_item" href="#" onclick="swapVideo(this, \'<object width=REALQUOTE480REALQUOTE height=REALQUOTE385REALQUOTE><param name=REALQUOTEmovieREALQUOTE value=REALQUOTEhttp://www.youtube.com/v/ZmVgKcbm0KA&amp;hl=en&amp;fs=1&amp;REALQUOTE></param><param name=REALQUOTEallowFullScreenREALQUOTE value=REALQUOTEtrueREALQUOTE></param><param name=REALQUOTEallowscriptaccessREALQUOTE value=REALQUOTEalwaysREALQUOTE></param><embed src=REALQUOTEhttp://www.youtube.com/v/ZmVgKcbm0KA&amp;hl=en&amp;fs=1&amp;REALQUOTE type=REALQUOTEapplication/x-shockwave-flashREALQUOTE allowscriptaccess=REALQUOTEalwaysREALQUOTE allowfullscreen=REALQUOTEtrueREALQUOTE width=REALQUOTE480REALQUOTE height=REALQUOTE385REALQUOTE></embed></object>\');swapTitle(\'BrettSINGLEQUOTEs Video\');swapText(\'Here is my video!<br>\');return false;" title="bnooyen"><img src="http://i1.ytimg.com/vi/ZmVgKcbm0KA/default.jpg" alt="bnooyen"></a><span>bnooyen</span></li>'); 
    }
    
    var anchors = document.getElementsByTagName("a");
    for(a = 0; a < anchors.length; a++) {
    
        if(anchors[a].className == "carousel_item on")
            anchors[a].className = "carousel_item";
    
    }    
    
    item.className = "carousel_item on";
   
    embed = embed.replace(/REALQUOTE/g, "\"");
    embed = embed.replace(/SINGLEQUOTE/g, "'");
    document.getElementById("video_area").innerHTML = embed;
}
function swapTitle(title) {
    title = title.replace(/REALQUOTE/g, "\"");
    title = title.replace(/SINGLEQUOTE/g, "'");
    document.getElementById("title_area").innerHTML = "<h2>"+title+"</h2>";
}
function swapText(text) {
    text = text.replace(/REALQUOTE/g, "\"");
    text = text.replace(/SINGLEQUOTE/g, "'");
    document.getElementById("text_area").innerHTML = "<p>"+text+"</p>";
}

// 2.0 About

function nextFAQ(direction, id) {
    
        total = 2;
        
        // Hide all faqs first
        var dls = document.getElementById("faqs_list").getElementsByTagName("dl");
    
        for(i = 0; i < dls.length; i++) {
            dls[i].style.display = "none";
        }
    
        // Now show the one we want to
        document.getElementById("faq" + id).style.display = "block";
        
        // If ID = total, then we will reset the anchor link to 1
        
        if(id == total) {
            document.getElementById("nextA").onclick = function() { nextFAQ('next', 1);return false; }
            document.getElementById("nextB").onclick = function() { nextFAQ('next', 1);return false; }
        }else{
            document.getElementById("nextA").onclick = function() { nextFAQ('next', id + 1);return false; }
            document.getElementById("nextB").onclick = function() { nextFAQ('next', id + 1);return false; }
        }
    }
    
    
function stopRKey(evt) {
  var evt = (evt) ? evt : ((event) ? event : null);
  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
  if ((evt.keyCode == 13))  {return false;}
} 