function show(item, total) {
  count = total;
  for(i=1;i<=count;i++)
    document.getElementById('sub_'+i).style.display = 'none';
  if(item > 0)
  document.getElementById('sub_'+item).style.display = 'block';
}
 
function rollOver(imgId, imgSrc) 
{
  document.images[imgId].src = 'http://localhost:55200/images/navigation/' + imgSrc + '.gif';
}

function ValidateCheckBox(source, args) 
{
  args.IsValid = document.getElementById('<%= ckbCommunity.ClientID%>').checked;
}

function launchWindow(url, width, height){
	var centerX=(screen.width-width)/2; 
	var centerY=(screen.height-height)/2;
	return window.open(url , 'centerWin', 'scrollbars=yes,top='+centerY+',screenY='+centerY+',left='+centerX+',screenX='+centerX+',height=' + height + ',width=' + width + '');
}

function getconfirm(){ 
	if (confirm("Are you sure you want to delete this record?")==true) 
		return true; 
	else 
		return false; 
}

function checkButton()
{
    var cid = 'divBanner';
    ctrl = document.getElementById (cid);
    if (ctrl.style.display == 'block')
        ShowHide(cid);
}


var state = 'block'; 

function ShowHide(layer_ref) 
{ 
  if (state == 'block') 
  { 
  state = 'none'; 
  } 
  else 
  { 
  state = 'block'; 
  } 
  if (document.all) 
  { //IS IE 4 or 5 (or 6 beta) 
  eval( "document.all." + layer_ref + ".style.display = state"); 
  } 
  if (document.layers) 
  { //IS NETSCAPE 4 or below 
  document.layers[layer_ref].display = state; 
  } 
  if (document.getElementById &&!document.all) 
  { 
  hza = document.getElementById(layer_ref); 
  hza.style.display = state; 
  } 
} 

function Check(val)
{
	for (i=0; i < document.forms[0].elements.length; i++) 
	{
		if ((document.forms[0].elements[i].type == 'checkbox') && (document.forms[0].elements[i].name.indexOf('cbOptions') > -1)) 
		{
		  if(val.checked)
			  document.forms[0].elements[i].checked = true;
		  else
			  document.forms[0].elements[i].checked = false;
		}
	}
}

function writeFlash(id, flashFile, height, width) {
    var source = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='" + width + "' height='" + height + "'><param name='movie' value='/flash/" + flashFile + "'><param name='quality' value='high'><param name='wmode' value='transparent'><embed src='/flash/" + flashFile + "' quality='high' wmode='transparent'pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + width + "' height='" + height + "'></embed></object>";
    document.getElementById(id).innerHTML = source;
} 

function Clickheretoprint()
{ 
  var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
      disp_setting+="scrollbars=yes,width=830, height=600, left=100, top=25"; 
  var content_vlue = document.getElementById("PrintArea").innerHTML; 
  
  var docprint=window.open("","",disp_setting); 
   docprint.document.open(); 
   docprint.document.write('<link rel="stylesheet" type="text/css" href="http://localhost:55200/styles/style.css" />'); 
   docprint.document.write('<html><head><title>DESTINYCONNECT - A POWERFUL NETWORK - A BEAUTIFUL LIFE</title>'); 
   docprint.document.write('</head><body onLoad="self.print()"><span><br><img src="http://localhost:55200/images/ndalo_logo_print.gif" /><br><br></span><center>');          
   docprint.document.write(content_vlue);          
   docprint.document.write('</center></body></html>'); 
   docprint.document.close(); 
   docprint.focus(); 
}

function ConfirmCreate(){ 
  if (confirm("NOTE: While we welcome you to create a FREE business profile on DestinyConnect, please note that in order to register your business, you need to either own that business or be directly responsible for that company's corporate communications. Employees of a business may not create a profile on behalf of that business without the express permission of the business owner or management team. Would you like to proceed with creating a business profile?")==true) 
    return true; 
  else 
    return false; 
}

