/* Common Javascript code */
/************************
	Datakraft site style
	http://www.datakraft.net/

	This theme was designed and built by Kevin Teljeur, based on work by Michael Heilemann,
	whose site you will find at http://www.andagile.com/
************************/

function toggleElementAttr( elementID, elementAttr, attributeValue1, attributeValue2 ) {
	if( document.getElementById ) {
		theElementStyle = document.getElementById( elementID ).style;
	} else {
		theElementStyle = document.all[ elementID ].style;
	}

	if( theElementStyle[elementAttr] == attributeValue2 || !theElementStyle[elementAttr] ) {
		theElementStyle[elementAttr] = attributeValue1;
	} else {
		theElementStyle[elementAttr] = attributeValue2;
	}
}

/* Function to toggle display of post contents */
function toggleFullStory ( postID ) {
	postSummaryID = "postSummary_" + postID;
	postFullStoryID = "postFull_" + postID;

	toggleElementAttr( postSummaryID, 'display', 'none', 'block' );
	toggleElementAttr( postFullStoryID, 'display', 'block', 'none' );
}

function toggleShowSummary ( postID ) {
//	postSummaryID = "feedItem_" + postID;

//	toggleElementAttr( postSummaryID, 'display', 'none', 'block' );
}

/* Older scripts for backwards compatibility */

function open_window( url ) {
	casewindow=window.open(url,"casewindow","toolbar=no,width=600, height=600,status=no, scrollbars=yes, resize=no, menubar=no");
}

function open_legalwindow( url ) {
	window.open(url,"legalwindow","toolbar=no,width=600, height=270,status=no, scrollbars=yes, resize=no, menubar=no");
}

$(document).ready(function () {
    $('table,thead,tbody,tr,ul,ol').each(function (i) {
        $(this).children('*:first').addClass("first");
        $(this).children('*:odd').addClass("odd");
        $(this).children('*:even').addClass("even");
        $(this).children('*:last').addClass("last");
    });

	// #TB_inline?height=155&width=300&inlineId=hiddenModalContent&modal=true
	if(((!jQuery.support.opacity) || (jQuery.browser.msie )) && (location.href == 'http://www.andcurve.com/wordpress/' || location.href == 'http://www.andcurve.com/')) {
		var msgContainer = $('<div id=\"ieMsg\"></div>');
		msgContainer.css({'display':'none'});
		var msg = $("<span>Just to let you know. You're viewing this site in Internet Explorer, which isn't giving you the best experience you could have, by a long mile. It is a rubbish browser and you should use something better. Take a look at <a href=\"http://www.mozilla.com/en-US/firefox/upgrade.html?from=getfirefox\">Firefox</a> which is a great browser that runs on Windows. Do yourself a favour and upgrade - you can have a faster, safer, better Internet experience in minutes. Click anywhere to get rid of this message, but I really recommend giving it a go - trust me, I build websites for a living...<br />(By the way, you're not seeing the beautiful curved corners!)</span>");
		msgContainer.append(msg);
		$('#footer').append(msgContainer);
		
		tb_show('You\'re using Internet Explorer and that can\'t be good.', '#TB_inline?height=150&width=450&inlineId=ieMsg', false);
	}
});
