// For IE hover flicker bug
try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

$(document).ready(function(){
	$("#news li.more").prev("li").addClass("noLine");
	$("#upcoming_events li.more").prev("li").addClass("noLine");
	
	$("#news li.the_more").prev("li").addClass("noLine");
	$("#upcoming_events li.the_more").prev("li").addClass("noLine");

	$("a.gallery").click(function() {
		window.open(this.getAttribute('href'), '_blank', 'width=800px,height=730px,fullscreen=no,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
		return false;
	});

});

var theImages = new Array()

theImages[0] = 'images/landing/the_gpp_title0.jpg';
theImages[1] = 'images/landing/the_gpp_title.jpg';
//theImages[2] = 'images/home/03.jpg';
//theImages[3] = 'images/home/04.jpg';
//theImages[4] = 'images/home/05.jpg';
//theImages[5] = 'images/home/06.jpg';

var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<img src="'+theImages[whichImage]+'">');
}



function shareTextReplace(div_id,txt)
{
	document.getElementById(div_id).innerHTML = txt;
}
var cShare=0;

function shareOver(idSour,idImg)
{
	if(cShare==0)
	{
		document.getElementById(idSour).style.cursor='pointer';
		document.getElementById(idSour).src=idImg;
	}
}

function shareOut(idSour,idImg)
{
	if(cShare==0)
	{
		document.getElementById(idSour).style.cursor='pointer';
		document.getElementById(idSour).src=idImg;
	}
}

function sharePlus()
{
	objImg = document.getElementById('share_img');
	objContent = document.getElementById('share_hide');
	if(cShare==0)
	{
		objImg.src='images/structure/share_minus.gif';
		objContent.style.display='block';
		cShare=1;
	}
	else
	{
		objImg.src='images/structure/share_plus.gif';
		objContent.style.display='none';
		cShare=0;
	}
}

var plus1=0;
var plus2=0;
var plus3=0;
var plus4=0;
var plus5=0;
var plus6=0;
function thePlus(num)
{
	if(num==1)
	{
		thePlusCall1();
	}
	else if(num==2)
	{
		thePlusCall2();
	}
	else if(num==3)
	{
		thePlusCall3();
	}
	else if(num==4)
	{
		thePlusCall4();
	}
	else if(num==5)
	{
		thePlusCall5();
	}
	else
	{
		thePlusCall6();
	}
}

function plusOverImg(num, idSour, imgDes)
{
	document.getElementById(idSour).style.cursor='pointer';
    if(num==1)
	{
		if(plus1==0)
        document.getElementById(idSour).src = imgDes;
	}
	else if(num==2)
	{
		if(plus2==0)
        document.getElementById(idSour).src = imgDes;
	}
	else if(num==3)
	{
		if(plus3==0)
        document.getElementById(idSour).src = imgDes;
	}
	else if(num==4)
	{
		if(plus4==0)
        document.getElementById(idSour).src = imgDes;
	}
	else if(num==5)
	{
		if(plus5==0)
        document.getElementById(idSour).src = imgDes;
	}
	else
	{
		if(plus6==0)
        document.getElementById(idSour).src = imgDes;
	}    
}
function plusOutImg(num, idSour, imgDes)
{
    if(num==1)
	{
		if(plus1==0)
        document.getElementById(idSour).src = imgDes;
	}
	else if(num==2)
	{
		if(plus2==0)
        document.getElementById(idSour).src = imgDes;
	}
	else if(num==3)
	{
		if(plus3==0)
        document.getElementById(idSour).src = imgDes;
	}
	else if(num==4)
	{
		if(plus4==0)
        document.getElementById(idSour).src = imgDes;
	}
	else if(num==5)
	{
		if(plus5==0)
        document.getElementById(idSour).src = imgDes;
	}
	else
	{
		if(plus6==0)
        document.getElementById(idSour).src = imgDes;
	}
}

function thePlusCall1()
{
	if(plus1==0)
	{
		thePlusShow('img_plus_1','images/gpp/the_minus1.gif','div_top_plus_1_hide');
		plus1=1;
	}
	else
	{
		thePlusHide('img_plus_1','images/gpp/the_plus1.gif','div_top_plus_1_hide');
		plus1=0;
	}
		
	thePlusHide('img_plus_2','images/gpp/the_plus2.gif','div_top_plus_2_hide');
	thePlusHide('img_plus_3','images/gpp/the_plus3.gif','div_top_plus_3_hide');
	thePlusHide('img_plus_4','images/gpp/the_plus4.gif','div_top_plus_4_hide');
	thePlusHide('img_plus_5','images/gpp/the_plus5.gif','div_top_plus_5_hide');
	thePlusHide('img_plus_6','images/gpp/the_plus6.gif','div_top_plus_6_hide');
	plus2=0;plus3=0;plus4=0;plus5=0;plus6=0;
}

