/*
OPS AJAX CALL FUNCTION
Date: 20 June 2008
Author: Ashley Glover
Copyright One Part Scisors, 2008


NOTES / MODIFICATIONS:
1. Functions available:
	toggleInfo - scriptaculous toggle
	appearer - scriptaculous appear
	hider - scriptaculous fade
	toggleInfo - scriptaculous toggle
	getPage - ajax info call
	revealnews - loads ajax call news, reveal news DIV
	revealotherinfo - for loading privacy policy and so on
	closenews - closes news page
	topscroller - scrolls to top of page
	
	
*/

function getPage(page, tag1) {
	divName = tag1;
	jQuery(function($j) {  
		$j("#" + divName).load(page);
	});
new Effect.Highlight($(tag1),{startcolor:'#CB0000',endcolor:'#FFFFFF',queue:'front'});
}

function rulesclose () {
	new Effect.Fade ($('rules'));
	new Effect.Fade ($('overlay'));
}
function rulesopen () {
	new Effect.Appear ($('rules'),{queue:'end'});
	new Effect.Appear ($('overlay'),{queue:'front'});
}

function appearer(whatof) {
	new Effect.Appear ($(whatof), {from:'0.0-0.75'});	
}
function newsmouseOver(whatof) {
	$(whatof).style.backgroundColor = '#000000';
}
function newsmouseOut(whatof) {
	$(whatof).style.backgroundColor = '#FFFFFF';
}

function casestudyidentify (headingname) {
	new Effect.Appear($('casestudyinfo'), {from:'0.0-0.50'});
	$('casestudyinfotext').innerHTML = headingname;
}
function casestudyidentifyfade (headingname) {
	new Effect.Fade ($('casestudyinfo'),{queue:'front',from:'0.50-0.00'});
	$('casestudyinfotext').innerHTML = "";
}

function hider(whatof) {
	new Effect.Fade ($(whatof));	
}

function toggleInfo(whatof) {
	new Effect.toggle ($(whatof), 'blind');
}
function revealnews (page, tag1, tag2, tag3, tag4, tag5, tag6,tag7) {
	getPage('newsitem.php',tag1,tag2,'','','','','');
	new Effect.ScrollTo($('wrapper'), {queue:'front'});
	new Effect.BlindDown($('newsfullstory'), {queue:'end'});
	new Effect.Appear($('newsfullstorycloser'), {queue:'end'});
	new Effect.Appear($('overlay'), {from:0.0, to:0.55},{queue:'front'});
}
function revealnewsnewspage (page, tag1, tag2, tag3, tag4, tag5, tag6,tag7) {
	getPage('newspageitem.php',tag1,tag2,tag3, tag4, tag5, tag6,tag7);
	new Effect.Highlight($('newspagearea'),{startcolor:'#6aaeff',endcolor:'#FFFFFF',queue:'end'});
/*	if ($('newspagesidebar')) {
		if ($('newspagesidebar').style.display == 'none') {
			new Effect.BlindDown('newspagesidebar',{queue:'end'});
		}
	}*/
}
function revealcasestudiespage (page, tag1, tag2, tag3, tag4, tag5, tag6,tag7) {
	getPage('casestudiespageitem.php',tag1,tag2,tag3, tag4, tag5, tag6,tag7);
	new Effect.Highlight($('newspagearea'),{startcolor:'#6aaeff',endcolor:'#FFFFFF',queue:'end'});
}

function revealotherinfo (page, tag1, tag2, tag3, tag4, tag5, tag6,tag7) {
	getPage(page,tag1,'','','','','','');
	new Effect.ScrollTo($('wrapper'), {queue:'front'});
	new Effect.Appear($(tag1), {queue:'end'});	
	new Effect.Appear($('otherinfocloser'));
	new Effect.Appear($('overlay'), {from:0.0, to:0.55},{queue:'front'});
}
function closethis (whatof) {
	new Effect.BlindUp($(whatof));
	new Effect.Fade($('overlay'));
	if (whatof == 'newsfullstory') {
		new Effect.BlindUp($('newsfullstorycloser'));
	}
	if (whatof == 'termsblock') {
		new Effect.BlindUp($('otherinfocloser'));
	}

}
function topscroller () {
	new Effect.ScrollTo($('wrapper'));
}
function topscrollerdrupal () {
	new Effect.ScrollTo($('base'));
}
function wheresidebar () {
	topscroller();
	new Effect.Highlight($('leftpanel'),{startcolor:'#6aaeff',endcolor:'#DDDDDD',queue:'end'});
}
function revealCSfrontpage (page, tag1, tag2, tag3, tag4, tag5, tag6,tag7) {
	getPage('casestudy.php',tag1,tag2,'','','','','');
	new Effect.ScrollTo($('wrapper'), {queue:'front'});
	new Effect.Fade ($('casestudyinfo'),{queue:'front',from:'0.50-0.00'});
	new Effect.BlindDown($('casestudy'));
	new Effect.Appear($('casestudycloser'), {queue:'end'});
//	new Effect.Appear($('casestudycloser'));
	new Effect.Appear($('overlay'), {from:0.0, to:0.55},{queue:'front'});
}
function revealCS (page, tag1, tag2, tag3, tag4, tag5, tag6,tag7) {
	getPage('casestudy.php',tag1,tag2,'','','','','');
	new Effect.ScrollTo($('wrapper'), {queue:'front'});
	new Effect.BlindDown($('casestudy'));
	new Effect.Appear($('casestudycloser'), {queue:'end'});
//	new Effect.Appear($('casestudycloser'));
	new Effect.Appear($('overlay'), {from:0.0, to:0.55},{queue:'front'});
}
function closeCS () {
	new Effect.BlindUp($('casestudycloser'));
	new Effect.BlindUp($('casestudy'));
	new Effect.Fade($('overlay'));
}