﻿function expandAll(rowval)
{
    for(i=0;i<rowval; i++)
    {
        var idval="divval"+i;
        var imgval="img"+i;
        document.getElementById(idval).style.display = "block";
        document.getElementById(imgval).src = "images/minus.gif";
    }
}

function collapseAll(rowval)
{
    for(i=0;i<rowval; i++)
    {
        var idval="divval"+i;
        var imgval="img"+i;
        document.getElementById(idval).style.display = "none";
        document.getElementById(imgval).src = "images/plus.gif";
    }
}

function showHideDiv(id)
{
    
    var idval="divval"+id;
    var imgval="img"+id;
    if(document.getElementById(idval).style.display == "block")
    {
        document.getElementById(idval).style.display = "none";
        document.getElementById(imgval).src = "images/plus.gif";
    }
    else
    {
        document.getElementById(idval).style.display = "block";
        document.getElementById(imgval).src = "images/minus.gif";
    }
}

var dwindow;
function showPopupWindow(url, width,height)
{
	if(dwindow)
	{
	    dwindow.close();
	}
	dwindow=window.open(url, "","resizable=no,scrollbars=1,top=40,left=150,width=" + width +",height=" + height); 
}

function getBrowser2()
{
    if(navigator.userAgent.indexOf('MSIE') != -1)
        return "IE";
    else
        return "FireFox";
}

function showPopup(photo)
{ 
    var img = new Image;
    img.src=photo;
    innerWidth= parseInt(img.width) + 8;
    innerHeight = parseInt(img.height) + 25;
    var popDiv = document.getElementById("newDivpop");
    var popaboveDiv = document.getElementById("popupDiv");
    if(popDiv)
    {
         document.body.removeChild(popDiv);
    }
    popDiv = document.createElement("div");
    popDiv.id = "newDivpop";
    popDiv.className='popdiv1';
    var de;
    if(getBrowser2() == "IE")
        de = document.documentElement;
    else
        de = document.body;
    popDiv.style.width = de.clientWidth + 'px';
    popDiv.style.height = de.clientHeight + 'px';
    document.body.appendChild(popDiv);
    if(popaboveDiv)
    {
         document.body.removeChild(popaboveDiv);
    }
    popaboveDiv = document.createElement("div");
    popaboveDiv.id = "popupDiv";
    popaboveDiv.className='popdivstyle';
    popaboveDiv.style.width = innerWidth + 'px';
    popaboveDiv.style.height = innerHeight + 'px';
    document.body.appendChild(popaboveDiv);
    popaboveDiv.style.left = ((parseInt(popDiv.style.width) - innerWidth)/2) + 'px';
    popaboveDiv.style.top = (parseInt(de.scrollTop) + ((parseInt(de.clientHeight) - innerHeight) / 2)) + 'px';
    var contentStr = "<table border='0' width='100%' id='table1' cellspacing='0' cellpadding='0'><tr>";
    contentStr += "<td align='right' style='padding-right:5px; padding-bottom:3px;padding-top:2px'><a title='Close' href='javascript:hidePopupBox()' class='href' style='text-decoration: none'>";
    contentStr += "<img src='images/assignednot.gif' border='0'></a></td></tr>";
    contentStr += "<tr><td valign='top' align='center' style='padding-bottom:5px'><img src='" + photo + "' onclick='hidePopupBox()' style='border:solid 1px #8FA1B6;'></td></tr>";
    contentStr += "</table>";
    popaboveDiv.innerHTML = contentStr;
    popDiv.style.display = "block";
    popaboveDiv.style.display = "block";
	
}
function hidePopupBox()
{
    var popDiv = document.getElementById("newDivpop");
    var popaboveDiv = document.getElementById("popupDiv");
    if(popDiv)
        popDiv.style.display = 'none';
    if(popaboveDiv)
        popaboveDiv.style.display = 'none';
}
var innerWidth;
var innerHeight;

