// JavaScript Document
function makecomment(title,urlid,back_link,mantab,subtab){
   var cookie = getCookie('uid')
	if(getCookie('uid') ){
			AjaxRequest.get( 
			{ 
			'url':WEB_ROOT+"comments.php?urlid="+urlid+'&back_link='+encodeURIComponent(back_link)+'&mantab='+mantab+'&subtab='+subtab,
			'onLoading':function(req){$('maincontainer').innerHTML='<img src='+WEB_ROOT+'images/loading.gif>  Requesting content...'},
			'onSuccess':function(req){ 
			$('maincontainer').innerHTML=req.responseText;
				var containertimer=$('commentlisting')
				var timerdiv=containertimer.getElementsByTagName("div")
				for(var x=0; x< timerdiv.length; x++){ 
					if(timerdiv[x].className =='parenttimer'){
						var addtime=timerdiv[x].getAttribute("addtime")
						var commentidarr=timerdiv[x].getAttribute("id")
						var commentid = commentidarr.trim(",",0).split('_')
						//alert(commentid[1]+"show"+addtime)
							var varexe=commentid[1] 
							varexe =  new PeriodicalExecuter( new Function("showAlert('"+commentid[1]+"','"+addtime+"',"+varexe+")"), 1 );
						}
				}
			},
			'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
			} 
			);
		}else{
  	parent.location.href=WEB_ROOT +"comment/"+urlid+"/"+title+"/";
	}
	return false;
}
function showAlert(id,interval,varexe)
{ 
	container='changer_'+id
	interval=180-interval
	this.counter = this.counter ? this.counter - 1 :interval;
	$(container).value =this.counter
	if(this.counter==0){
				div3='commenttimerdiv_'+id
				div1='commentnormaldiv_'+id
				$(div3).style.display='none'
				$(div1).style.display='inline'
		 }
}
function updater(updater,interval){
	
	var varexe='pe'+updater 
	if (varexe) varexe.stop();
	varexe =  new PeriodicalExecuter( new Function("showAlert('"+updater+"','"+interval+"')"), 1 );
	}
function showhelpinfo(parentid){
		var topmenu=$("informationlishow")
		var ulist=topmenu.getElementsByTagName("li")
		for(var x=0; x< ulist.length; x++){
			ulistlink=ulist[x].getElementsByTagName("a")[0]
			ulistlink.className="";
			
			}
		ulistlink=$('li_'+parentid).getElementsByTagName("a")[0];
		ulistlink.className="selected";

		AjaxRequest.get( 
		{ 
		'url':WEB_ROOT+'ajax_st.php?call=bookmarkinformation&parentid='+parentid,
		'onLoading':function(req){$('bookmarkletnformationdiv').innerHTML='<img src='+WEB_ROOT+'images/loading.gif /> Requesting content...'},
		'onSuccess':function(req){ 
		new Effect.ScrollTo('bookmarkletnformationdiv');
		$('bookmarkletnformationdiv').innerHTML=req.responseText
		},
		'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
		} 
		);
}
function OnlyNumber(i,maxvalue) {
	
	if(i.value.length>0) {
		i.value = i.value.replace(/[^\d]+/g, ''); 
	}
	if(i.value > parseInt(maxvalue) ){
			i.value = parseInt(maxvalue); 
	}
}
function list_of_starter(url_id,back_link,mantab,subtab){
	new Effect.ScrollTo('ScrollTop');
	clicklink_secont(mantab,subtab,WEB_ROOT+'list_of_starters.php?url_id='+url_id+'&back_link='+back_link+'&mantab='+mantab+'&subtab='+subtab)
}
function QuickAddLink(url_id,back_link){
	var cookie = getCookie('uid')
	var container='publickhotlinkrecord_'+url_id
		if(getCookie('uid')){
					var urlval=WEB_ROOT+'ajax_st.php?call=AddQuickLink&urlid='+url_id+'&back_link='+back_link;
					AjaxRequest.get( 
								{ 
								'url':urlval,
								'onLoading':function(req){$('maincontainer').innerHTML='<img src='+WEB_ROOT+'images/loading.gif /> Requesting content...'},
								'onSuccess':function(req){
									
								new Ajax.Updater('maincontainer', back_link, {onLoading:function(request){}, onComplete:function(request){}})
								},
								'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
								} 
								);
	}else{
	alert('You can not add links without login')
	}
}
function PublickAddlink(url_id,back_link,mantab,subtab)
{
		if(getCookie("uid"))
		{
				clicklink_sidetab('MyCategories','treeviewmanage','my_tree_view_manage.php');
				clicklink_secont('addnewlink','',WEB_ROOT+'editlink.php?urlid='+url_id+'&addtype=insert'+'&back_link='+encodeURIComponent(back_link)+'&mantab='+mantab+'&subtab='+subtab);
		}
		else
		{
			alert('You can not add links without login')
		}
}
function go_back(url,mantab,subtab)
{
	new Effect.ScrollTo('ScrollTop');
	clicklink_secont(mantab,subtab,url)
}
function Pagging(mantab,subtab,self,page,orderby,ascdesc)
{ 
	if(page=='0')
	{
		if($F('Topnumber')!='###')
		{
			if($F('Topnumber')=='')
			{
				PAGES = 1 * 1 ;
			}
			else
				PAGES = $F('Topnumber') * 1;
	    }
	}
	else
	{
		PAGES=page;
	}
	if(isNaN(PAGES) == false)
	{
		PAGE = PAGES;
		if (PAGE < 1) PAGE = 1;
		new Effect.ScrollTo('ScrollTop');
		if(mantab!='')
		{
			clicklink_secont(mantab,subtab,self+'?page='+PAGES+'&orderby='+orderby+'&ascdesc='+ascdesc)
		}
	}
	return false;
}
function category_orderby(mantab,subtab,self, page,orderby,ascdesc)
{ 
	if(page=='0')
	{		
		if($F('Topnumber')!='###')
		{
			if($F('Topnumber')=='')
			{
				PAGES = 1 * 1 ;
			}
			else
				PAGES = $F('Topnumber') * 1;
	    }
		
	}
	else
	{
		PAGES=page;
	}
	if(isNaN(PAGES) == false)
	{
		PAGE = PAGES;
		if (PAGE < 1) PAGE = 1;
		new Effect.ScrollTo('ScrollTop');
		if(mantab!='')
		{
			clicklink_sidetab(mantab,subtab,self+'?page='+PAGES+'&orderby='+orderby+'&ascdesc='+ascdesc)
		}
	}
	return;
}

function starter_description(container1,container2)
{
	var dDate=new Date();
	dDate.setTime(dDate.getTime());
	var expires_date = new Date( dDate.getTime() + 60*60*1000 );
	setCookie(container2,'display',expires_date);
	new Effect.Fade($(container1))
	Element.show($(container2))
}

/****************************************************Friend Function ***************************************/
function friend_search(){
	if( $F('txtsearchfriend').length <= 2 ) 
		{         if( $F('txtsearchfriend').length <= 0 )
					$('showhintsearchfriend').innerHTML="<strong>Please enter username, email address, or name:<strong>"
					else
					$('showhintsearchfriend').innerHTML="<strong>Search text should not be less than 3 character<strong>"
					
					new Effect.Highlight('txtsearchfriend');
					new Effect.Highlight('showhintsearchfriend');
			   return false
		 }
		AjaxRequest.get( 
				{ 
				'url':WEB_ROOT+'friendsearchresult.php?searchtext='+encodeURIComponent($F('txtsearchfriend')),
				'onLoading':function(req){$('showsearchresult').innerHTML='<img src='+WEB_ROOT+'images/loading.gif /> Requesting content...'},
				'onSuccess':function(req)
				{
							$('showsearchresult').innerHTML=req.responseText
						},
				'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
				} 
				);  
}

