function setCookie(name,value,days) {

	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = ";expires="+date.toGMTString();
	} else {
		expires = "";
	}	
	document.cookie = name+"="+value+expires+";path=/";
	
}

function readCookie(name) {
	var needle = name + "=";
	var cookieArray = document.cookie.split(';');
	for(var i=0;i <cookieArray.length;i++) {
		var pair = cookieArray[i];
		while (pair.charAt(0)==' ') {
			pair = pair.substring(1, pair.length);
		}
		if (pair.indexOf(needle) == 0) {
			return pair.substring(needle.length, pair.length);
		}
	}
	return null;
}



function toggle_div(id) {
	var e = document.getElementById(id);
   if(e.style.display == 'block'){
	  e.style.display = 'none'; 
   }
   else{
	  e.style.display = 'block';
	}
}

function toggle(id,id2) {
	var e = document.getElementById(id);
   if(e.style.display == 'block'){
	  e.style.display = 'none'; 
	  document.getElementById(id2).src ='/media/pics/arrow1.gif';
   }
   else{
	  e.style.display = 'block';
	  document.getElementById(id2).src ='/media/pics/arrow2.gif';
	}
}

// this is for the flashing type in firefox
(function(){
  // if firefox 3.5+, hide content till load (or 3 seconds) to prevent FOUC
  var d = document, e = d.documentElement, s = d.createElement('style');
  if (e.style.MozTransform === ''){ // gecko 1.9.1 inference
    s.textContent = 'body{visibility:hidden}';
    e.firstChild.appendChild(s);
    function f(){ s.parentNode && s.parentNode.removeChild(s); }
    addEventListener('load',f,false);
    setTimeout(f,3000); 
  }
})();


function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});

// this is for addthis trackback
var addthis_config = {
    data_track_clickback: true
}
	
	//var $j = jQuery.noConflict();
	$(document).ready(function() {
	$('.bunker_name_big_off a').each(function() {
	      	//alert ('hehe');
	      	var item  =$(this).attr("title");
			var content = '/_scripts/showpics.php?w='+item+'&s=700';

		      // Setup
		      $(this).qtip(
		      {
		         content: {
		         	url : content
		         } ,
		         position: {
		         	target: 'mouse',
		            corner: {
		               target: 'center'
		            },
		            adjust: {
		            	screen: true,
		            	resize: true,
		            	scroll: true,
		            	mouse: true 
		            },
		         },
		         style: {
				      width: 700,
				      height:500,
				      padding: 0,
				      background: '#ffffff',
				      color: 'black',
				      textAlign: 'center',
				      border: {
				         width: 5,
				         radius: 2,
				         color: '#ffffff'
				      },
				      	tip: {
					        corner: 'leftMiddle',
					        color: '#ffffff',
					        size: {
					            x: 0,
					            y : 0
					        }
				   		}
				   },
				   show: {
				   delay: 0,
				   effect: { type: 'fade', length: 500 } },
				   hide: { effect: { type: 'fade', length: 50 },fixed:true }
		      });
	   	});
	});
	
$(document).ready(function() {
	$('.bunker_name a').each(function() {
	      	//alert ('hehe');
	      	var item  =$(this).attr("title");
	      	var content = '/_scripts/showpics.php?w='+item+'';
			//var content = '/_scripts/showpics.php?w';
		      // Setup
		      $(this).qtip(
		      {
		         content: {
		         	url : content
		         } ,
		         position: {
		         	target: 'mouse',
		            corner: {
		               target: 'center'
		            },
		            adjust: {
		            	screen: true,
		            	resize: true,
		            	scroll: true,
		            	mouse: true 
		            },
		         },
		         style: {
				      width: 400,
				      height:348,
				      padding: 0,
				      background: '#ffffff',
				      color: 'black',
				      textAlign: 'center',
				      border: {
				         width: 5,
				         radius: 2,
				         color: '#ffffff'
				      },
				      	tip: {
					        corner: 'leftMiddle',
					        color: '#ffffff',
					        size: {
					            x: 0,
					            y : 0
					        }
				   		}
				   },
				   show: {
				   delay: 0,
				   effect: { type: 'fade', length: 50 } },
				   hide: { effect: { type: 'fade', length: 50 },fixed:true }
		      });
	   	});
	   	
	   	
		$('body img[tooltip]').each(function(){
        	$(this).qtip({
            	content: $(this).attr('tooltip'), // Use the tooltip attribute of the element for the content
            	position: { target: 'mouse' },
            	style: {
					padding: 5,
					background: '#ffffff',
					color: '#000000',
					textAlign: 'left',
					border: {
						width: 0,
						radius: 5,
						color: '#ffffff'
					}
            	}
        	});
    	});
    	
    	$('body a[tooltip]').each(function(){
        	$(this).qtip({
            	content: $(this).attr('tooltip'), // Use the tooltip attribute of the element for the content
            	show: { delay: 0 },
            	style: {
					padding: 2,
					background: '#ffffff',
					color: '#000000',
					textAlign: 'left',
					border: {
						width: 0,
						radius: 5,
						color: '#ffffff'
					}
            	}
        	});
    	});
    
	});


  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-1105442-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();


	

