// Pavan Malji - 18-Nov-2008

var PHPLIST_DEV_SRV = "http://linuxd-vm25.iaea.org/phplist/";
var PHPLIST_PROD_SRV = "http://rpop-subscriptions.iaea.org/";

var DEV_SRV_REL = "/RPOP_Edit";
var PROD_SRV_REL = "/RPOP";

var DIDYOUKNOW_FILE_EXT_DEV = ".jsp";
var DIDYOUKNOW_FILE_EXT_PROD = ".htm";
var DIDYOUKNOW_MAXLENGTH = 90;
var SHOW_FULL_TIP = true;

var TOTAL_TIPS = 56;
var SHOW_LATEST_TIP = !true;
var AUTO_UPDATE_TIP = false;
var TIP_TIMEOUT = 15000;
var currentTip = 0;
var asynhttpresponse = "";
var didyouknowdata = "";
var galleryData = "";

var currentAlbumData;
var currentImgIndex;

function initSecurityCode()
{
	try
	{
		var curseccode = getRandom(1011);
		document.getElementById("seccode").value = curseccode;
		document.getElementById("seccodevaluediv").innerHTML = "Security code :<span class=\"mandatory\">*</span> <b> " + curseccode + "</b>";
	}
	catch(e){}
}

function initAntiSpam()
{
	try
	{
		insertTextField("seccodeentry", 5, false, "seccodeentrydiv");
		initSecurityCode();
	}
	catch(e){}
}

function verifySecurityCode()
{

	try
	{
		var inputs = document.getElementById("seccodeentrydiv").getElementsByTagName("input");
				
		var enteredcode = inputs[0].value;
		
		if(enteredcode == "")
		{
			alert("Please enter the given security code");
			initSecurityCode();
			return false;
		}


		if(enteredcode != document.getElementById("seccode").value)
		{
			alert("Entered security code is incorrect. Please check the security code");
			initSecurityCode();
			return false;
		}

		return true;
	}
	catch(e){}
	
	return false;
}

function getRandom(seed)
{
	return Math.floor(Math.random()*seed);
}

function insertTextField(fieldname, size, hidden, divid)
{
	document.getElementById(divid).innerHTML = "<input size=\"" + size + "\" id=\"" + name + "\" type=\"text\" name=\"" + name + "\">";
}

function NewWin(mypage, myname, w, h, scroll) 
{
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) 	
	{ 
		win.window.focus(); 
	}
}


function isNullOrEmpty(str)
{
	if(str == null || str == "")
		return true;

	return false;
}

function generateGUID()
{
    var g = "{";
    for(var i = 0; i < 32; i++)
    g += Math.floor(Math.random() * 0xF).toString(0xF) + (i == 8 || i == 12 || i == 16 || i == 20 ? "-" : "")
    return g + "}";
}

function getCookie(Name)
{
	var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
	if (document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1] //return its value
	return ""
}

function setCookie(name, value)
{
	var expiration_date = new Date ();
	expiration_date . setYear (expiration_date . getYear () + 1);
	expiration_date = expiration_date . toGMTString();
	document.cookie = name+"="+value+";path=/;expires=" + expiration_date + ";" //cookie value is domain wide (path=/)
}

function replaceAll(OldString,FindString,ReplaceString) 
{
  	var SearchIndex = 0;
  	var NewString = ""; 
  	while (OldString.indexOf(FindString,SearchIndex) != -1)    {
    	NewString += OldString.substring(SearchIndex,OldString.indexOf(FindString,SearchIndex));
    	NewString += ReplaceString;
    	SearchIndex = (OldString.indexOf(FindString,SearchIndex) + FindString.length);         
 	}
  	NewString += OldString.substring(SearchIndex,OldString.length);
  	return NewString;
}

function getAndApplyNucleusMasterPage(url, changeToAbsolutePaths)
{	
	var masterPageContent 	= getHTMLContent(url+"?xmlhit=true");	
	applyOasisMasterPage(masterPageContent, changeToAbsolutePaths);
}