function add_friend(fri_id){
	AjaxRequest.get( 
				{ 
				'url':WEB_ROOT+'ajax_st.php?call=addfriend&friend_id='+encodeURIComponent(fri_id),
				'onLoading':function(req){$('friendshints').innerHTML=loadstatustext},
				'onSuccess':function(req){
					$('friendshints').innerHTML="You have Successfully added <strong>"+fri_id+"</strong> in your friend list"
					new Effect.Highlight('friendshints');
					
					var Layer1=fri_id+'_addremove1';
					var Layer2=fri_id+'_addremove2';
					if($(Layer1).style.display=="none")
						{
							$(Layer1).style.display="inline"
							$(Layer2).style.display="none"
						}
						else
						{
							$(Layer1).style.display="none"
							$(Layer2).style.display="inline"
						}
						new Ajax.Updater('friends', 'mf_ff_ff.php', {onLoading:function(request){$('friends').innerHTML='<img src=images/loading.gif>'}, onComplete:function(request){}})
					},
				'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
				} 
				);  
}
function push_link_friend1(email){
	if( $F('textemailtopushlink').length <= 0 ){
		$('textemailtopushlink').value = email
		}else{
			var FindEmail=$('textemailtopushlink').value;
			var FindEmail_array=FindEmail.split(",");
			var i=0;
			var textemail='';
			while (i < FindEmail_array.length)
			 {
				  if(FindEmail_array[i] === email){
					  alert(FindEmail_array[i])
					}else{
						textemail = textemail+','+FindEmail_array[i]
					}
			  i+=1;
			  }
				$('textemailtopushlink').value=textemail;
			}
}
function add_remove_tags(tags){
	
	if( $F('urltags').length <= 0 ){
		$('urltags').value = tags
		}else{
			var FindTags=$('urltags').value;
			var FindTags_array=FindTags.split(",");
			var i=0;
			var texttags='';
			var flag=false;
			while (i < FindTags_array.length)
			 {    if(FindTags_array[i] == tags){
					  texttags = texttags;
					  flag=true;
					}else{
						texttags = texttags+','+FindTags_array[i]
					}
			  i+=1;
			  }
				if(flag){
					$('urltags').value=texttags.trim(",",0)
					}else{
					$('urltags').value=(texttags+','+tags).trim(",",0)
					}
				}
}
function push_link_friend(email){
	if( $F('textemailtopushlink').length <= 0 ){
		$('pushlinkhint').innerHTML=""
		$('textemailtopushlink').value = email
		$('mutualfriendimage_'+email).src='images/minus_btn.gif'
		}else{
			var FindEmail=$('textemailtopushlink').value;
			$('pushlinkhint').innerHTML=""
			var FindEmail_array=FindEmail.split(",");
			var i=0;
			var textemail='';
			var flag=false;
			while (i < FindEmail_array.length)
			 {    if(FindEmail_array[i] == email){
					  textemail = textemail;
					  flag=true;
					}else{
						textemail = textemail+','+FindEmail_array[i]
					}
			  i+=1;
			  }
				if(flag){
					$('textemailtopushlink').value=textemail.trim(",",0)
					$('mutualfriendimage_'+email).src='images/symbol8.gif'
					}else{
					$('textemailtopushlink').value=(textemail+','+email).trim(",",0)
					$('mutualfriendimage_'+email).src='images/minus_btn.gif'
					
					}
				}

}
function emaifriend(urlid){
if(( $F('textemailtopushlink').length <= 0 ) && ($F('addnewStartAidFriends').length <= 0) ){
	$('pushlinkhint').innerHTML='You Must select mutual friends or manually enter email address of your friends'
//new Effect.Highlight('textemailtopushlink');
//new Effect.Highlight('addnewStartAidFriends');
new Effect.Highlight('pushlinkhint');
}else{
	AjaxRequest.get( 
		{ 
		'url':WEB_ROOT+'ajax_st.php?call=sendmailpushlink&friend_username='+encodeURIComponent($F('textemailtopushlink'))+'&friend_id='+encodeURIComponent($F('addnewStartAidFriends'))+'&urlid='+urlid,
		'onLoading':function(req){$('showresult').innerHTML='<img src='+WEB_ROOT+'images/loading.gif /> Requesting content...'},
		'onSuccess':function(req){
			$('showresult').innerHTML = ""
			var b = req.responseText.trim(",",0)
			temp = b.split('=');
			var containt=''
			validcheckusername = temp[2].trim(",",0).split('-')
			validuser = validcheckusername[1].trim(",",0).split(',')
			if(validcheckusername[1].trim(",",0)!=''){
				containt += "<ul  style='margin-left:20px;'><strong>your request has been forwarded to following users:</strong>"
				var i=0;
				while (i < validuser.length){
					containt +="<li >"+validuser[i]+"</li>"
					i=i+1
				}
				containt += "</ul>" ;
			}
			validcheckemail = temp[1].trim(",",0).split('-')
			validemail = validcheckemail[1].trim(",",0).split(',')
			if(validcheckemail[1].trim(",",0)!=''){
				containt += "<ul style='margin-left:20px;'><strong>your request has been forwarded to following email:</strong>"
				var i=0;
				while (i < validemail.length)
				{
					containt += "<li>" + validemail[i] + "</li>" ;
					i = i + 1 ;
				}
				containt += "</ul>"
			}
			invalidcheckemail = temp[0].trim(",",0).split('-')
			invalidemail = invalidcheckemail[1].trim(",",0).split(',')
			if(invalidcheckemail[1].trim(",",0)!=''){
			containt += "<ul  style='margin-left:20px;'><strong> we are unable to process your request at :</strong>"
			var i=0;
			
			while (i < invalidemail.length){
			containt +="<li  >"+invalidemail[i]+"</li>"
			i=i+1
			}
			containt += "</ul>"
			}
			$('showresult').innerHTML = containt+'<br>'
			},
		'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
		} 
		);
}
}
function RemovePushedLink(pushedid,container){
AjaxRequest.get( 
		{ 
		'url':WEB_ROOT+'ajax_st.php?call=removepushlink&pushedid='+pushedid,
		'onLoading':function(req){new Effect.Opacity(container, {duration:0.2, from:1.0, to:0.5});},
		'onSuccess':function(req){
			if(req.responseText=='hideicon'){
				}
			 //Element.remove(container,{duration:0.5})	
			  new Effect.SlideUp(container); 
			//new Effect.Fade($(container))
			//$(container).innerHTML = ''
			},
		'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
		} 
		);
}
/****************************************************Comments *************************************************************/
function add_comments(urlid,title,back_link,mantab,subtab){
	if($F('urldesc').length<=0)
	{
		$('commenthint').innerHTML="<strong>Comment Description is required !</strong>";
		new Effect.Highlight('commenthint')
		new Effect.Highlight('urldesc')
		return false;
		
	}else if($F('imgcode').length<=0)
	{
		$('commenthint').innerHTML="<strong>Image code is required !</strong>";
		new Effect.Highlight('commenthint')
		new Effect.Highlight('imgcode')
		return false;
	}else if( $F('imgcode') != $F('imgcodeval') ){
		$('commenthint').innerHTML="<strong>Image code does not match !</strong>";
		new Effect.Highlight('commenthint')
		return false;
	}
	
		AjaxRequest.post( 
		{ 
		'url':WEB_ROOT+'ajax_st.php?call=addcomments&urlid='+urlid+'&commentdescription='+$F('urldesc')+'&txtreplycommentid='+$F('txtreplycommentid'),
		'onLoading':function(req){$('commenthint').innerHTML='<img src='+WEB_ROOT+'images/loading.gif /> Requesting content...'},
		'onSuccess':function(req){
			$('commenthint').innerHTML='<strong>comment added</strong>'
			 var titlestring=title.replace(" ","_");
					AjaxRequest.get( 
					{ 
					'url':WEB_ROOT+"comments.php?urlid="+urlid+'&back_link='+encodeURIComponent(back_link)+'&mantab='+mantab+'&subtab='+subtab,
					'onLoading':function(req){$('commenthint').innerHTML='<img src='+WEB_ROOT+'images/loading.gif>  Requesting content...'},
					'onSuccess':function(req){ 
					$('maincontainer').innerHTML=req.responseText;
						var containertimer=$('commentlisting')
						var timerdiv=containertimer.getElementsByTagName("div")
						for(var x=0; x< timerdiv.length; x++){ 
							if(timerdiv[x].className =='parenttimer'){
								var addtime=timerdiv[x].getAttribute("addtime")
								var commentidarr=timerdiv[x].getAttribute("id")
								var commentid = commentidarr.trim(",",0).split('_')
								var varexe=commentid[1] 
									varexe =  new PeriodicalExecuter( new Function("showAlert('"+commentid[1]+"','"+addtime+"',"+varexe+")"), 1 );
								}
						}
					},
					'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
					} 
					);
				
			},
		'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
		} 
		);
	return false;
}
function block_usercomment(uid,username,option,urlid,friend){
	
if(getCookie("uid")){
	if(confirm('Are sure to block user')){
			AjaxRequest.post( 
		{ 
		'url':WEB_ROOT+'ajax_st.php?call=blockuser&toblock='+uid+'&fromblock='+username,
		'onLoading':function(req){},
		'onSuccess':function(req){
			
			 new Ajax.Updater('showcommentlist',WEB_ROOT+'commentlist.php?urlid='+urlid+'&countday='+option+'&friend='+friend, {onLoading:function(request){$('showcommentlist').innerHTML='<img src='+WEB_ROOT+'images/loading.gif /> Requesting content...'}, onComplete:function(request){$('showcommentlist').innerHTML=request.responseText}})
			},
		'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
		} 
		);
	}
}else{
	alert('you have to login first !')
	}


}


function updatecommentdiv(commentid){
	showdiv="timerupdatedcommentdesc_"+commentid
	hidediv="updaterupdatedcommentdesc_"+commentid
/*showdiv='commentupdater_'+commentid
hidediv='commenttimerdiv_'+commentid*/
if($(hidediv).style.display=='none'){
$(showdiv).style.display='none'
$(hidediv).style.display='inline'
}else{
$(showdiv).style.display='inline'
$(hidediv).style.display='none'
	}
	
}
function updatecomments(commentid){
showdiv="timerupdatedcommentdesc_"+commentid
hidediv="updaterupdatedcommentdesc_"+commentid
div3='commenttimerdiv_'+commentid
div1='commentnormaldiv_'+commentid
//content1='timerupdatedcommentdesc_'+commentid
content2='normalupdatedcommentdesc_'+commentid
content3='textareaupdatecomment'+commentid
commentdesc=$F('textareaupdatecomment_'+commentid)
	AjaxRequest.post( 
		{ 
		'url':WEB_ROOT+'ajax_st.php?call=updatecomments&commentid='+commentid+'&commentdescription='+encodeURIComponent(commentdesc),
		'onLoading':function(req){},
		'onSuccess':function(req){
			//$(content1).innerHTML=commentdesc
			$(content2).innerHTML=commentdesc
			//$(content3).value=commentdesc
			//alert($(content1).innerHTML)
			if(($('changer_'+commentid).value) < 180){
			$(div3).style.display='inline'
			$(hidediv).style.display='none'
			$(showdiv).style.display='inline'
			$(showdiv).innerHTML=commentdesc
			}else
			$(div1).style.display='inline'
			$(content2).innerHTML=commentdesc
			},
		'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
		} 
		);

}

