function confirmDel(link)
{
	/*
		Go to chosen link
	*/
    var is_confirmed = confirm('Do you really want to delete this?');

    if (is_confirmed) {
		window.location.href = link;
        return true;
    }
	else{
		return false;
	}
}

/***********************************
	POP-UP WINDOW
***********************************/
function popup(url, win_width, win_height)
{
	/*
		Pop-up a window
	*/	
	var newwindow;
	newwindow=window.open(url,'name','height='+win_height+', width='+win_width+', scrollbars=yes, locationbar=false');
	if (window.focus) {newwindow.focus()}
}

/***********************************
	SOURCE IMAGE
***********************************/
function changeBg(sDiv, sImg)
{	
	/*
		Change background image of given Div
		@param sDiv: id of the Div
		@param sImg: full URL of the background image
	*/
	oDiv_ID = document.getElementById(sDiv);	
	oDiv_ID.style.background = " #fff url('"+ sImg +"') top left repeat-x" ;	
}

function changeImageSrc(order, status)
{
	/*
		Change Image Source and Background Image for a Navigation when Mouse is Over it
		@param order: order number of a Div
		@param status: Image on or off
	*/	
	leftBorder = document.getElementById('nav_left_border' + order);
	rightBorder = document.getElementById('nav_right_border' + order);
		
	leftBorder.src = "http://studyinvancouver.com/linh_nguyen/purplecrying/webroot/images/front/navigation/nav_left_"+ status + ".gif";
	rightBorder.src = "http://studyinvancouver.com/linh_nguyen/purplecrying/webroot/images/front/navigation/nav_right_"+ status + ".gif";
}

function onHoverImage(divID, hoverImg)
{
	/*
		Change image source of the image when mouse's over it
		@param divID: id of the image that will be change image
	*/	
	document.getElementById(divID).src = hoverImg;	
}

/***********************************
	RADIO 
***********************************/
function turnOn_media(holderID, mediaSrc)
{
	/*
		Turn on audio or video type 
		@param holderID: id of DIV or SPAN that contain the Video or Audio Embedded Code
		@param mediaSrc: directory to the media file
	*/			
	/*document.getElementById(holderID).innerHTML += '<embed src="listen_player.swf" flashvars="flvurl='+mediaSrc+'" type="application/x-shockwave-flash" height="0" width="250"></embed>';*/ 
	document.getElementById(holderID).innerHTML = '<object width="1" height="1"> <param name="src" value="'+mediaSrc+'"> <param name="autoplay" value="true"> <param name="controller" value="true"> <param name="bgcolor" value="#333333"> <embed TYPE="application/x-mlayer2" src="'+mediaSrc+'" autostart="true" loop="false" width="1" height="1" controller="true" bgcolor="#FFFFFF" ></embed> </object>';	
}

/***********************************
	BOOKMARK 
***********************************/
function addBookmark(url)
{	
	/*
		Display Bookmark Panel to add site into viewers' bookmark
	*/	
	title = 'The Period of Purple Crying';
	//url = 'http://www.purplecrying.info/';
	
	if (window.sidebar){ // firefox
		window.sidebar.addPanel(title, url, "");
	}else if(window.opera && window.print){ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	}else if(document.all){// ie
		window.external.AddFavorite(url, title);
	}
}

function preLoadImg()
{
	document.getElementById('preLoad1').src = 'http://studyinvancouver.com/linh_nguyen/purplecrying/webroot/images/magazine/hover/period.png';	
	document.getElementById('preLoad2').src = 'http://studyinvancouver.com/linh_nguyen/purplecrying/webroot/images/magazine/hover/soothing.png';
	document.getElementById('preLoad3').src = 'http://studyinvancouver.com/linh_nguyen/purplecrying/webroot/images/magazine/hover/why.png';
	document.getElementById('preLoad4').src = 'http://studyinvancouver.com/linh_nguyen/purplecrying/webroot/images/magazine/hover/infant.png';
	document.getElementById('preLoad5').src = 'http://studyinvancouver.com/linh_nguyen/purplecrying/webroot/images/magazine/hover/how.png';	
	window.alert("hi");
}

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];}}
}