function thePlusCall2()
{
	if(plus2==0)
	{
		thePlusShow('img_plus_2','images/gpp/the_minus2.gif','div_top_plus_2_hide');
		plus2=1;
	}
	else
	{
		thePlusHide('img_plus_2','images/gpp/the_plus2.gif','div_top_plus_2_hide');
		plus2=0;
	}
		
	thePlusHide('img_plus_1','images/gpp/the_plus1.gif','div_top_plus_1_hide');
	thePlusHide('img_plus_3','images/gpp/the_plus3.gif','div_top_plus_3_hide');
	thePlusHide('img_plus_4','images/gpp/the_plus4.gif','div_top_plus_4_hide');
	thePlusHide('img_plus_5','images/gpp/the_plus5.gif','div_top_plus_5_hide');
	thePlusHide('img_plus_6','images/gpp/the_plus6.gif','div_top_plus_6_hide');
	plus1=0;plus3=0;plus4=0;plus5=0;plus6=0;
}

function thePlusCall3()
{
	if(plus3==0)
	{
		thePlusShow('img_plus_3','images/gpp/the_minus3.gif','div_top_plus_3_hide');
		plus3=1;
	}
	else
	{
		thePlusHide('img_plus_3','images/gpp/the_plus3.gif','div_top_plus_3_hide');
		plus3=0;
	}
		
	thePlusHide('img_plus_2','images/gpp/the_plus2.gif','div_top_plus_2_hide');
	thePlusHide('img_plus_1','images/gpp/the_plus1.gif','div_top_plus_1_hide');
	thePlusHide('img_plus_4','images/gpp/the_plus4.gif','div_top_plus_4_hide');
	thePlusHide('img_plus_5','images/gpp/the_plus5.gif','div_top_plus_5_hide');
	thePlusHide('img_plus_6','images/gpp/the_plus6.gif','div_top_plus_6_hide');
	plus2=0;plus1=0;plus4=0;plus5=0;plus6=0;
}
function thePlusCall4()
{
	if(plus4==0)
	{
		thePlusShow('img_plus_4','images/gpp/the_minus4.gif','div_top_plus_4_hide');
		plus4=1;
	}
	else
	{
		thePlusHide('img_plus_4','images/gpp/the_plus4.gif','div_top_plus_4_hide');
		plus4=0;
	}
		
	thePlusHide('img_plus_2','images/gpp/the_plus2.gif','div_top_plus_2_hide');
	thePlusHide('img_plus_3','images/gpp/the_plus3.gif','div_top_plus_3_hide');
	thePlusHide('img_plus_1','images/gpp/the_plus1.gif','div_top_plus_1_hide');
	thePlusHide('img_plus_5','images/gpp/the_plus5.gif','div_top_plus_5_hide');
	thePlusHide('img_plus_6','images/gpp/the_plus6.gif','div_top_plus_6_hide');
	plus2=0;plus3=0;plus1=0;plus5=0;plus6=0;
}
function thePlusCall5()
{
	if(plus5==0)
	{
		thePlusShow('img_plus_5','images/gpp/the_minus5.gif','div_top_plus_5_hide');
		plus5=1;
	}
	else
	{
		thePlusHide('img_plus_5','images/gpp/the_plus5.gif','div_top_plus_5_hide');
		plus5=0;
	}
		
	thePlusHide('img_plus_2','images/gpp/the_plus2.gif','div_top_plus_2_hide');
	thePlusHide('img_plus_3','images/gpp/the_plus3.gif','div_top_plus_3_hide');
	thePlusHide('img_plus_4','images/gpp/the_plus4.gif','div_top_plus_4_hide');
	thePlusHide('img_plus_1','images/gpp/the_plus1.gif','div_top_plus_1_hide');
	thePlusHide('img_plus_6','images/gpp/the_plus6.gif','div_top_plus_6_hide');
	plus2=0;plus3=0;plus4=0;plus1=0;plus6=0;
}
function thePlusCall6()
{
	if(plus6==0)
	{
		thePlusShow('img_plus_6','images/gpp/the_minus6.gif','div_top_plus_6_hide');
		plus6=1;
	}
	else
	{
		thePlusHide('img_plus_6','images/gpp/the_plus6.gif','div_top_plus_6_hide');
		plus6=0;
	}
		
	thePlusHide('img_plus_2','images/gpp/the_plus2.gif','div_top_plus_2_hide');
	thePlusHide('img_plus_3','images/gpp/the_plus3.gif','div_top_plus_3_hide');
	thePlusHide('img_plus_4','images/gpp/the_plus4.gif','div_top_plus_4_hide');
	thePlusHide('img_plus_5','images/gpp/the_plus5.gif','div_top_plus_5_hide');
	thePlusHide('img_plus_1','images/gpp/the_plus1.gif','div_top_plus_1_hide');
	plus2=0;plus3=0;plus4=0;plus5=0;plus1=0;
}

function thePlusShow(img_id,vImg,content_id)
{
	objImg = document.getElementById(img_id);
	objContent = document.getElementById(content_id);
	
	objImg.src=vImg;
	objContent.style.display='block';
}

function thePlusHide(img_id,vImg,content_id)
{
	objImg = document.getElementById(img_id);
	objContent = document.getElementById(content_id);
	
	objImg.src=vImg;
	objContent.style.display='none';
}

function randomPlus(){
    var ranNum= Math.floor(Math.random()*5);
    thePlus(ranNum + 1);
}