function replycomments(commentid,commentuser){
$('replycommentid').style.display='inline'
$('txtreplycommentid').value=commentid
$('txtreplyusername').value=commentuser
}

function cancelreplycomments(){
$('replycommentid').style.display='none'
$('txtreplycommentid').value='0'
$('txtreplyusername').value=''
}

function commentvote(vote,id,option,urlid,friend){
	Layer1=$('positivevoteimage_'+id);
	Layer2=$('negativevoteimage_'+id);
	img1="images/vote_active.gif";
	img2="images/vote_greeen.gif";
	AjaxRequest.post( 
		{ 
		'url':WEB_ROOT+'ajax_st.php?call=updatevotecomments&commentid='+id+'&votetype='+vote,
		'onLoading':function(req){},
		'onSuccess':function(req){
			var back_link=WEB_ROOT+'commentlist.php?urlid='+urlid+'&countday='+option+'&friend='+friend
			new Ajax.Updater('showcommentlist', back_link, {onLoading:function(request){}, onComplete:function(request){}});
				if(vote=='N'){
					new Effect.Highlight( Layer1);
					new Effect.Opacity( Layer1, {duration:1.0, from:0.5, to:1.0});
					swap_image(Layer1,img1,img2)
				//$('positivevoteimage_'+id).src = WEB_ROOT+"images/vote_active.gif";
				}else{
					new Effect.Highlight( Layer2);
					new Effect.Opacity( Layer2, {duration:1.0, from:0.5, to:1.0});
					swap_image(Layer2,img1,img2)
				   //$('negativevoteimage_'+id).src = WEB_ROOT+"images/vote_greeen.gif";
				}
			},
		'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
		} 
		);
	return false;
}
 function setorderbycomment(friend,option,urlid,columnname){
		AjaxRequest.get( 
			{ 
			'url':WEB_ROOT+'commentlist.php?urlid='+urlid+'&countday='+option+'&friend='+friend,
			'onLoading':function(req){$('showcommentlist').innerHTML='<img src='+WEB_ROOT+'images/loading.gif>  Requesting content...'},
			'onSuccess':function(req){ 
			if(columnname=='comments_by_approval')
			updatesetting=option;
			else
			updatesetting=friend;
				AjaxRequest.get(
				{
				'url':WEB_ROOT+'ajax_st.php?call=viewsetting&view='+updatesetting+'&columnname='+columnname,
				'onLoading':function (request){},
				'onSuccess':function(request)
				{},
				'onError':function(request){alert('Error!\nStatusText='+request.statusText+'\nContents='+request.responseText);}
				}
				);
			$('showcommentlist').innerHTML=req.responseText;
				var containertimer=$('commentlisting')
				var timerdiv=containertimer.getElementsByTagName("div")
				for(var x=0; x< timerdiv.length; x++){ 
					if(timerdiv[x].className =='parenttimer'){
						var addtime=timerdiv[x].getAttribute("addtime")
						var commentidarr=timerdiv[x].getAttribute("id")
						var commentid = commentidarr.trim(",",0).split('_')
						//alert(commentid[1]+"show"+addtime)
							//if (varexe) varexe.stop();
							var varexe=commentid[1] 
							varexe =  new PeriodicalExecuter( new Function("showAlert('"+commentid[1]+"','"+addtime+"',"+varexe+")"), 1 );
						}
				}
			},
			'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
			} 
			);
 
 }
 function defaultcategorysetting(divid){
	AjaxRequest.get(
			{
				'url':WEB_ROOT+'ajax_st.php?call=viewsetting&view='+divid+'&columnname=default_category',
				'onLoading':function (req){$('defaultcategorysettinglodingimag').innerHTML='<img src='+WEB_ROOT+'images/loading.gif>  Requesting content...'},
				'onSuccess':function(req)
				{ $('defaultcategorysettinglodingimag').innerHTML=""
					//new Effect.ScrollTo('ScrollTop');
				},
				'onError':function(req){$('defaultcategorysettinglodingimag').innerHTML="";
				alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
		}
		);
 }
 
 /*****************************************************************************category*********************************************/
 function cat_onclick(container,containertext,imageid)
	{
		if($(container).style.display=='inline')
		{
		$(container).style.display='none';
		$(containertext).style.display='inline';
		}else{
		$(container).style.display='inline';
		$(containertext).style.display='none';
		}
	
	}
 
 
 function update_category_fav(catId,Layer,img1,img2)
{
	
	AjaxRequest.get( 
		{ 
		'url':WEB_ROOT+'ajax_st.php?call=cat_fav&catId='+catId,
		'onLoading':function(req){$('requesting_wait').innerHTML='<img src='+WEB_ROOT+'images/loading.gif>  Requesting content...'},
		'onSuccess':function(req){ 
		new Effect.Highlight( Layer);
		new Effect.Opacity( Layer, {duration:1.0, from:0.5, to:1.0});
		swap_image(Layer,img1,img2)
		$('requesting_wait').innerHTML=''
		},
		'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
		} 
		);
}
function update_category_lock(catId,Layer,img1,img2)
{ 
	AjaxRequest.get( 
		{ 
		'url':WEB_ROOT+'ajax_st.php?call=cat_loc&catId='+catId,
		'onLoading':function(req){$('requesting_wait').innerHTML='<img src='+WEB_ROOT+'images/loading.gif>  Requesting content...'},
		'onSuccess':function(req){ 
		new Effect.Highlight( Layer);
		new Effect.Opacity( Layer, {duration:1.0, from:0.5, to:1.0});
 		 swap_image(Layer,img1,img2)
		 $('requesting_wait').innerHTML=''
		},
		'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
		} 
		);
	
}
function editcategory(container,containertext,catId)
{  
AjaxRequest.get( 
		{ 
		'url':WEB_ROOT+'ajax_st.php?call=EditCategory&catId='+catId+'&textvalue='+$F("txteditCategory"+catId),
		'onLoading':function(req){$('requesting_wait').innerHTML='<img src='+WEB_ROOT+'images/loading.gif>  Requesting content...'},
		'onSuccess':function(req){
			if($(container).style.display=='inline')
			{
			$(container).style.display='none';
			$(containertext).style.display='inline';
			$('txtshowCategory'+catId).value=$F("txteditCategory"+catId)
			}else{
			$(container).style.display='inline';
			$(containertext).style.display='none';
			$('txtshowCategory'+catId).value=$F("txteditCategory"+catId)
			}
		 $('requesting_wait').innerHTML=''
		},
		'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
		} 
		);
}
function sgeditcategory(container,containertext,sgcatId)
{  
AjaxRequest.get( 
		{ 
		'url':WEB_ROOT+'ajax_st.php?call=sgEditCategory&sgcatId='+sgcatId+'&textvalue='+$F("sgtxteditCategory"+sgcatId),
		'onLoading':function(req){$('requesting_wait').innerHTML='<img src='+WEB_ROOT+'images/loading.gif>  Requesting content...'},
		'onSuccess':function(req){
			if($(container).style.display=='inline')
			{
			$(container).style.display='none';
			$(containertext).style.display='inline';
			$('sgtxtshowCategory'+sgcatId).value=$F("sgtxteditCategory"+sgcatId)
			
			}else{
			$(container).style.display='inline';
			$(containertext).style.display='none';
			$('txtshowCategory'+sgcatId).value=$F("txteditCategory"+sgcatId)
		    }
			$('requesting_wait').innerHTML=''
		},
		'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
		} 
		);
}
function deletecategory(catId)
{   if(confirm('This will also Delete all links associtated with this category !\nAre you sure to delete ')){
  
	AjaxRequest.get( 
		{ 
		'url':'ajax_st.php?call=DeleteCategory&catId='+catId,
		'onLoading':function(req){},
		'onSuccess':function(req){
			//Element.remove(container)
			//clicklink_sidetab("MyCategories","treeviewmanage",WEB_ROOT+"my_tree_view_manage.php")
			var node = req.responseXML.firstChild
			var ack = node.getAttribute('ack');
			if(ack == 'success')
			{
				$('tr_' + catId).parentNode.removeChild($('tr_' + catId))
				$('optionMain_' + catId).parentNode.removeChild($('optionMain_' + catId))
				
				repairStyle(req.responseXML);	
				clicklink_secont("mylink","ManagedLinks",WEB_ROOT+'manage_links.php?catid='+catId)
			//$('requesting_wait').innerHTML=''
			
			}
			else
			{
				alert("We are sorry. We are unable to delete this category at this time");
			}
		},
		'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
		} 
		);
    }else 
	return false;

}
function sgdeletecategory(container,catId)
{   if(confirm('This will Delete category Sub category and assocatated share group links !\n <center>Are you sure to delete <center>')){
  	AjaxRequest.get( 
		{ 
		'url':'ajax_st.php?call=sgDeleteCategory&catId='+catId,
		'onLoading':function(req){},
		'onSuccess':function(req){
			clicklink_sidetab("MyCategories","treeviewmanage",WEB_ROOT+"my_tree_view_manage.php")
			clicklink_secont("mylink","ManagedLinks",WEB_ROOT+'manage_links.php?catid='+catId)
				},
		'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
		} 
		);
    }else 
	return false;
}
function createcategory(containerid,childid,orderby,ascdesc)
{     	var childnode=$(childid)
		if(childnode.style.display == 'inline')
		{	//childnode.destroy();
			childnode.style.display='none'
		 	return false
		}
		childnode.setAttribute('style','cursor:move;')
		childnode.style.display='inline'
		var inputcat = childnode.getElementsByTagName('input')[0]
		inputcat.focus()
}
function editcategorydiv(editnode,editnodeid,nodevalue)
{  		
		Layer=$(editnode)
		if ( Layer.style.display == 'none') {
			Element.show(Layer)
			}
			var table = $('createtable')
			var input = $('txtnodevalue');
			input.value=input.value.replace(input.value, nodevalue);
			var input1 = $('txteditnodeid');
			input1.value=input1.value.replace(input1.value, editnodeid);
}
function categoryDelete(orderby,ascdesc)
{  
	
	var edtcat= $('createtable').getElementsByTagName('input')[0]
	var edtcat1= $('createtable').getElementsByTagName('input')[1]
	if(confirm('This will also Delete all links associtated with this category !\nAre you sure to delete ')){
									AjaxRequest.get( 
									{ 
									'url':'ajax_st.php?call=DeleteCategory&catId='+edtcat1.value,
									'onLoading':function(req){$('requesting_wait').innerHTML='<img src=images/loading.gif>  Requesting content...'},
									'onSuccess':function(req){
									ascdesc=(ascdesc=="ASC")?"DESC":"ASC"
									new Ajax.Updater('siadecontenar', 'my_tree_view_manage.php?orderby='+orderby+'&ascdesc='+ascdesc, {onLoading:function(request){ $('requesting_wait').innerHTML='<img src=images/loading.gif>  Requesting content...'}, onComplete:function(request){ $('requesting_wait').innerHTML='' }})
									Layer= $('editdiv')
									Element.hide(Layer)
									$('requesting_wait').innerHTML=''
									},
									'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
									} 
									);
								}else 
								return false;
}
function updateCategory(orderby,ascdesc)
{
			var edtcat= $('createtable').getElementsByTagName('input')[0]
			var edtcat1= $('createtable').getElementsByTagName('input')[1]
			
			AjaxRequest.get( 
				{ 
				'url':'ajax_st.php?call=EditCategory&catId='+edtcat1.value+'&textvalue='+edtcat.value,
				'onLoading':function(req){$('requesting_wait').innerHTML='<img src=images/loading.gif>  Requesting content...'},
				'onSuccess':function(req){
					Element.hide('createtable')
					ascdesc=(ascdesc=="ASC")?"DESC":"ASC"
					new Ajax.Updater('siadecontenar', 'my_tree_view_manage.php?orderby='+orderby+'&ascdesc='+ascdesc, {onLoading:function(request){ $('requesting_wait').innerHTML='<img src=images/loading.gif>  Requesting content...' }, onComplete:function(request){$('requesting_wait').innerHTML=''}})
					$('requesting_wait').innerHTML=''
				},
				'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
				} 
				);
}
function cancleCategory()
{
	Layer= $('editdiv')
	Element.hide(Layer)
}
 /*************************************************************************************************************************************/
 function unblockuser(touser,fromuser,layer){
	 AjaxRequest.get( 
				{ 
				'url':WEB_ROOT+'ajax_st.php?call=unblockuser&toblock='+touser+'&fromblock='+fromuser,
				'onLoading':function(req){$('loadingimage').innerHTML='<img src='+WEB_ROOT+'images/loading.gif>  Requesting content...'},
				'onSuccess':function(req){
					Element.remove(layer)
					$('loadingimage').innerHTML=""
					
				},
				'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
				} 
				);
 }
function openinmaincontainer(url){
	clicklink_secont("mylink","ManagedLinks",url)
}
function scrolltaber12(divid,orderby,ascdesc){  
if(($(divid).style.display)=="inline") return false;
		var sobj=document.getElementById('scrollertab')
		var sdivobj=sobj.getElementsByTagName("div")
		for (var k=0; k<sdivobj.length; k++){
				sdivobj[k].style.display='none'
			}
		$(divid).style.display='inline'
		AjaxRequest.get( 
			{ 
			'url':'ajax_st.php?call=CategorySetting',
			'onLoading':function(req){$('requesting_wait').innerHTML='<img src=images/loading.gif> Requesting content...'},
			'onSuccess':function(req){
				$('requesting_wait').innerHTML=''
				ascdesc=(ascdesc=="ASC")?"DESC":"ASC"
				clicklink_sidetab("MyCategories","treeviewmanage",WEB_ROOT+"my_tree_view_manage.php")
				//new Ajax.Updater('siadecontenar', 'my_tree_view_manage.php?orderby='+orderby+'&ascdesc='+ascdesc, {onLoading:function(request){$('requesting_wait').innerHTML='<img src=images/loading.gif> Requesting content...' }, onComplete:function(request){$('requesting_wait').innerHTML=''}})
				},
			'onError':function(req){
				alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
			} 
			);
	}
function scrolltaber(divid,back_link,mantab,subtab,st)
{ 
if(st=='expandable')
{
	AjaxRequest.get(
			{
				'url':WEB_ROOT+'ajax_st.php?call=viewsetting&status='+st+'&view='+divid+'&columnname=expandable ',
				'onLoading':function (req){},
				'onSuccess':function(req)
				{ new Effect.ScrollTo('ScrollTop');
				 clicklink_sidetab(mantab,subtab,back_link)
				},
				'onError':function(req){alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
		}
		);
}else{
return;
}
}

/*****************************************************************************************************************************/
function updatesearchoption(value,column)
{
        var temp = value.split('_'); 
		AjaxRequest.get({
				'url':WEB_ROOT+'ajax_st.php?call=viewsetting&view='+temp[1]+'&columnname='+column,
				'onLoading':function (req){},
				'onSuccess':function(req){
					$('searchoptionimage').src=WEB_ROOT+'searchengineimages/'+temp[2];
	
					},
				'onError':function(req){alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
			 });
	return false;
}
function searchoption(username,usertype)
{
	var searchtext=$F('searchtxt')
	if( $F('searchtxt')== "Search Google" ||  $F('searchtxt')== "")
	{
		alert("Please provide Search Keyword.");
		$('searchtxt').focus();
		$('searchtxt').value=""
		return false;
	 }
	
	var temp = $F('searchname').split('_'); 
	$('searchoptionimage').src=WEB_ROOT+'searchengineimages/'+temp[2];
	if(temp[0] =='StartAidpublictag')
   {
	  clicklink_secont('Searchstartaid','',WEB_ROOT+'search_startaid.php?searchtext='+searchtext+'&type=publictag&mainuser='+username+'&usertype='+usertype)
   	  return false;
   }
   else if(temp[0]=='StartAidpubliclink')
   {
	  clicklink_secont('Searchstartaid','',WEB_ROOT+'search_startaid.php?searchtext='+searchtext+'&type=publiclink&mainuser='+username+'&usertype='+usertype)
   	  return false;
   }
   else if(temp[0]=='StartAidmytag')
   {
	  clicklink_secont('Searchstartaid','',WEB_ROOT+'search_startaid.php?searchtext='+searchtext+'&type=mytag&mainuser='+username+'&usertype='+usertype)
   	  return false;
   }
   else if(temp[0]=='StartAidmylink')
   {
	  clicklink_secont('Searchstartaid','',WEB_ROOT+'search_startaid.php?searchtext='+searchtext+'&type=mylink&mainuser='+username+'&usertype='+usertype)
   		return false;
   }
   else if(temp[0]!='StartAid')
   {
	 if($F('opensearch')=='N')
		{
			window.open(temp[0]+encodeURIComponent(searchtext) );
		}
		else
		{
			parent.location.href=temp[0]+encodeURIComponent(searchtext);
		}
		return false;
   }
	 return false;
}

function asignDragAndDrop(Layer,dragclass,columnName)
{
	var dobj=document.getElementById(Layer)
	if(dobj==null)return false;
   var windowIdArray = dobj.getElementsByTagName("img")
        for(i=0;i<windowIdArray.length;i++)
         {
           var windowId = windowIdArray[i];
           //set to be draggable
           new Draggable(windowId,{revert:true,overlap:'horizontal'});
           //set to be droppable
		   Droppables.add(windowId, {accept:[dragclass],overlap:'horizontal', hoverclass:'tree',onDrop: function(element, dropon, event)
            {
				
			   var columnupdateby=$(dropon.id).id.split("_");
			   AjaxRequest.get(
				{
					'url':WEB_ROOT+'ajax_st.php?call=viewsetting&view='+columnupdateby[1]+'&columnname='+columnName,
					'onLoading':function (req){},
					'onSuccess':function(req)
					{ 
						//new Effect.ScrollTo('ScrollTop');
						var content1 = $(element.id).src;
				        var content2 = $(dropon.id).src;
						class1=$(element.id).className
						$(dropon.id).src = content1;
						$(element.id).src = content2;
						$(element.id).className="";
						$(dropon.id).className=class1;
						var imobj=$("image_"+$(dropon.id).id)
						var imobjflicker=$("image_"+$(element.id).id)
						var srs=imobj.src
						var srsflicker=imobjflicker.src
						var str=srs.substr(imobj.src.length-8,imobj.getAttribute('src').length)
						var strflicker=srsflicker.substr(imobjflicker.src.length-15,imobjflicker.getAttribute('src').length)
						
						switch (str) {
						case 'btn2.gif':       imobj.src=WEB_ROOT+'images/btn2_active.gif';  break;
						case 'btn3.gif':       imobj.src=WEB_ROOT+'images/btn3_active.gif';  break;
						case 'btn4.gif':       imobj.src=WEB_ROOT+'images/btn4_active.gif'; break;
						case 'btn5.gif':       imobj.src=WEB_ROOT+'images/btn5_active.gif'; break;
						case 'btn6.gif':       imobj.src=WEB_ROOT+'images/btn6_active.gif'; break;
						default:       break;
						}
						
						switch (strflicker) {
						case 'btn2_active.gif':       imobjflicker.src=WEB_ROOT+'images/btn2.gif';  break;
						case 'btn3_active.gif':       imobjflicker.src=WEB_ROOT+'images/btn3.gif';  break;
						case 'btn4_active.gif':       imobjflicker.src=WEB_ROOT+'images/btn4.gif'; break;
						case 'btn5_active.gif':       imobjflicker.src=WEB_ROOT+'images/btn5.gif'; break;
						case 'btn6_active.gif':       imobjflicker.src=WEB_ROOT+'images/btn6.gif'; break;
						default:       break;
						}
					},
					'onError':function(req){alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
			}
			);
            }
			});
    }
}
 function tabDragAndDrop(Layer,dragclass,columnName)
{
	
	var dobj=document.getElementById(Layer)
	if(dobj==null)return false;
   var windowIdArray = dobj.getElementsByTagName("img")
        for(i=0;i<windowIdArray.length;i++)
         {
           var windowId = windowIdArray[i];
           //set to be draggable
           new Draggable(windowId,{revert:true,overlap:'horizontal'});
           //set to be droppable
		   Droppables.add(windowId, {accept:[dragclass],overlap:'horizontal', hoverclass:'tree',onDrop: function(element, dropon, event)
            {
				var columnupdateby=$(dropon.id).id.split("_");
					AjaxRequest.get(
				{
					'url':WEB_ROOT+'ajax_st.php?call=viewsetting&view='+columnupdateby[1]+'&columnname='+columnName,
					'onLoading':function (req){$(loadedobjects).innerHTML='<img src='+WEB_ROOT+'images/loading.gif /> Requesting content...'},
					'onSuccess':function(req)
					{ 
						//new Effect.ScrollTo('ScrollTop');
						var content1 = $(element.id).src;
						var content2 = $(dropon.id).src;
						class1=$(element.id).className
						$(dropon.id).src = content1;
						$(element.id).src = content2;
						$(element.id).className="";
						$(dropon.id).className=class1;
						var imobjflicker=$("image_"+$(dropon.id).id)
						var imobj=$("image_"+$(element.id).id)
						var srs=imobj.src
						var srsflicker=imobjflicker.src
						var str=srs.substr(imobj.src.length-19,imobj.getAttribute('src').length)
						var strflicker=srsflicker.substr(imobjflicker.src.length-21,imobjflicker.getAttribute('src').length)

												
						
						switch (str) {
						case 'my_links_active.gif':       imobj.src=WEB_ROOT+'images/my_links_inactive.gif';  break;
						case 'pu_links_active.gif':       imobj.src=WEB_ROOT+'images/pu_links_inactive.gif';  break;
						case 'pub_tags_active.gif':       imobj.src=WEB_ROOT+'images/pub_tags_inactive.gif';  break;
						case 'my_categ_active.gif':       imobj.src=WEB_ROOT+'images/my_categ_inactive.gif';  break;
						case 'my_tagss_active.gif':       imobj.src=WEB_ROOT+'images/my_tagss_inactive.gif';  break;
						case 'li_popul_active.gif':       imobj.src=WEB_ROOT+'images/li_popul_inactive.gif';  break;
						case 'li_readd_active.gif':       imobj.src=WEB_ROOT+'images/li_readd_inactive.gif';  break;
						case 'li_reuse_active.gif':       imobj.src=WEB_ROOT+'images/li_reuse_inactive.gif';  break;
						case 'hot_tree_active.gif':       imobj.src=WEB_ROOT+'images/hot_tree_inactive.gif';  break;
						case 'hot_clou_active.gif':       imobj.src=WEB_ROOT+'images/hot_clou_inactive.gif';  break;
						case 'ful_tree_active.gif':       imobj.src=WEB_ROOT+'images/ful_tree_inactive.gif';  break;
						case 'fl_cloud_active.gif':       imobj.src=WEB_ROOT+'images/fl_cloud_inactive.gif';  break;
						case 'cloud_vw_active.gif':       imobj.src=WEB_ROOT+'images/cloud_vw_inactive.gif';  break;
						case 'tree_vew_active.gif':       imobj.src=WEB_ROOT+'images/tree_vew_inactive.gif';  break;
						case 'list_vew_active.gif':       imobj.src=WEB_ROOT+'images/list_vew_inactive.gif';  break;
						default:       break;
						}
						
						switch (strflicker) {
						case 'pu_links_inactive.gif':       imobjflicker.src=WEB_ROOT+'images/pu_links_active.gif';  break;
						case 'my_links_inactive.gif':       imobjflicker.src=WEB_ROOT+'images/my_links_active.gif';  break;
						case 'pub_tags_inactive.gif':       imobjflicker.src=WEB_ROOT+'images/pub_tags_active.gif';  break;
						case 'my_categ_inactive.gif':       imobjflicker.src=WEB_ROOT+'images/my_categ_active.gif';  break;
						case 'my_tagss_inactive.gif':       imobjflicker.src=WEB_ROOT+'images/my_tagss_active.gif';  break;
						case 'li_popul_inactive.gif':       imobjflicker.src=WEB_ROOT+'images/li_popul_active.gif';  break;
						case 'li_readd_inactive.gif':       imobjflicker.src=WEB_ROOT+'images/li_readd_active.gif';  break;
						case 'li_reuse_inactive.gif':       imobjflicker.src=WEB_ROOT+'images/li_reuse_active.gif';  break;
						case 'hot_tree_inactive.gif':       imobjflicker.src=WEB_ROOT+'images/hot_tree_active.gif';  break;
						case 'hot_clou_inactive.gif':       imobjflicker.src=WEB_ROOT+'images/hot_clou_active.gif';  break;
						case 'ful_tree_inactive.gif':       imobjflicker.src=WEB_ROOT+'images/ful_tree_active.gif';  break;
						case 'fl_cloud_inactive.gif':      imobjflicker.src=WEB_ROOT+'images/fl_cloud_active.gif';  break;
						case 'tree_vew_inactive.gif':      imobjflicker.src=WEB_ROOT+'images/tree_vew_active.gif';  break;
						case 'cloud_vw_inactive.gif':      imobjflicker.src=WEB_ROOT+'images/cloud_vw_active.gif';  break;
						case 'list_vew_inactive.gif':      imobjflicker.src=WEB_ROOT+'images/list_vew_active.gif';  break;
						default:       break;
						}
						
						
					},
					'onError':function(req){alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
			});
            }
			});
    }
}

function makeDraggableLink()
{
	
	var dobj = document.getElementById("page")
	
	if(dobj == null)
	{
		return false;
	}
	
	var listCookie = getCookie('linkView');
	
	if(listCookie == 'thumb')
	{
		/*
		if (document.all) 
	 	{ 
			Droppables.drops = []; 
		}
		var SortableLists = {
			lists: ["list"],
			
			updated: function (list) {
										var myAjax = new Ajax.Request(
																	   'ajax_st.php?call=sortUrl&',
																	   {
																		 method: 'post',
																		 postBody: Sortable.serialize('list')																		 
																	   });
			},
			
			createSortables: function (event) {
				var lists = SortableLists.lists;
				lists.each(function (id) {
					Sortable.create(id, {
						dropOnEmpty: true,
						containment: lists,
						constraint: false,
						tag: "div", 
						onUpdate: SortableLists.updated,
						tree:true
					});
				});
			}
		};
		
		try{
			SortableLists.createSortables();	
		}
		catch(e){
			//alert("Not done");
		}
		*/
		
		if (document.all) 
	 	{ 
			Droppables.drops = []; 
		}
		
		alldobj =dobj.getElementsByTagName("div");	
		for(var k=0; k < alldobj.length; k++ ){
			//alldobj[k].style.border = "2px solid black";
			if(alldobj[k].className== "lineitem" ){
	             var pos 	= alldobj[k].id.indexOf('_');
				 var dpId 	= alldobj[k].id.substr(pos + 1);
				 
				 new Draggable(alldobj[k],{revert:true,overlap:'horizontal',scroll:window});
	             
				 Droppables.add('insertBefore_' + dpId , {accept:["lineitem"],overlap:'horizontal', hoverclass:'lineItemTdExt',onDrop:function(element, dropon, event){
	             																												var pos 	= element.id.indexOf('_');
				 																												var dgId 	= element.id.substr(pos + 1);
	             																												
				 																												pos 		= dropon.id.indexOf('_');
				 																												var dpId 	= dropon.id.substr(pos + 1);
	             																												
				 																												AjaxRequest.get({
																																					'url'		:WEB_ROOT+'ajax_st.php?call=insertBefore&dragid=' + dgId + '&dropid=' + dpId ,
																																					'onLoading'	:function (req){ $(loadedobjects).innerHTML='<img src='+WEB_ROOT+'images/loading.gif /> Requesting content...' },
																																					'onSuccess'	:function(req){ 
																																						var ack = req.responseXML.firstChild.getAttribute('ack');
																																						var catId = req.responseXML.firstChild.getAttribute('id');
																																						if(ack == 'success'){
																																							openinmaincontainer('manage_links.php?catid=' + catId);
																																						}
																																						else
																																						{
																																							alert("Your request cannot be entertained at the moment");
																																						}
																																					 },
																																					'onError':function(req){alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
																																				});			
	             																								
	         																												}});
				 
	         	
	         	Droppables.add(alldobj[k], {accept:["lineitem"],overlap:'horizontal', scroll:window,hoverclass:'tree',onDrop: function(element, dropon, event){
								if($("txtorderby").value == 'manualorder' ){
								var dragid=$(element.id).id.split("_");
								var dropid=$(dropon.id).id.split("_");
								var statusid=$("txtorderbystatus").value;
								AjaxRequest.get({
										'url':WEB_ROOT+'ajax_st.php?call=manualorder&dragid='+dragid[1]+'&dropid='+dropid[1]+'&statusid='+statusid,
										'onLoading':function (req){ $(loadedobjects).innerHTML='<img src='+WEB_ROOT+'images/loading.gif /> Requesting content...' },
										'onSuccess':function(req){ 
											var content1 = $(element.id).innerHTML;
											var content2 = $(dropon.id).innerHTML;          
											$(dropon.id).innerHTML = content1;
											$(element.id).innerHTML = content2;
											$(loadedobjects).innerHTML=''
											//alert("done");
										 },
										'onError':function(req){alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
									});
							   }else{
									var content1 = $(element.id).innerHTML;
									var content2 = $(dropon.id).innerHTML;          
									$(dropon.id).innerHTML = content1;
									$(element.id).innerHTML = content2;
								}
								var temp = $(element.id).id;
								$(element.id).id = $(dropon.id).id;
								$(dropon.id).id = temp ;
				 } } );
				}
			}
			
		//alert("fg");
	}
	else
	{
		//var dragid=$(element.id).id.split("_");
		//var dropid=$(dropon.id).id.split("_");
		
		if (document.all) 
	 	{ 
			Droppables.drops = []; 
		}
		var SortableLists = {
			lists: ["list"],
			
			updated: function (list) {	//alert(list.lastChild.value );
										var myAjax = new Ajax.Request(
																	   'ajax_st.php?call=sortUrl&',
																	   {
																		 method: 'post',
																		 postBody: Sortable.serialize('list')																		 
																	   });
			},
			
			createSortables: function (event) {
				var lists = SortableLists.lists;
				lists.each(function (id) {
					Sortable.create(id, {
						scroll		: window,
						dropOnEmpty	: true,
						containment	: lists,
						constraint	: false,
						onUpdate	: SortableLists.updated,
						tree		:true
					});
				});
			}
		};
		
		try{
			SortableLists.createSortables();	
		}
		catch(e){
			//alert("Not done" + e.message);
		}
		}
 }
var box = true;

function createTree(node)
{
	var result = detectRowsInTable(node.id);
	//alert(result);
	if(result)
	{
		
		var tBodyNode1 = node.firstChild; 
		//alert(tBodyNode1.childNodes.length);
		var trNodes = tBodyNode1.childNodes;
		
		for(var i = 0; i < trNodes.length ; i++)
		{			
			if(trNodes[i].nodeType == 1)
			{
				//alert(trNodes[i].tagName);
				
				if(trNodes[i].tagName == "TR")
				{
					//alert("Node Id:" + trNodes[i].id )
					/* cropping the id number */
					var nodeId = trNodes[i].id.substr(trNodes[i].id.indexOf('_') + 1) ;
					YAHOO.log("Node Id croped:" + nodeId);
					
					/* Call this function recursively */
					YAHOO.log("Calling the function again" , 'error');
					createTree($('par_' + nodeId));
					
					
					
					/* Adding 2 new droppables */
						
					try
					{
						Droppables.add("upper_" + nodeId, {accept:["Main"] , hoverclass: "hover1",	overlap : 'vertical', onDrop: function(draggable , droppable , event) { droppedInBetweenNode(draggable.id , droppable.id) }, onHover: function(draggable , droppable , overlap){ hoverInBetween(draggable , droppable , overlap)}});
						YAHOO.log("New Droppable created: upper_" + nodeId);
					}
					catch(e)
					{
						YAHOO.log("Creating of droppable failed: upper_" + nodeId , 'error');
					}
					
					try
					{
						Droppables.add("name_" + nodeId , { hoverclass: 'hover',	overlap : 'horizontal', onDrop: function(draggable , droppable , event) { droppedOnNode(draggable.id , droppable.id) }});
					}
					catch(e)
					{
						YAHOO.log("Creating of droppable failed: name_" + nodeId , 'error');
					}
					
					/* Adding New draggable */
					try
					{
						new Draggable("main_" + nodeId , { revert: true ,handle: "handle_" + nodeId ,ghosting : true , scroll: window , endeffect: function(){showMe()} });
						YAHOO.log("New Draggable created: main_" + nodeId );
					}
					catch(e)
					{
						YAHOO.log("Creating of draggable failed: main_" + nodeId , 'error');
					}
				}
			}
		}			
	}
}
 
var times = 1 ;
function makedraganddropobject()
{	 
	//alert("Hi there" + times);
	times++;
	
		
	var node = $("par_0");
	if(box)
	{
		YAHOO.log("Entering into the box" , 'error');
		box = false;
		var childnode = $("product_1");	
		var mydrag = new Draggable(childnode, {revert:true, overlap:'vertical' , scroll:window});
		if (document.all) 
	 	{ 
			Droppables.drops = []; 
		}
		Droppables.add("name", { accept:["dragtext" , "Main"] , hoverclass: 'hover',	overlap : 'horizontal', onDrop: function(draggable , droppable , event) { droppedOnNode(draggable.id , "name_0") }});
		createTree(node);
		box = true;
		
	}
	else
	{
		YAHOO.log("somebody is in the box so not allowed to enter" , 'error');
	}
	/*
	
	Droppables.add('cart', {onDrop:addProduct,accept:["dragtext"],overlap:'vertical', hoverclass:'tree'});
	var els = node.getElementsByTagName("tr");
	var elsLen = els.length;
	for (i = 0; i < elsLen; i++) 
	{
		if ( els[i].className=='maincat' )
		{
			var dragid=els[i].id;
			Droppables.add(dragid, {onDrop:addProduct,accept:["dragtext","lineitem","dragnewurl"],overlap:'vertical', hoverclass:'tree'});
			//new Draggable(dragid, {revert:false,overlap:'vertical'})
		}
		if ( els[i].className=='sharegroupcat' )
		{
			var dragid=els[i].id;
			Droppables.add(dragid, {onDrop:sgaddcat,accept:["dragtext","lineitem","dragnewurl"],overlap:'vertical', hoverclass:'tree'});
		}
		if ( els[i].className=='sgsubcat' )
		{
			var dragid=els[i].id;
			Droppables.add(dragid, {onDrop:sgaddcatinlink,accept:["lineitem","dragnewurl"],overlap:'vertical', hoverclass:'tree'});
		}
	}
	var subcat = node.getElementsByTagName("div");
	var subcatlen = subcat.length;
	for (i = 0; i < subcatlen; i++) 
	{
		if ( subcat[i].className=='subcat' )
		{
			var dragid=subcat[i].id;
			Droppables.add(dragid, {onDrop:addcatinlink,accept:["lineitem","dragnewurl"],overlap:'vertical', hoverclass:'tree'});
		}
		if ( subcat[i].className=='sharegroupname' )
		{ 
			var dragid=subcat[i].id;
			Droppables.add(dragid, {onDrop:sgaddcat,accept:["dragtext","dragnewurl"],overlap:'vertical', hoverclass:'tree'});
		}			
	}
	*/
}
	
function sgaddcatinlink(element, dropon, event)
{
	if(element.className=="dragnewurl")
	{
		adddragnewlink(element, dropon, event);
	}
	else
	{
		var catid = (($(dropon.id).getAttribute("id"))).split('_');
		var linkid = (element.id).split('_');
		AjaxRequest.get({ 
			'url':'ajax_st.php?call=sgaddcatinlink&catid='+encodeURIComponent(catid[2])+'&urlid='+encodeURIComponent(linkid[1])+'&sgid='+encodeURIComponent(catid[1]),	
			'onLoading':function(req){
				new Effect.Opacity(element.id, {duration:0.2, from:1.0, to:0.5});
				$('requesting_wait').innerHTML='<img src=images/loading.gif>  Requesting content...'},
			'onSuccess':function(req){
			$('requesting_wait').innerHTML=''
			if(req.responseText=="linkalready"){
				//alert('link already in this share group category')
				}else if( req.responseText=="sglinkadded" ){
					new Effect.SlideUp(element.id); 
					clicklink_sidetab("MyCategories","treeviewmanage",WEB_ROOT+"my_tree_view_manage.php")
					//alert('link added in share group category')
				}
			},
			'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
			} 
			);
	}
}
function sgaddcat(element, dropon, event){
	if(element.className == "lineitem" )
	{
		sgaddcatinlink(element, dropon, event);
	}
	else if(element.className=="dragtext")
	{
		sgaddsubcat(element, dropon, event);
	}
	else if(element.className=="dragnewurl")
	{
		adddragnewlink(element, dropon, event);
	}
	return false;
}		

function sgaddcatlink(element, dropon, event){
var linkid = (element.id).split('_');
var catid = (($(dropon.id).getAttribute("id"))).split('_');
AjaxRequest.get( 
	{ 
	'url':'ajax_st.php?call=addcatinlink&catid='+encodeURIComponent(catid[1])+'&urlid='+encodeURIComponent(linkid[1]),	
	'onLoading':function(req){$('requesting_wait').innerHTML='<img src=images/loading.gif>  Requesting content...'},
	'onSuccess':function(req){
	$('requesting_wait').innerHTML=''
	if(req.responseText=="catupdated"){
		clicklink_sidetab("MyCategories","treeviewmanage",WEB_ROOT+"my_tree_view_manage.php")
		//alert("Category updated")
	}
	},
	'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
	} 
	);
}
function sgaddsubcat(element, dropon, event){
	var inputcat = element.getElementsByTagName('input')[0]
	if(inputcat.value=='Type Category name then drop below'){ alert('You can not create Blank Category/Sub Category.  Type a name in the input box before you drop it.')
	inputcat.focus()
	return false
	}
	AjaxRequest.get( 
	{ 
	'url':'ajax_st.php?call=SGADDCAT&catid='+encodeURIComponent($(dropon.id).getAttribute("id"))+'&catvalue='+encodeURIComponent(inputcat.value),	
	'onLoading':function(req){$('requesting_wait').innerHTML='<img src='+WEB_ROOT+'images/loading.gif>  Requesting content...'},
	'onSuccess':function(req){
	clicklink_sidetab("MyCategories","treeviewmanage",WEB_ROOT+"my_tree_view_manage.php")
	},
	'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
	} 
	);
}
function addcatinlink(element, dropon, event){
	if(element.className=='dragnewurl')
	{
		adddragnewlink(element, dropon, event);
	}
	else
	{
		var linkid = (element.id).split('_');
		var catid = (($(dropon.id).getAttribute("id"))).split('_');
		AjaxRequest.get( 
		{ 
			'url':'ajax_st.php?call=addcatinlink&catid='+encodeURIComponent(catid[1])+'&urlid='+encodeURIComponent(linkid[1]),	
			'onLoading':function(req){new Effect.Opacity(element.id, {duration:0.2, from:1.0, to:0.5});$('requesting_wait').innerHTML='<img src=images/loading.gif>  Requesting content...'},
			'onSuccess':function(req){
			$('requesting_wait').innerHTML=''
			if(req.responseText=="catupdated"){
				//Element.remove(element.id,{duration:2.0})
				new Effect.SlideUp(element.id); 
				clicklink_sidetab("MyCategories","treeviewmanage",WEB_ROOT+"my_tree_view_manage.php")
				//alert("Category updated")
			}
			},
			'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
			} 
			);
	}
}

function addProduct(element, dropon, event){
	if(element.className=="lineitem"){
		addcatlink(element, dropon, event);
	}else if(element.className=="dragtext"){
		addsubcat(element, dropon, event);
	}
	else if(element.className=="dragnewurl")
	{
		adddragnewlink(element, dropon, event);
	}
	return false;
}

function addcatlink(element, dropon, event) {
	       var linkid = (element.id).split('_');
      		var catid = (($(dropon.id).getAttribute("id"))).split('_');
			AjaxRequest.get( 
				{ 
				'url':'ajax_st.php?call=addcatinlink&catid='+encodeURIComponent(catid[1])+'&urlid='+encodeURIComponent(linkid[1]),	
				'onLoading':function(req){new Effect.Fade(element.id);$('requesting_wait').innerHTML='<img src=images/loading.gif>  Requesting content...'},
				'onSuccess':function(req){
				$('requesting_wait').innerHTML=''
					if(req.responseText=="catupdated"){
						//Element.remove(element.id,{duration:2.0})
						new Effect.SlideUp(element.id); 
						clicklink_sidetab("MyCategories","treeviewmanage",WEB_ROOT+"my_tree_view_manage.php");
					//alert("Category updated")
					}
				},
				'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
				} 
				);
	}
function addsubcat(element, dropon, event) {	
	var inputcat = element.getElementsByTagName('input')[0]
	if(inputcat.value=='Type Category name then drop below'){ alert('You can not create Blank Category/Sub Category.  Type a name in the input box before you drop it.')
	inputcat.focus()
	return false
	}
	AjaxRequest.get( 
			{ 
			'url':'ajax_st.php?call=dragndrop&catid='+encodeURIComponent($(dropon.id).getAttribute("id"))+'&catvalue='+encodeURIComponent(inputcat.value),	
			'onLoading':function(req){$('requesting_wait').innerHTML='<img src='+WEB_ROOT+'images/loading.gif>  Requesting content...'},
			'onSuccess':function(req){
				//alert(req.responseText)
			//new Ajax.Updater("siadecontenar",  'my_tree_view_manage.php', {onLoading:function(request){$('requesting_wait').innerHTML='<img src='+WEB_ROOT+'images/loading.gif>  Requesting content...'}, onComplete:function(request){$('requesting_wait').innerHTML=''}})
			$('requesting_wait').innerHTML=''
			clicklink_sidetab("MyCategories","treeviewmanage",WEB_ROOT+"my_tree_view_manage.php")
			},
			'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
			} 
			);
	}

 
 
function sharegroppdeletelink(urlid,backlink,container){
	 if(confirm('Do you want to delete this link?'))
	 { 
	 AjaxRequest.get( 
			{ 
			'url':'ajax_st.php?call=sharegroppdeletelink&urlid='+encodeURIComponent(urlid),	
			'onLoading':function(req){},
			'onSuccess':function(req){
				if(req.responseText=='updated')
					{  
					Element.remove(container,{duration:0.9})
					}		
					
				},
			'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
			} 
			);
	 }
 }
 

function chkcontactus(){
	var emailStr= $F('fromemail')
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + '+'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	var matchArray=emailStr.match(emailPat)	
	
	if( $F('mailfromname').length <= 0 ){
		$('contactusmessage').innerHTML="Name is required !" 
		new Effect.Highlight('contactusmessage');
		new Effect.Highlight('mailfromname');
		return false
		
	}else if( $F('fromemail').length <= 0 ){
			$('contactusmessage').innerHTML="Email is required !"
			new Effect.Highlight('contactusmessage');
			new Effect.Highlight('fromemail');
			return false
	}else if( $F('frommessage').length <= 0 ){
			$('contactusmessage').innerHTML="description is required !"
			new Effect.Highlight('contactusmessage');
			new Effect.Highlight('frommessage');
			return false
			 }
	if (matchArray==null) {
		$('contactusmessage').innerHTML="E-Mail address seems incorrect (check @ and .'s)"
			new Effect.Highlight('contactusmessage');
			new Effect.Highlight('fromemail');
		return false
	}
	var user=matchArray[1]
	var domain=matchArray[2]
	if (user.match(userPat)==null) {
		$('contactusmessage').innerHTML="The E-Mail doesn't seem to be valid."
		new Effect.Highlight('contactusmessage');
		new Effect.Highlight('fromemail');
		return false
	}
	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
		  for (var i=1;i<=4;i++) {
		    if (IPArray[i]>255) {
			$('contactusmessage').innerHTML="Destination IP address of E-Mail is invalid!"
			new Effect.Highlight('contactusmessage');
			new Effect.Highlight('fromemail');
			return false
		    }
	    }
	   
	}
	var domainArray=domain.match(domainPat)
	if (domainArray==null) {
		$('contactusmessage').innerHTML="The domain name of E-Mail doesn't seem to be valid."
		new Effect.Highlight('contactusmessage');
		new Effect.Highlight('fromemail');
		 return false
	}
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (len<2) {
	   $('contactusmessage').innerHTML="This E-Mail address is missing a hostname!"
		new Effect.Highlight('contactusmessage');
		new Effect.Highlight('fromemail');
	   return false
	}
	
	AjaxRequest.get( 
		{ 
		'url':'ajax_st.php?call=contactus&name='+encodeURIComponent($F('mailfromname'))+'&email='+encodeURIComponent($F('fromemail'))+'&subject='+encodeURIComponent($F('fromsubject'))+'&message='+encodeURIComponent($F('frommessage')),	
		'onLoading':function(req){$('contactusmessage').innerHTML='<img src='+WEB_ROOT+'images/loading.gif>  Requesting content...'},
		'onSuccess':function(req){
			$('contactusmessage').innerHTML=req.responseText
			new Effect.Highlight('contactusmessage');
			return false;
		
		},
		'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
		} 
		);
	return false;
}
function columnslider(divid,back_link,mantab,subtab,st)
{
	AjaxRequest.get(
			{
				'url':WEB_ROOT+'ajax_st.php?call=viewsetting&status='+st+'&view='+divid+'&columnname='+st,
				'onLoading':function (req){},
				'onSuccess':function(req)
				{
				clicklink_secont(mantab,subtab,back_link)
				},
				'onError':function(req){alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
		}
		);
		
}

function refresh_snapshot_manage(url_id)
{ 
	var refreshdiv="thumbimg_"+url_id;
	var urltxt = "newurl_"+url_id ;
			AjaxRequest.get({
					'url':WEB_ROOT+'ajax_st.php?call=generateimage&newurl='+encodeURIComponent($F(urltxt))+'&status=refresh',
					'onLoading':function(req){$(refreshdiv).innerHTML='<img src='+WEB_ROOT+'images/Loadimg.gif  border=0>'},
					'onSuccess':function(req)
					{
						if(req.responseText!='')
							$(refreshdiv).innerHTML="<img src="+WEB_ROOT+"urlimage/"+req.responseText+" border=0>";
						else
							$(refreshdiv).innerHTML="<img src='"+WEB_ROOT+"images/unable_to_gen.gif' border=0>";
					}
					});	
}

function updateurlstatus(urlid,Layer,img1,img2,type){
	if(type=='favorite')
		var url=WEB_ROOT+'ajax_st.php?call=chgurlstatus&urlid='+urlid+'&status=favorite&memstatus=personal';
	else if(type=='private')
		var url=WEB_ROOT+'ajax_st.php?call=chgurlstatus&urlid='+urlid+'&status=private&memstatus=personal';
	else
	return;
		AjaxRequest.get( 
		{ 
		'url': url,
		'onLoading':function(req){},
		'onSuccess':function(req){ 
		new Effect.Highlight( Layer);
		new Effect.Opacity( Layer, {duration:1.0, from:0.5, to:1.0});
		swap_image(Layer,img1,img2)
		$('requesting_wait').innerHTML=''
		},
		'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
		} 
		);
		
}

function colorpicker(colordiv,colortext,color){
	 $(colordiv).style.backgroundColor=color 
	 $(colortext).value= color 

}


var Tagcloudmanager =  {
Javastr : WEB_ROOT+getCookie('uid')+'/cloud.js',
Textsize : 10,
Cloudsize : 50,
ISLogo : true,
Togglelogo : function (Chkbox) {
if(Chkbox.checked) {
ISLogo = true;
new Effect.toggle('Blinklistlogo.Toggle');
} else {
ISLogo = false;
new Effect.toggle('Blinklistlogo.Toggle');
}
Tagcloudmanager.Builderstr();
},

UPDATEFontsize:function(Txt){
if(Field.present(Txt)) Tagcloudmanager.Textsize = Txt.value;
Tagcloudmanager.Builderstr();
},

UPDATECloudsize:function(Txt){
if(Field.present(Txt)) Tagcloudmanager.Cloudsize = Txt.value;
Tagcloudmanager.Builderstr();
},


Builderstr:function(){
var Tmpstr = Tagcloudmanager.Javastr;
if(ISLogo == false) 

Tmpstr += '&logo=0';
var Tmpscript = '%3Cscript type="text/javascript" src="'+Tmpstr+'"%3E%3C%2Fscript%3E';
$('Simpletextarea').value = unescape(Tmpscript);
}
}


var gPlatform = PLATFORM_WINDOWS;

var PLATFORM_OTHER    = 0;
var PLATFORM_WINDOWS  = 1;
var PLATFORM_LINUX    = 2;
var PLATFORM_MACOSX   = 3;
var PLATFORM_MAC      = 4;

if (navigator.platform.indexOf("Win32") != -1)
  gPlatform = PLATFORM_WINDOWS;
else if (navigator.platform.indexOf("Linux") != -1)
  gPlatform = PLATFORM_LINUX;
else if (navigator.userAgent.indexOf("Mac OS X") != -1)
  gPlatform = PLATFORM_MACOSX;
else if (navigator.userAgent.indexOf("MSIE 5.2") != -1)
  gPlatform = PLATFORM_MACOSX;
else if (navigator.platform.indexOf("Mac") != -1)
  gPlatform = PLATFORM_MAC;
else
  gPlatform = PLATFORM_OTHER;

function getPlatformName()
{
  if (gPlatform == PLATFORM_WINDOWS)
    return "Windows";
  if (gPlatform == PLATFORM_LINUX)
    return "Linux";
  if (gPlatform == PLATFORM_MACOSX)
    return "MacOSX";
  return "Unknown";
}

function getInstallURL(aEvent) {
 
    // The event target might be the link itself or one of its children
    var target = aEvent.target;
    while (target && !target.href)
      target = target.parentNode;
    
    return target && target.href;
}

function install( aEvent, extName, iconURL, extHash)  {   

    if (aEvent.altKey || !window.InstallTrigger)
        return true;

    var url = getInstallURL(aEvent);

    if (url && url.match(/^.+\.xpi$/)) {

        var params = new Array();

        params[extName] = {
            URL: url,
            IconURL: iconURL,
            toString: function () { return this.URL; }
        };

        // Only add the Hash param if it exists.
        //
        // We optionally add this to params[] because installTrigger
        // will still try to compare a null hash as long as the var is set.
        if (extHash) {
            params[extName].Hash = extHash;
        }

        InstallTrigger.install(params);

        try {
            var p = new XMLHttpRequest();
            p.open("GET", "/install.php?uri=" + url, true);
            p.send(null);
        } catch(e) { }

        return false;
    }
    return true;
}

function installTheme( aEvent, extName) {
    if(!window.InstallTrigger) 
        return true;
    
    var url = getInstallURL(aEvent);
    if (!url)
        return true;

    InstallTrigger.installChrome(InstallTrigger.SKIN,url,extName);

    try {
        var p = new XMLHttpRequest();
        p.open("GET", "/install.php?uri="+url, true);
        p.send(null);
    } catch(e) { }
    return false;
}

function fixPlatformLinks(addonID, name)
{
    var platform = getPlatformName();
    var outer = document.getElementById("install-"+ addonID);
    var installs = outer.getElementsByTagName("p");
    var found = false;
    for (var i = 0; i < installs.length; i++) {
        var className = installs[i].className;
        if (className.indexOf("platform-" + platform) != -1 ||
            className.indexOf("platform-ALL") != -1) {
                found = true;
        } else {
                installs[i].style.display = "none";
        }
    }
    if (!found)
        outer.appendChild(document.createTextNode(name + " is not available for " + platform)); 
}


function DeleteAll()
{
	//alert('in the function');
	if(!$('pass').value)
	{
		$('delMsg').innerHTML = "<span style = 'color:red'>Please provide password</style>";
		new Effect.Highlight($('delMsg'), {startcolor: '#ffff99', endcolor: '#ffffff'});
	}
	else
	{
		AjaxRequest.get( 
				{ 
				'url':WEB_ROOT+'ajax_st.php?call=deleteAll&pass='+$F('pass'),
				'onLoading':function(req){$('delMsg').innerHTML='<img src='+WEB_ROOT+'images/loading.gif /> Requesting content...'},
				'onSuccess':function(req){ 
								//alert(req.responseText);								
								$('delMsg').innerHTML="";
								var ack = req.responseXML.firstChild.getAttribute('ack');
								if( ack == 'success'){
									$('delMsg').innerHTML="<span style = 'color:red'>All bookmarks, category and tags deleted successfully</span>";
									new Effect.Highlight($('delMsg'));
									clicklink('tabmainmenu','siadecontenar',LEFT_MAIN_TABS);
								}else {
									$('delMsg').innerHTML="<span style = 'color:red'>Your request cannot be entertained at this time. Please try later</span>";
									new Effect.Highlight($('delMsg'));	
								}
							},
				'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
				} 
				); 
	}
}

function changeStatus(status)
{
	//alert(status);
	if((status != 'public') && (status != 'private') )
	{
		$('statusDiv').innerHTML = "Please try later. We cannot entertain your request at this time";
		new Effect.Highlight($('statusDiv'), {startcolor: '#ffff99', endcolor: '#ffffff'});
	}
	else
	{
		//alert("I am here");
		AjaxRequest.get( 
				{ 
				'url':WEB_ROOT+'ajax_st.php?call=changeStatus&status='+ status,
				'onLoading':function(req){$('statusDiv').innerHTML='<img src='+WEB_ROOT+'images/loading.gif /> Requesting content...'},
				'onSuccess':function(req){ 
								//alert(req.responseText);								
								$('statusDiv').innerHTML="";
								$('statusDiv').innerHTML= req.responseText;
								new Effect.Highlight($('statusDiv'));
							},
				'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
				} 
				); 
	}
}

