//DS 20/06/2008 modified share_div_content
function open_share_popup(page,param,div_close,width,height)
{
	remove_iframe();
	if(div_close != '')
	{
		document.getElementById(div_close).style.display = 'none';
		
		if(document.getElementById('fade_id'))
			document.getElementById('fade_id').style.display = 'none';
			
		
	}

	window_format = 'top=50,left=200,width='+width+',height='+height+',scrollbars=yes';

	window.open(page+param,'',window_format);
}

function share_div_content(div_id,gobbler_page,email_page,friendlist_page,zone_page, width, height, visitor_mode , content_sharing)
{
	if(width == undefined)
		width = 500;

	if(height == undefined)
		height = 550;

	if(document.getElementById(div_id))
		document.getElementById(div_id).style.display = 'block';
	
	if(document.getElementById('fade_id'))
	{
		document.getElementById('fade_id').style.display = 'block';
	}
	if(content_sharing == 'photo-bucket')
		var layer_heading_str = "To share your photo bucket, choose recipients using an option below:";
	else
		var layer_heading_str = "Choose recipients using an option below:";
	share_str = "<div class=\"large\" style=\"padding:10px;\"><b>"+layer_heading_str+"</b><br><div class=\"medium\" style=\"padding: 8px 0px 3px 0px;\"><div class=\"left\" style=\"width:10px; text-align:left; color:#0066CC;\">-</div><div class=\"left\" style=\"padding-right:30px;\"><a href=\"#\" onClick=\"open_share_popup('"+gobbler_page+"','','"+div_id+"',520,538); return false;\"  class=\"noborder\">Select E-mails from your address book on yahoo, gmail etc.</a></div><br clear=\"all\"></div><div class=\"medium\" style=\"padding: 3 0px;\"><div class=\"left\" style=\"width:10px; text-align:left; color:#0066CC;\">-</div> <div class=\"left\" style=\"\"><a href=\"#\" onClick=\"open_share_popup('"+email_page+"','','"+div_id+"',"+width+", "+height+"); return false;\" class=\"noborder\">Enter E-mail addresses manually</a></div><br clear=\"all\"></div><div class=\"medium\" style=\"padding: 3 0px;\">";
	
	if(visitor_mode != 'Y')
	{
		share_str += "<div class=\"left\" style=\"width:10px; text-align:left; color:#0066CC;\">-</div><div class=\"left\" style=\"\"><a href=\"#\" onClick=\"open_share_popup('"+friendlist_page+"','','"+div_id+"',640, 550); return false;\"  class=\"noborder\">Select from your friends list</a></div><br clear=\"all\"></div><div class=\"medium\" style=\"padding: 3 0px;\"><div class=\"left\" style=\"width:10px; text-align:left; color:#0066CC;\">-</div> <div class=\"left\" style=\"\"><a href=\"#\" onClick=\"open_share_popup('"+zone_page+"','','"+div_id+"',"+width+", "+height+"); return false;\" class=\"noborder\">Enter Zonenames</a></div></div></div>";
	}
	
	share_str += "<div class=\"right medium\" style=\"padding:2 5 6 0px;\"><a href=\"#\" onclick = \"document.getElementById('"+div_id+"').style.display='none';document.getElementById('fade_id').style.display='none'; remove_iframe(); return false;\" class=\"noborder\">Close [X]</a><br clear=\"all\"></div>"

	
	document.getElementById(div_id).innerHTML = share_str;
	return false;
}
// TO REMOVE THE IFRAME AFTER SHARE BUTTON IN MUSIC SECTION IS CLICKED.
function remove_iframe()
{
	var iframeDiv = document.getElementById("frame_music_layer");
	if(iframeDiv)
		iframeDiv.style.display="none";
}


function findPos(obj) {
	if(obj)
	{
		var curleft = curtop = 0;
		if (obj.offsetParent) {
			curleft = obj.offsetLeft
			curtop = obj.offsetTop
			while (obj = obj.offsetParent) {
				curleft += obj.offsetLeft
				curtop += obj.offsetTop
			}
		}
		

		document.getElementById('fade_id').style.height = curtop;
		document.getElementById('fade_id').style.display = 'block';
	}
}