var sPath = window.location.pathname;
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
var navstatus = "open";
var storestatus = "closed"
var designstatus = "closed";
var planstatus = "closed";
// JavaScript Document


function setup(){
	MM_preloadImages('/images/page_side_store_active.png', '/images/page_side_design_active.png', '/images/page_side_travel_active.png', '/images/nav_tab_up.png', '/images/nav_tab.png', '/images/tab_back_store.png', '/images/tab_back_plan.png', '/images/tab_back_design.png','/images/charityVideo_a.png','/images/video_a.png');
	if( sPath=='/event.php'){
		load();
	}
	if( sPath=='/packet.php'){
		load1();
	}
	if( sPath=='/contact.php'){
		load2();
	}
}

function load1() {
        	if(GBrowserIsCompatible()) {
			var map = new GMap2(document.getElementById("map"));
                        map.setCenter(new GLatLng(32.788380, -79.930460), 15);
                        // Create our "tiny" marker icon
                        var icon = new GIcon();
                        icon.image = "/images/mm_20_red.png";
                        icon.shadow = "/images/mm_20_shadow.png";
                        icon.iconSize = new GSize(12, 20);
                        icon.shadowSize = new GSize(22, 20);
                        icon.iconAnchor = new GPoint(6, 20);
                        icon.infoWindowAnchor = new GPoint(5, 1);
                        // Place Point
                        map.addOverlay(new GMarker(new GLatLng(32.788380, -79.930460), icon));
                        map.addControl( new GSmallMapControl() );                                            
                }
}

function load2() {
                if(GBrowserIsCompatible()) {
                        var map = new GMap2(document.getElementById("map"));
                        //map.setCenter(new GLatLng(32.790690, -79.927000), 15);
						map.setCenter(new GLatLng(32.8106, -79.8784), 15);
                        // Create our "tiny" marker icon
                        var icon = new GIcon();
                        icon.image = "/images/mm_20_red.png";
                        icon.shadow = "/images/mm_20_shadow.png";
                        icon.iconSize = new GSize(12, 20);
                        icon.shadowSize = new GSize(22, 20);
                        icon.iconAnchor = new GPoint(6, 20);
                        icon.infoWindowAnchor = new GPoint(5, 1);
                        // Place Point
                        map.addOverlay(new GMarker(new GLatLng(32.8106, -79.8784), icon));
                        map.addControl( new GSmallMapControl() );
                }
}

function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}


function rowOverEffect(object) {
if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}
function openNewWindow(URLtoOpen, windowName, windowFeatures) {
         newWindow=window.open(URLtoOpen, windowName, windowFeatures);
}

function newwindow()
{
	window.open('cvv_help.php','jav','width=500,height=550,resizable=no,toolbar=no,menubar=no,status=no');
}

function swapstoreover(){
	$('store_circle').className ='store-a';
}

function swapstoreout(){
	$('store_circle').className ='store';
}

function swapdesignover(){
        $('design_circle').className ='design-a';
}

function swapdesignout(){
        $('design_circle').className ='design';
}
function swaptravelover(){
        $('travel_circle').className ='travel-a';
}

function swaptravelout(){
        $('travel_circle').className ='travel';
}

function openup(elem,navstat){
	if(navstat == 'closed' ){
		$('tab').src = '/images/nav_tab_up.png';
		heightChange(elem);
		//*/
		//alert($('navtab').offsetTop);
		navstatus = "open";
		
	}
	
	if(navstat == 'open' ){
		$('tab').src = '/images/nav_tab.png';
		heightRestore(elem);
		navstatus = "closed";
		
	}
}



function doWidthChangeMem(elem,startWidth,endWidth,steps,intervals,powr) { 
//Width changer with Memory by www.hesido.com
    if (elem.widthChangeMemInt)
	window.clearInterval(elem.widthChangeMemInt);
    var actStep = 0;
    elem.widthChangeMemInt = window.setInterval(
	function() { 
	  elem.currentWidth = easeInOut(startWidth,endWidth,steps,actStep,powr);
	  elem.style.width = elem.currentWidth + "px"; 
	  actStep++;
	  if (actStep > steps) window.clearInterval(elem.widthChangeMemInt);
	} 
	,intervals)
}

