﻿/*
CSS Browser Selector v0.3.5.1 (Feb 05, 2010) + iPad
Rafael Lima (http://rafael.adm.br)
http://rafael.adm.br/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/
function css_browser_selector(u){var ua = u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1;},g='gecko',w='webkit',s='safari',o='opera',h=document.documentElement,b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?'mobile':is('ipad')?'ipad':is('iphone')?'iphone':is('ipod')?'ipod':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win':is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);



//========================
// General functions
//========================

function toggleVisibleElement(object) {
	$("#" + object).toggle();
}


function rdStat() {
	ls="/log____image.gif?summarylog&je="+navigator.javaEnabled()+"&sw="+screen.width+"&sh="+screen.height;

	if (screen.pixelDepth) ls+="&sd="+screen.pixelDepth;
	else if (screen.colorDepth) ls+="&sd="+screen.colorDepth;

	if (navigator.language) ls+="&la="+navigator.language;
	else if (navigator.userLanguage) ls+="&la="+navigator.userLanguage;

	var cookieEnabled = (navigator.cookieEnabled) ? true : false;
	if (typeof navigator.cookieEnabled == "undefined" && !cookieEnabled)
	{ 
		document.cookie="log____cc=1;path=/;";
		cookieEnabled = (document.cookie.indexOf("log____cc") != -1) ? true : false;
	}
	ls+="&co="+cookieEnabled;

	if (window.innerWidth) {
		ls+="&ww="+window.innerWidth;
		ls+="&wh="+window.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientWidth) {
		ls+="&ww="+document.documentElement.clientWidth;
		ls+="&wh="+document.documentElement.clientHeight;
	}
	else if (document.body && document.body.clientWidth) {
		ls+="&ww="+document.body.clientWidth;
		ls+="&wh="+document.body.clientHeight;
	}

	li=new Image();
	li.src=ls;
}



//========================
// Site Specific functions
//========================

function viewdetail(theURL) {
	window.open(theURL, 'DetailView', 'scrollbars=yes,status=no,toolbar=no,location=no,menubar=no,resizable=yes,height=530,width=700');
}
	

function confirmSubmit(theAction) {
	var agree = confirm("Are you sure you wish to " + theAction + "?");
	if (agree)
		return true;
	else
		return false;
}


function showDescription(o) {
	$(o).parent().css("display", "none");
	$(o).css("display", "none");
	$(o).parent().css("height", "auto");
	$(o).parent().fadeIn(800);
}


function showPreview(o, server) {
	var thumbnailPath = server + $(o).attr("href").replace(/-M.jpg/g, "-S.jpg");
	var thumbnailAlt = $(o).attr("title").replace(/ \| /g, "<br />");

	$("#preview").attr({ src: thumbnailPath });

	$("div.title").html(thumbnailAlt);
	return false;
}


function hidePreview(o) {
	var thumbnailPath = "/_images/blank.gif";
	var thumbnailAlt = "&nbsp;";

	$("#preview").attr({ src: thumbnailPath });

	$("div.title").html(thumbnailAlt);
	return false;
}


function populateStallion(object, theSelect, sire, dam) {

	var o = $(theSelect).val();

	var stallionList = new Array();
	stallionList['Ekraar'] = ['Red Ransom', 'Sacahuista'];
	stallionList['Storm Creek'] = ['Storm Cat', 'Shawnee Creek'];
	stallionList['Hawkeye'] = ['Danehill', 'Tea House'];
	stallionList['Mr Nancho'] = ['Southern Halo', 'Miss Peggy'];
	stallionList['Royal Gem'] = ['Royal Academy', 'Tiffany\'s Gem'];
	stallionList['Great Britain'] = ['Green Desert', 'Park Appeal'];
	stallionList['Ustinov'] = ['Seeking The Gold', 'Let\'s Elope'];

	$(sire).attr("value", stallionList[o][0]);
	$(dam).attr("value", stallionList[o][1]);
}


function showstallion(whichStallion) {
	var stallionList = ['ekraar', 'hawkeye', 'mrnancho', 'stormcreek', 'royalgem', 'ustinov', 'greatbritain'];
	var i = 0;
	for (i=0; i<stallionList.length; i++) {
		var j = stallionList[i];
		if (j != whichStallion) {
			$("#" + j).css("display", "none");
			$("#button_" + j).removeClass("currentbutton");
		}
	}
    $("#" + whichStallion).css("display", "block");
	$("#button_" + whichStallion).addClass("currentbutton");
}