function applyNucleusMasterPage(masterPageContent, changeToAbsolutePaths)
{
	var masterPageBody 	= masterPageContent.substr(masterPageContent.indexOf("<body>"), masterPageContent.indexOf("</body>"));
	
	if(changeToAbsolutePaths)
	{
		masterPageBody = replaceAll(masterPageBody, "href=\"/NUCLEUS/nucleus/", "href=\"http://oasis.iaea.org/OASIS/OASIS/");
	}
	
	var currentPageTitle = document.getElementsByTagName("title")[0].innerHTML;
	var currentPageBody = document.getElementsByTagName("body")[0].innerHTML;

	masterPageBody = masterPageBody.replace("##CONTENT##",currentPageBody);
	masterPageBody = masterPageBody.replace(currentPageTitle,"");
	masterPageBody = masterPageBody.replace("##TITLE##",currentPageTitle);

	document.getElementsByTagName("body")[0].innerHTML = masterPageBody;
	document.getElementsByTagName("body")[0].style.background = "#e9f1ff";
}

function getParameter ( parameterName )
{
	var queryString = window.top.location.search.substring(1);
	
	var parameterName = parameterName + "=";

	if ( queryString.length > 0 )
	{
		begin = queryString.indexOf ( parameterName );

		if ( begin != -1 )
		{
			begin += parameterName.length;
			end = queryString.indexOf ( "&" , begin );

			if ( end == -1 )
			{
				end = queryString.length
			}
			
			return unescape ( queryString.substring ( begin, end ) );
		}
	}
	return "null";
}

function getHTMLContent(url)
{
	var httpRequest;

        if (window.XMLHttpRequest)
        {
            httpRequest = new XMLHttpRequest();
            if (httpRequest.overrideMimeType)
            {
                httpRequest.overrideMimeType('text/xml');
            }
        }
        else if (window.ActiveXObject)
        {
           try
	   {
		httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
	   }
	   catch (e)
	   {
           }
	}

        if (!httpRequest)
        {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }

       
        var sDocumentURL = url;

	httpRequest.open('GET', sDocumentURL, false);
        httpRequest.send('');

        // return sDocumentURL;
        return httpRequest.responseText;
}