function showPopupTitle(photo, title)
{
	try{
    var img = new Image;
    img.src=photo;
    innerWidth= parseInt(img.width) + 8;
    innerHeight = parseInt(img.height) + 25;
    var popDiv = document.getElementById("newDivpop");
    var popaboveDiv = document.getElementById("popupDiv");
    if(popDiv)
    {
         document.body.removeChild(popDiv);
    }
    popDiv = document.createElement("div");
    popDiv.id = "newDivpop";
    popDiv.className='popdiv1';
    var de;
    if(getBrowser2() == "IE")
        de = document.documentElement;
    else
        de = document.body;
    popDiv.style.width = de.clientWidth+ 'px';
    popDiv.style.height = de.scrollHeight+ 'px';
    document.body.appendChild(popDiv);
        
    if(popaboveDiv)
    {
         document.body.removeChild(popaboveDiv);
    }
    popaboveDiv = document.createElement("div");
    popaboveDiv.id = "popupDiv";
    popaboveDiv.className='popdivstyle';
    popaboveDiv.style.width = innerWidth + 'px';
    popaboveDiv.style.height = innerHeight + 'px';
    document.body.appendChild(popaboveDiv);
    popaboveDiv.style.left = ((parseInt(popDiv.style.width) - innerWidth)/2) + 'px';
    popaboveDiv.style.top = (parseInt(de.scrollTop) + ((parseInt(de.clientHeight) - innerHeight) / 2)) + 'px';

    var contentStr = "<table border='0' width='100%' id='table1' cellspacing='0' cellpadding='0'><tr>";
    contentStr += "<td align='center' class='textstyle' width='95%'>" + title + "</td><td width='5%' align='right' style='padding-right:5px; padding-bottom:3px;padding-top:2px'><a title='Close' href='javascript:hidePopupBox()' class='href' style='text-decoration: none'>";
    contentStr += "<img src='images/assignednot.gif' border='0'></a></td></tr>";
    contentStr += "<tr><td valign='top' colspan='2' align='center' style='padding-bottom:5px'><img src='" + photo + "' onkeypress='hidePopup(event)' onclick='hidePopupBox()' style='border:solid 1px #8FA1B6;'></td></tr>";
    contentStr += "</table>";
    popaboveDiv.innerHTML = contentStr;
    popDiv.style.display = "block";
    popaboveDiv.style.display = "block";
	}catch(err){}
}

document.onkeypress = function()
{
    hidePopup(event);
}

function hidePopup(e)
{
    if(e.keyCode == 27)
        hidePopupBox();
}


/***Display Title,Image and Information In Popup***/
var innerWidth;
var innerHeight;

function showPopupImage(photo, title, comments)
{
	try{
    var img = new Image;
    img.src=photo;
    innerWidth= parseInt(img.width) + 8;
    innerHeight = parseInt(img.height) + 25;
    if(comments.length >0)
        innerHeight = innerHeight + 80;
    var popDiv = document.getElementById("newDivpop");
    var popaboveDiv = document.getElementById("popupDiv");
    if(popDiv)
    {
         document.body.removeChild(popDiv);
    }
    popDiv = document.createElement("div");
    popDiv.id = "newDivpop";
    popDiv.className='popdiv1';
    var de;
    if(getBrowser2() == "IE")
        de = document.documentElement;
    else
        de = document.body;
   
    popDiv.style.width = de.clientWidth + 'px';
    popDiv.style.height = de.scrollHeight + 'px';
    document.body.appendChild(popDiv);
        
    if(popaboveDiv)
    {
         document.body.removeChild(popaboveDiv);
    }
    popaboveDiv = document.createElement("div");
    popaboveDiv.id = "popupDiv";
    popaboveDiv.className='popdivstyle';
    popaboveDiv.style.width = innerWidth + 'px';
    popaboveDiv.style.height = innerHeight + 'px';
    document.body.appendChild(popaboveDiv);
    popaboveDiv.style.left = ((parseInt(popDiv.style.width) - innerWidth)/2) + 'px';
    popaboveDiv.style.top = (parseInt(de.scrollTop) + ((parseInt(de.clientHeight) - innerHeight) / 2)) + 'px';

    var contentStr = "<table border='0' width='100%' id='table1' cellspacing='0' cellpadding='0'><tr>";
    contentStr += "<td align='center' class='textstyle' width='95%'><b>" + title + "</b></td><td width='5%' align='right' style='padding-right:5px; padding-bottom:3px;padding-top:2px'><a title='Close' href='javascript:hidePopupBox()' class='href' style='text-decoration: none'>";
    contentStr += "<img src='images/assignednot.gif' border='0'></a></td></tr>";
    contentStr += "<tr><td valign='top' colspan='2' align='center' style='padding-bottom:5px'><img src='" + photo + "' onclick='hidePopupBox()' style='border:solid 1px #8FA1B6;'></td></tr>";
    if(comments.length>0)
        contentStr += "<tr><td valign='top' colspan='2' style='padding-bottom:5px;padding-left:4px;padding-right:6px;'><div class='popCommentsDiv'>" + comments + "</div></td></tr>";
    contentStr += "</table>";
    popaboveDiv.innerHTML = contentStr;
    popDiv.style.display = "block";
    popaboveDiv.style.display = "block";
	}catch(err){}
}