function doHeightChangeMem(elem,startHeight,endHeight,steps,intervals,powr) { 
//Width changer with Memory by www.hesido.com
    if (elem.heightChangeMemInt)
	window.clearInterval(elem.heightChangeMemInt);
    var actStep = 0;
    elem.heightChangeMemInt = window.setInterval(
	function() { 
	  elem.currentHeight = easeInOut(startHeight,endHeight,steps,actStep,powr);
	  elem.style.height = elem.currentHeight + "px"; 
	  actStep++;
	  if (actStep > steps) window.clearInterval(elem.heightChangeMemInt);
	} 
	,intervals)
}


function heightChange(elem) { 
	var elem = document.getElementById(elem);
    if (!elem.currentHeight) elem.currentHeight = 150; 
	//if no memory is set, set it first; 
    doHeightChangeMem(elem,elem.currentHeight,323,10,10,0.5); 
    } 

function heightRestore(elem) { 
	var elem = document.getElementById(elem);
    if (!elem.currentHeight) elem.currentHeight = 150;; 
    doHeightChangeMem(elem,elem.currentHeight,0,10,10,0.5); 
}



function widthChange(elem) { 
	var elem = document.getElementById(elem);
    if (!elem.currentWidth) elem.currentWidth = 150; 
	//if no memory is set, set it first; 
    doWidthChangeMem(elem,elem.currentWidth,200,10,10,0.5); 
    } 

function widthRestore(elem) { 
	var elem = document.getElementById(elem);
    if (!elem.currentWidth) return; 
    doWidthChangeMem(elem,elem.currentWidth,0,10,10,0.5); 
}

function easeInOut(minValue,maxValue,totalSteps,actualStep,powr) { 
//Generic Animation Step Value Generator By www.hesido.com 
    var delta = maxValue - minValue; 
    var stepp = minValue+(Math.pow(((1 / totalSteps) * actualStep), powr) * delta); 
    return Math.ceil(stepp) 
} 

function restoreTab()
{
	if(designstatus == 'closed' && storestatus == 'closed' && planstatus == 'closed'){
		$('tabs').style.width="0px";     
		$('tabs').style.left="978px";
		$('storecontent').style.display="none";
                $('plancontent').style.display="none";
                $('designcontent').style.display="none";
	}
}

function expandTab()
{
	$('tabs').style.width="240px";   
	$('tabs').style.left="768px";
        $('storecontent').style.display="block";
        $('plancontent').style.display="block";       
        $('designcontent').style.display="block";
} 

function openstore(elem, storestat){
	if(storestat == 'closed' ){
		expandTab();
		widthChange(elem);
		storestatus = "open";
		//alert(storestatus);
	}
	
	if(storestat == 'open' ){
		widthRestore(elem);
		storestatus = "closed";
		setTimeout("restoreTab()", 350);
		//lert(elem);
		//alert(storestatus);
	}
	
}

function opendesign(elem, designstat){
	if(designstat == 'closed' ){
		expandTab();
		widthChange(elem);
		designstatus = "open";
	}
	
	if(designstat == 'open' ){
		widthRestore(elem);
		designstatus = "closed";
		setTimeout("restoreTab()", 350);
	}
	
}

function openplan(elem, planstat){
	if(planstat == 'closed' ){
		expandTab();
		widthChange(elem);
		planstatus = "open";
	}
	
	if(planstat == 'open' ){
		widthRestore(elem);
		planstatus = "closed";
		setTimeout("restoreTab()", 350);
	}
	
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function overPic(title) {

	var preview = document.getElementById( 'picTitle' );
	preview.innerHTML = title;
}

function offPic(pic) {
}