function bookmarksite(title,url){
      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 CheckUncheck(theCheckBox)
{
    if (theCheckBox == 'chkBlogPost1')
    {
        this.document.getElementById('chkBlogPost2').checked = false;
    }
    else if (theCheckBox == 'chkBlogPost2')
    {
        this.document.getElementById('chkBlogPost1').checked = false;
    }
    
    if (theCheckBox == 'chkForumPost1')
    {
        this.document.getElementById('chkForumPost2').checked = false;
    }
    else if (theCheckBox == 'chkForumPost2')
    {
        this.document.getElementById('chkForumPost1').checked = false;
    }
    
    if (theCheckBox == 'chkArticleComments1')
    {
        this.document.getElementById('chkArticleComments2').checked = false;
    }
    else if (theCheckBox == 'chkArticleComments2')
    {
        this.document.getElementById('chkArticleComments1').checked = false;
    }
    
    if (theCheckBox == 'chkVideoComments1')
    {
        this.document.getElementById('chkVideoComments2').checked = false;
    }
    else if (theCheckBox == 'chkVideoComments2')
    {
        this.document.getElementById('chkVideoComments1').checked = false;
    }
    
    if (theCheckBox == 'chkPersProUp1')
    {
        this.document.getElementById('chkPersProUp2').checked = false;
    }
    else if (theCheckBox == 'chkPersProUp2')
    {
        this.document.getElementById('chkPersProUp1').checked = false;
    }
    
    if (theCheckBox == 'chkBusProUp1')
    {
        this.document.getElementById('chkBusProUp2').checked = false;
    }
    else if (theCheckBox == 'chkBusProUp2')
    {
        this.document.getElementById('chkBusProUp1').checked = false;
    }
    
    if (theCheckBox == 'chkConnMade1')
    {
        this.document.getElementById('chkConnMade2').checked = false;
    }
    else if (theCheckBox == 'chkConnMade2')
    {
        this.document.getElementById('chkConnMade1').checked = false;
    }
    
    if (theCheckBox == 'chkQA1')
    {
        this.document.getElementById('chkQA2').checked = false;
    }
    else if (theCheckBox == 'chkQA2')
    {
        this.document.getElementById('chkQA1').checked = false;
    }
    
    if (theCheckBox == 'chkImagesLoaded1')
    {
        this.document.getElementById('chkImagesLoaded2').checked = false;
    }
    else if (theCheckBox == 'chkImagesLoaded2')
    {
        this.document.getElementById('chkImagesLoaded1').checked = false;
    }
    
    if (theCheckBox == 'chkShowFriends1')
    {
        this.document.getElementById('chkShowFriends2').checked = false;
    }
    else if (theCheckBox == 'chkShowFriends2')
    {
        this.document.getElementById('chkShowFriends1').checked = false;
    }
}

function clearStatusText()
{
    document.getElementById('txtStatus').value = '';
}

function setStatusText()
{
    if( document.getElementById('txtStatus').value == '')
    {
        document.getElementById('txtStatus').value = 'Tell your network what you are doing';
    }
}

function LaunchSlideshow(page,id)
{
    //the type will be the same name as the page to load
    window.open('/slideshow/'+page+'.aspx?id='+id, '_blank', 'resizable=1,width=765,height=650');
}

function counterUpdate(opt_countedTextBox, opt_countBody, opt_maxSize) {
        
    var countedTextBox = opt_countedTextBox ? opt_countedTextBox : "sendForm_Message";
    var countBody = opt_countBody ? opt_countBody : "count";
    var maxSize = opt_maxSize ? opt_maxSize : 500;

    if(typeof(countedTextBox) == "object")
        var field = countedTextBox;
    else
        var field = document.getElementById(countedTextBox);

    if (field && field.value.length >= maxSize) {
            field.value = field.value.substring(0, maxSize);
    }
    var txtField = document.getElementById(countBody);
    
    if (txtField)  
        txtField.innerHTML = maxSize - field.value.length;
        
}

function clearValue(obj){
    if(obj.value == "write message..." || obj.value == "Search for groups")
        obj.value = "";
}

function setDefaultValue(obj){

    if(obj.value == "")
        obj.value = "write message...";
}

function setDefaultSearch(obj){
    if(obj.value == "")
        obj.value = "Search for groups";
}


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];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

