
function showHide(checkbox,controlID)
{
    var control = document.getElementById(controlID);
    if(checkbox.checked)
    {
        control.style.display = '';
    }
    else
    {
        control.style.display = 'none';
    }
}

function showHideDiv() {
    var divstyle = document.getElementById("hideThisDiv");
    if (divstyle.style.display == 'none') {
        divstyle.style.display = '';
    }
    else {
        divstyle.style.display = 'none';
    }
}


function expandDiv(w)
{
	var d = document.getElementById(w);
 	if(d.style.display=='none')
 	{
    		 d.style.display='';
 	}
}

function collapseDiv(w)
{
 	var d = document.getElementById(w);
 	if(d.style.display=='')
 	{
     		d.style.display='none';
 	}
}

function deleteEntry(entryId, entryTitle, rawUrl)
{
	var confirmDelete = 'Are you sure you want to delete this item?  ' + entryTitle
	if(confirm(confirmDelete))
	{
		location.href='deleteItem.ashx?entryid=' +  entryId + '&rawUrl=' + rawUrl 
	}
}


function deleteReferral(entryId, referralPermalink, type)
{
	var confirmDelete = 'Are you sure you want to delete this item?  ' + referralPermalink
	if(confirm(confirmDelete))
	{
		location.href='deleteItem.ashx?entryid=' +  entryId + '&referralPermalink=' + escape(referralPermalink) + '&type=' + type
	}
}

var timeout= 500;
var closetimer	= 0;
var ddmenuitem	= 0;
function mopen(id)
{
   mcancelclosetime();
   if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
   ddmenuitem = document.getElementById(id);
   ddmenuitem.style.visibility = 'visible';
}
function mclose()
{
   if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}
function mclosetime()
{
   closetimer = window.setTimeout(mclose, timeout);
}
function mcancelclosetime()
{
   if(closetimer)
   {
       window.clearTimeout(closetimer);
       closetimer = null;
    }
}
document.onclick = mclose;


  // form the script that is to be registered at client side.
function doChallengeResponse() 
{
                    // uncomment to debug in IE.
                    // IE -> Tools -> Internet Options... -> Advanced -> Browsing
                    // Disable Script Debugging should be unchecked
                    // scriptString += "	debugger;\n";
	password = document.getElementById(password.ClientID).value;
	if (password)	
	{
		password = net_md5(password);	// this makes it superchallenged!!\n";
                    // get the value for the challenge
		challenge = document.getElementById(challenge.ClientID).value;
                    // get the value for the username
		username = document.getElementById(username.ClientID).value;
                    // create a challenge
		str = challenge + password + username;
		str = net_md5(str);
                    // prepare the challenge and the password for the postback
		document.getElementById(challenge.ClientID).value = str;
		document.getElementById(password.ClientID).value = '';
	}
}


//function getElementsByClass(theClass) 
//{  
//	var classTags = []
//	var allPageTags=document.getElementsByTagName("*");  
//	for (i=0; i<allPageTags.length; i++) 
//	{  
//		//Pick out the tags with our class name  
//		if (allPageTags[i].className==theClass) 
//		{  			
//			classTags[classTags.length] = allPageTagls[i] 
//		}
//	}
//	return classTags
//} 


//function getElementsByAttribute(attr,val,container) 
//{ 
//	container = container¦¦document 
//	var all = container.all¦¦container.getElementsByTagName('*') 
//	var arr = [] 
//	for(var k=0;k<all.length;k++) 
//	{
//		if(all[k].getAttribute(attr) == val) 
//		{
//			arr[arr.length] = all[k] 
//		}
//	}
//	return arr 
//} 


//function getElementsByClass(theClass,container) 
//{ 
//	container = container¦¦document 
//	var all = container.all¦¦container.getElementsByTagName('*') 
//	var arr = [] 
//	for(var k=0;k<all.length;k++) 
//	{
//		//pick out the tags with our class name
//		if(all[k].className==theClass) 
//		{
//			arr[arr.length] = all[k] 
//		}
//	}
//	return arr 
//} 