function getAsynHTMLContent(url)
{
	resetAsynHTMLContent();
	
	var httpRequest;

        if (window.XMLHttpRequest)
        {
            httpRequest = new XMLHttpRequest();
            if (httpRequest.overrideMimeType)
            {
                httpRequest.overrideMimeType('text/xml');
            }
        }
        else if (window.ActiveXObject)
        {
         	try
            	{
                	httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch (e)
                {
                }
	}

        if (!httpRequest)
        {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }

        var sDocumentURL = url;

	httpRequest.open('GET', sDocumentURL, true);
	httpRequest.onreadystatechange = function() 	{
								if (httpRequest.readyState != 4)  
								{ 
								   	return; 
								}
								   
   								asynhttpresponse = httpRequest.responseText;
							}
        httpRequest.send('');

        // return sDocumentURL;
        // return httpRequest.responseText;
}

function resetAsynHTMLContent()
{
	asynhttpresponse = "";
}


function newWin(page, name, w, h, scroll) 
{
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
	win = window.open(page, name, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}


function trim(str)
{
    return str.replace(/^\s*/, "").replace(/\s*$/, "");
}



function stripHTMLComments(str)
{
	var csTag = "<"+"!--";
	var ceTag = "--"+">"
	var cs = str.indexOf(csTag);
	var ce = str.indexOf(ceTag);
	var result = null;


	if(cs != -1 && ce != -1 && ce > cs)
	{
		result = str.split(ceTag);
		str = "";

		for(var i=0; i<result.length; i++)
		{
			str = (result[i].indexOf(csTag) == -1) ? str = str + result[i] : str = str + result[i].split(csTag)[0];
		}
	}

	return str;
}


function extractBody(html)
{
	var s = html.indexOf("<body>") + "<body>".length;
	var e = html.indexOf("</body>");
	html = html.substring(s, e);
	return trim(html);
}

function setInnerHTML(innerHTML, divID)
{	
	document.getElementById(divID).innerHTML = innerHTML;
}

function getInnerHTML(divID)
{
	return trim(document.getElementById(divID).innerHTML);
}


// Implementation of Did you know - Start

function getTipUrl()
{
	var tipURL = "";
	try
	{
		var ext = ( ("PROD" == "EDIT") ? DIDYOUKNOW_FILE_EXT_DEV : DIDYOUKNOW_FILE_EXT_PROD );
		var url = ( ("PROD" == "EDIT") ? didyouknowdata[1] : replaceAll(didyouknowdata[1],"wcm2.iaea.org","rpop.iaea.org"));
	
		if(currentTip < 10)
		{
			tipURL = url + "/Tip00" + currentTip + ext;	
		}
		else if(currentTip < 100)
		{
			tipURL = url + "/Tip0" + currentTip + ext;	
		}
		else
		{
			tipURL = url + "/Tip" + currentTip + ext;	
		}
		
		
		
	}
	catch(e)
	{
		tipURL = "";
	}
	return tipURL;
}

function getNextAutoTip()
{
	if(SHOW_LATEST_TIP)
	{
		var nextTip = (currentTip - 1) % didyouknowdata[0];
		currentTip = (nextTip <= 0) ? didyouknowdata[0] : nextTip;
	}
	else
	{
		currentTip = Math.floor(Math.random()*didyouknowdata[0]) + 1;	
	}
	
	getTip();
}

function getNextTip()
{
	var nextTip = (currentTip + 1) % didyouknowdata[0];
	currentTip = (nextTip <= 0) ? TOTAL_TIPS : nextTip;
	getTip();
}

function getPrevTip()
{
	var prevTip = (currentTip - 1) % didyouknowdata[0];
	currentTip = (prevTip <= 0) ? TOTAL_TIPS : prevTip;
	getTip();
}

function getTip()
{
	
	var url = getTipUrl();
	if(url == "")
	{
		setInnerHTML("...there are no TIPS available.", "tips");
	}
	else
	{
		resetAsynHTMLContent();
		getAsynHTMLContent(url);
		setTimeout('IsTipLoaded()', 500);
	}
}

function showTip()
{
	var completetip = stripHTMLComments(extractBody(asynhttpresponse));
	var tip = completetip;
	
	if(SHOW_FULL_TIP)
	{
		tip = asynhttpresponse;
	}
	else
	{
		if(DIDYOUKNOW_MAXLENGTH > 0 && tip.length > DIDYOUKNOW_MAXLENGTH)
		{
			tip = tip.substring(0, DIDYOUKNOW_MAXLENGTH) + "...";
		}

		tip = "<span class=\"tooltip:nounderline\" title=\"header=[Did You Know] body=[" + completetip + "]\">" + tip + "</span>";		
	}
	
	tip = tip + "<center><table><tr><td align=\"left\"><a href=\"#\" onClick=\"javascript:getPrevTip();\">&laquo;&nbsp;Prev</a></td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td align=\"right\"><a href=\"#\" onClick=\"javascript:getNextTip();\">Next&nbsp;&raquo;</a></td></tr></table></center>";
	
	setInnerHTML(tip, "tips");
	
	if(AUTO_UPDATE_TIP)
	{
		setTimeout('getNextAutoTip()', TIP_TIMEOUT);
	}	
}

function IsTipLoaded()
{
	if(asynhttpresponse != "")
	{
		showTip();
	}
	else
	{
		setTimeout('IsTipLoaded()', 500);
	}
}

function setDidYouKnowData()
{
	try
	{
		var temp = getInnerHTML("tips");
		setInnerHTML("Loading...","tips")
		didyouknowdata = temp.split("$");
		getNextAutoTip();
		// currentTip = didyouknowdata[0];
		// getTip();
	}
	catch(e)
	{
		setInnerHTML("...there are no TIPS available.", "tips");
		didyouknowdata = "";
	}
}


// Implementation of Did you know - End


// Implementation of Newsletter Subscription - Start


function checkSubscriptionForm()
{
	document.subscribeform.action = ( ("PROD" == "EDIT") ? PHPLIST_DEV_SRV : PHPLIST_PROD_SRV ) + "?p=subscribe";

	document.subscribeform.attribute5.value = document.subscribeform.title.value;
	document.subscribeform.attribute6.value = document.subscribeform.fname.value;
	document.subscribeform.attribute7.value = document.subscribeform.lname.value;
	document.subscribeform.attribute8.value = document.subscribeform.profession.value;
	document.subscribeform.attribute9.value = document.subscribeform.country.value;

	if(document.subscribeform.attribute8.value == "Other" && !isNullOrEmpty(document.subscribeform.otherprofession.value))
	{
		document.subscribeform.attribute8.value = document.subscribeform.otherprofession.value;
	}


	if(isNullOrEmpty(document.subscribeform.attribute5.value))
	{
		alert("Please select a Prefix to your name.");
		return false;
	}

	if(isNullOrEmpty(document.subscribeform.attribute7.value))
	{
		alert("Please enter your Last Name.");
		return false;
	}

	if(isNullOrEmpty(document.subscribeform.attribute6.value))
	{
		alert("Please enter your First Name.");
		return false;
	}

	if(isNullOrEmpty(document.subscribeform.attribute8.value))
	{
		alert("Please select your Profession.");
		return false;
	}

	if(isNullOrEmpty(document.subscribeform.attribute9.value))
	{
		alert("Please select your Country.");
		return false;
	}

	if(isNullOrEmpty(document.subscribeform.email.value))
	{
		alert("Please enter your Email address.");
		return false;
	}

	if(!isEmailValid(document.subscribeform.email.value))
	{
		alert("Please enter a valid Email address.");
		return false;
	}

	if(!isEmailConfirmEmailEqual())
	{
		alert("Entered Email and Confirmation Email do not match.");
		return false;
	}

	if(!isNewsLetterSelected())
	{
		alert("Please select atleast one Newsletter");
		return false;
	}

	window.parent.registerTrigger("thankyou");

	return true;

}

function checkUnSubscriptionForm()
{
	document.unsubscribeform.action = ( ("PROD" == "EDIT") ? PHPLIST_DEV_SRV : PHPLIST_PROD_SRV ) + "?p=unsubscribe&amp;id=1";
	
	if(isNullOrEmpty(document.unsubscribeform.unsubscribeemail.value))
	{
		alert("Please enter your Email address.");
		return false;
	}
	
	if(!isEmailValid(document.unsubscribeform.unsubscribeemail.value))
	{
		alert("Please enter a valid Email address.");
		return false;
	}
	
	window.parent.registerTrigger();
	
	return true;
}

function isEmailValid (strng)
{
	var emailFilter=/^.+@.+\..{2,3}$/;

	if (!(emailFilter.test(strng)))
	{
		return false;
	}
	else
	{
		//test email for illegal characters
		var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/;
		if (strng.match(illegalChars))
		{
			return false;
		}
	}
	return true;
}

function isEmailConfirmEmailEqual()
{
	if(document.subscribeform.email.value == document.subscribeform.emailconfirm.value)
		return true;

	return false;
}

function isNewsLetterSelected()
{
	var formElem;

	for (i = 0; i < document.subscribeform.elements.length; i++)
	{
		formElem = document.subscribeform.elements[i];

		if (formElem.type == 'checkbox')
		{
			var formElemName = formElem.name;

			if(formElemName.length > 5)
			{
				if(formElemName.substr(0,5) == "list[")
				{
					if(formElem.value != "")
					{
						return true;
					}
				}
			}
		}
	}

	return false;
}


function setCheckboxValue(checkbox, value)
{
	if(document.subscribeform.elements[checkbox].checked)
	{
		document.subscribeform.elements[checkbox].value = value;
	}
	else
	{
		document.subscribeform.elements[checkbox].value = "";
	}
}


function enterOtherProfession()
{
	if(document.getElementById("profession").value == "Other")
	{
		document.getElementById("otherprofession").innerHTML = "<font size=\"2\">Please specify : <input size=\"20\" type=\"text\" name=\"otherprofession\" style=\" width: 250px;\" id=\"otherprofession\">";
	}
	else
	{
		document.getElementById("otherprofession").innerHTML = "";
	}
}



// Implementation of Newsletter Subscription - End

// Implementation of Gallery - Start

function initGallery(url)
{
	var xml = new JKL.ParseXML(url);
	galleryData = xml.parse();
	
	
	try
	{
		var numofalbums = galleryData["root"]["folder1"].length;
		var divalbumsdata = "";



		divalbumsdata = "<select name=\"albums\" id=\"albums\" onchange=\"changeAlbum()\">";

		for(var i=numofalbums-1; i>=0; i--)
		{
			divalbumsdata = divalbumsdata + "<option value=\"" + i + "\">" + galleryData["root"]["folder1"][i]["title"] + "</option>";
		}

		divalbumsdata = divalbumsdata + "</select>";

		divalbumsdata = "<table>" +
					"<tr>" +
					"<td>" +
					"Albums:&nbsp;" +
					"</td>" +
					"<td>" +
					divalbumsdata +	
					"</td>" +
					"</tr>" + 
				"</table>";

		document.getElementById("divalbums").innerHTML = divalbumsdata;
	}
	catch(e)
	{
		alert("No ablums available.");
	}
	
}

function changeAlbum()
{
	showGallery();
}

function showGallery()
{	
	// Number of folders under root - galleryData["root"]["folder1"].length
	// Number of files under a particular folder eg first folder - galleryData["root"]["folder1"][0]["file"].length
	
	try
	{
		var album = document.getElementById("albums").value;
		var sortby = document.getElementById("sortby").value;
		var albumdata = sortGallery(galleryData["root"]["folder1"][album]["file"], sortby);

		var gallery = (albumdata.length == undefined) ? buildSinglePictureGallery(albumdata) : buildMultiPictureGallery(albumdata);

		document.getElementById("gallery").innerHTML = "<table class=\"gallery\"><tr>" + gallery + "</tr></table>";
	}
	catch(e)
	{}
}

function sortGallery(albumdata, sortby)
{
	if(albumdata.length != undefined)
	{
		var temp = (sortby.indexOf("date") ==  -1) ? sort(cloneArray(albumdata), "title") : sort(cloneArray(albumdata), "oid");
		
		for(var i=0; i<temp.length; i++)
		{
			var picindex = (sortby.indexOf("dec") == -1) ? i : temp.length - i - 1;
			albumdata[picindex] = temp[i];
		}
	}
	
	return albumdata;
}

// sort() - sorts the collection based on a field name - f
function sort(data, f) 
{
	var i, j;
	var currentValue;
	var currentObj;
	var compareObj;
	var compareValue;

	for(i=1; i<data.length;i++) 
	{
		currentObj = data[i];
		currentValue = currentObj[f];

		j= i-1;
		compareObj = data[j];
		compareValue = compareObj[f];

		while(j >=0 && compareValue > currentValue) 
		{
			data[j+1] = data[j];
			j--;
			if (j >=0) 
			{
				compareObj = data[j];
				compareValue = compareObj[f];
			}        
		}  
		data[j+1] = currentObj;
	}
	
	return data;
}

function buildMultiPictureGallery(albumdata)
{
	var gallery = "";
	for(var i=0; i<albumdata.length; i++)
	{
		var img = albumdata[i];
		var imgurl = (("PROD" == "EDIT") ? img["url"] : replaceAll(img["url"], "wcm1.iaea.org/RPOP_Edit", "rpop.iaea.org/RPOP"));	
//var imgurl = ("PROD" == "EDIT") ? replaceAll(img["url"], "http://wcm2.iaea.org/RPOP", DEV_SRV_REL) : replaceAll(img["url"], "http://wcm2.iaea.org/RPOP", PROD_SRV_REL);
		
		var detailspageurl = ("PROD" == "EDIT") ? "GalleryDetails.jsp" : "GalleryDetails.htm"
		
		var hrefurl = detailspageurl + "?album=" + document.getElementById("albums").value + "&imgIndex="+i + "&sortby="+document.getElementById("sortby").value; 

		if(i%4 == 0 && i != 0)
		{
			gallery = gallery + "</tr>";
			gallery = gallery + "<tr>";
		}

		gallery = gallery + "<td>";
		gallery = gallery + "<a href=\"" + hrefurl + "\"><img src=\"" + imgurl + "\" width=\"128\" height=\"96\" alt=\"\" class=\"framed\" /><br /><strong class=\"textsmall\">" + img["title"] + "</strong></a>";
		gallery = gallery + "</td>";
	}
	
	return gallery;
}

function buildSinglePictureGallery(albumdata)
{
	var gallery = "";
	var img = albumdata;
	var imgurl = (("PROD" == "EDIT") ? img["url"] : replaceAll(img["url"], "wcm1.iaea.org/RPOP_Edit", "rpop.iaea.org/RPOP"));
//var imgurl = ("PROD" == "EDIT") ? replaceAll(img["url"], "http://wcm2.iaea.org/RPOP", DEV_SRV_REL) : replaceAll(img["url"], "http://wcm2.iaea.org/RPOP", PROD_SRV_REL);
	
	var detailspageurl = ("PROD" == "EDIT") ? "GalleryDetails.jsp" : "GalleryDetails.htm"
	
	var hrefurl = detailspageurl + "?album=" + document.getElementById("albums").value + "&imgIndex=-1"+ + "&sortby="+document.getElementById("sortby").value; 
	
	gallery = gallery + "<td>";
	gallery = gallery + "<a href=\"" + hrefurl + "\"><img src=\"" + imgurl + "\" width=\"128\" height=\"96\" alt=\"\" class=\"framed\" /><br /><strong class=\"textsmall\">" + img["title"] + "</strong></a>";
	gallery = gallery + "</td>";
	gallery = gallery + "<td></td><td></td><td></td>";
	
	return gallery;
}

// cloneArray() -- clones a given array
function cloneArray(inArray) 
{
  var temp = new Array(inArray.length);
  
  for (var i = 0; i < inArray.length; i++) 
  {
    temp[i] = inArray[i];
  }
  
  return temp;
} 

function initGalleryDetails(url)
{
	try
	{
		var xml = new JKL.ParseXML(url);
		galleryData = xml.parse();

		var album = getParameter("album");
		currentAlbumData = sortGallery(galleryData["root"]["folder1"][album]["file"], getParameter("sortby"));
		currentImgIndex = parseInt(getParameter("imgIndex"));

		showPictureDetails();
	}
	catch(e)
	{
		alert("Error loading picture details...");
	}
}

function showPictureDetails()
{
	var img;
	
	if(currentImgIndex == -1)
	{
		img = currentAlbumData;	
	}
	else
	{
		img = currentAlbumData[currentImgIndex];
	}
	var imgurl = (("PROD" == "EDIT") ? img["url"] : replaceAll(img["url"], "wcm1.iaea.org/RPOP_Edit", "rpop.iaea.org/RPOP"));
//var imgurl = ("PROD" == "EDIT") ? replaceAll(img["url"], "http://wcm2.iaea.org/RPOP", DEV_SRV_REL) : replaceAll(img["url"], "http://wcm2.iaea.org/RPOP", PROD_SRV_REL);
	var imgtitle = img["title"];
	var imgdesc = img["desc"];
	
	document.getElementById("imgTitle").innerHTML = "<h3>" + imgtitle + "</h3>";
	document.getElementById("img").innerHTML = "<img src=\"" + imgurl + "\" alt=\"\" width=\"792\" height=\"592\" class=\"framed\" />";
	document.getElementById("imgDesc").innerHTML = imgdesc;
	
}

function showNextPictureDetails()
{
	if(currentImgIndex == -1)
		return;
	
	if(currentImgIndex < currentAlbumData.length - 1)
	{
		currentImgIndex = currentImgIndex + 1;
	}
	
	showPictureDetails();
}

function showPrevPictureDetails()
{
	if(currentImgIndex == -1)
		return;
		
	if(currentImgIndex > 0)
	{
		currentImgIndex = currentImgIndex - 1;
	}
	
	showPictureDetails();
}

// Implementation of Gallery - End
