var timer;var displayTrashTimer;function showDiv(d,c){document.getElementById(d).style.display="block";toggleDisabled(document.getElementById("clusterParent"));document.getElementById("saveCluster").disabled="true"}function closeLinkDiv(b){document.getElementById(b).style.display="none";}function closeAddLinkDiv(b){document.getElementById("nameField").disabled=false;document.getElementById("btnDiv").style.visibility="visible";document.getElementById(b).style.display="none";document.getElementById("titleId").value="";document.getElementById("LinkUrl").value="";document.getElementById("LinkId").value="";toggleElements()}function setTabLabels(b){if(b=="private"){if(get_cookie("lock_status")==null){setTimeout("if(document.getElementById('passcodeId') != null){if(document.getElementById('passcodeId') != null){document.getElementById('passcodeId').focus()}}",500)}document.getElementById("privatepro").setAttribute("src","/images/mylinks_active.gif");if(get_cookie("lock_status")==null){document.getElementById("showImage").setAttribute("src","/images/locked_active.gif")}else{document.getElementById("showImage").setAttribute("src","/images/menuLock.png")}}else{document.getElementById("privatepro").setAttribute("src","/images/mylinks.gif");if(get_cookie("lock_status")==null){document.getElementById("showImage").setAttribute("src","/images/locked.gif")}else{document.getElementById("showImage").setAttribute("src","/images/menuLockGreyNew.png")}}}function toggleDisabled(f){try{f.disabled=f.disabled?false:true}catch(e){}if(f.childNodes&&f.childNodes.length>0){for(var d=0;d<f.childNodes.length;d++){toggleDisabled(f.childNodes[d])}}}function removeCluster(b){document.homeForm.clusterId.value=b;if(onSubmitDelete()){document.homeForm.submit()}}function checkSubmit(b){if(document.getElementById("ClusterName").value==""){document.getElementById("clusterNameError").style.display="block";document.getElementById("clusterNameError").innerHTML=" Enter Title!";return false}else{document.getElementById("clusterNameError").style.display="none";return true}}function urlValidation(f){var e="";var d=new RegExp();d.compile("^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$","i");if(!d.test(f)){e="False"}else{e="True"}return e}
function fnValidateIPAddress(ipaddr) {
    //Remember, this function will validate only Class C IP.
    //change to other IP Classes as you need
    ipaddr = ipaddr.replace( /\s/g, "") //remove spaces for checking
    var splitIp = ipaddr.split(':');
    ipaddr = splitIp[0];
    var re = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/; //regex. check for digits and in
                                          //all 4 quadrants of the IP
    if (re.test(ipaddr)) {
        //split into units with dots "."
        var parts = ipaddr.split(".");
        //if the first unit/quadrant of the IP is zero
        if (parseInt(parseFloat(parts[0])) == 0) {
            return false;
        }
        //if the fourth unit/quadrant of the IP is zero
        if (parseInt(parseFloat(parts[3])) == 0) {
            return false;
        }
        //if any part is greater than 255
        for (var i=0; i<parts.length; i++) {
            if (parseInt(parseFloat(parts[i])) > 255){
                return false;
            }
        }
        return true;
    } else {
        return false;
    }
}
function urlValidationLink(g)
{ 
	var f="";var h=new RegExp();
	if(g.indexOf("http://")==0)
	{ 
		if(g.indexOf("http://http://")==0)
		{ 
			value1=g.replace("http://http://","http://")
		}
		else
		{ 
			value1=g
		}
	}
	else
	{ 
		if(g.indexOf("https://")==0)
		{ 
			if(g.indexOf("https://https://")==0)
			{ 
				value1=g.replace("https://https://","https://")
			}
			else
			{ 
				value1=g
			}
		}
		else
		{ 
			value1="http://"+g
		}
	}
	var valueSplit = value1.split('://');
	if(valueSplit[1] != '')
	{
		
		var regUrl = /^(((ht|f){1}(tp(s)?:[/][/]){1})|((www.){1}))[-a-zA-Z0-9@:%_\+.~#?&//=]+$/;
		if(regUrl.test(value1) == false)
		{
			var v = new RegExp();
			v.compile('^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$','i');
			if (!v.test(value1)) {
				f = 'False';
			}
			else
			{
				f = 'True';
				var value2 = get_hostname_from_url(value1);
			    var val = checkDomain(value2);
			    if(val != true)
			    {
			    	
			    	if((value1.search("dropbox")==-1) && (value1.search("localhost")==-1))
			    	{ 
			    		var value2 = value1.split('//');
			    		
			    		if(value2[1].search(":") == -1)
				    	{
			    			value1 = value1.replace(value1, value1+'.com');
				    	}
			    	}
			    }
			}
		
		}
		else
		{
			f = 'True';
			var value2 = get_hostname_from_url(value1);
		    var val = checkDomain(value2);
		    if(val != true)
		    {
		    	if((value1.search("dropbox")==-1) && (value1.search("localhost")==-1))
		    	{ 
		    		var value2 = value1.split('//');
		    		if(value2[1].search(":") == -1)
			    	{
		    			value1 = value1.replace(value1, value1+'.com');
			    	}
		    	}
		    }
		}
		
		
//		var regUrl = /^(((ht|f){1}(tp(s)?:[/][/]){1})|((www.){1}))[-a-zA-Z0-9@:%_\+.~#?&//=]+$/;
//		
//		if(regUrl.test(value1) == false)
//		{
//			var v = new RegExp();
//			v.compile('^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$','i');
//			if (!v.test(value1)) {
//				f="False"
//			}
//			else
//			{
//				f="True";
//				var i=get_hostname_from_url(value1);
//				var j=checkDomain(i);
//				if(value1.search("localhost")==-1)
//				{
//					if(j != false)
//					{
//						if(value1.search("localhost")==-1)
//						{
//							if(j!=true)
//							{
//								value1=value1.replace(value1,value1+".com")
//							}
//						}
//					}
//					else
//					{
//						f="False";
//					}
//				}
//			}
//		
//		}
//		else
//		{
//			f="True";
//			var i=get_hostname_from_url(value1);
//			var j=checkDomain(i);
//			if(value1.search("localhost")==-1)
//			{
//				if(j != false)
//				{
//					if(value1.search("localhost")==-1)
//					{
//						if(j!=true)
//						{
//							value1=value1.replace(value1,value1+".com")
//						}
//					}
//				}
//				else
//				{
//					f="False";
//				}
//			}
//		}
	}
	else
	{
		f="False";
	}
	return f+"___"+value1
}
function get_hostname_from_url(b){return b.match(/:\/\/(.[^/]+)/)[1]}function checkDomain(q){ 
	var r=new Array(".doc",".aero",".asia",".biz",".cat",".com",".coop",".edu",".gov",".info",".int",".jobs",".mil",".mobi",".museum",".name",".net",".org",".pro",".tel",".travel",".ac",".ad",".ae",".af",".ag",".ai",".al",".am",".an",".ao",".aq",".ar",".as",".at",".au",".aw",".ax",".az",".ba",".bb",".bd",".be",".bf",".bg",".bh",".bi",".bj",".bm",".bn",".bo",".br",".bs",".bt",".bv",".bw",".by",".bz",".ca","",".cc",".cd",".cf",".cg",".ch",".ci",".ck",".cl",".cm",".cn",".co",".cr",".cs",".cu",".cv",".cx",".cy",".cz",".de",".dj",".dk",".dm",".do",".dz",".ec",".ee",".eg",".eh",".er",".es",".et",".eu",".fi",".fj",".fk",".fm",".fo",".fr",".ga",".gb",".gd",".ge",".gf",".gg",".gh",".gi",".gl",".gm",".gn",".gp",".gq",".gr",".gs",".gt",".gu",".gw",".gy",".hk",".hm",".hn",".hr",".ht",".hu",".id",".ie",".il",".im",".in",".io",".iq",".ir",".is",".it",".je",".jm",".jo",".jp",".ke",".kg",".kh",".ki",".km",".kn",".kp",".kr",".kw",".ky",".kz",".la",".lb",".lc",".li",".lk",".lr",".ls",".lt",".lu",".lv",".ly",".ma",".mc",".md",".me",".mg",".mh",".mk",".ml",".mm",".mn",".mo",".mp",".mq",".mr",".ms",".mt",".mu",".mv",".mw",".mx",".my",".mz",".na",".nc",".ne",".nf",".ng",".ni",".nl",".no",".np",".nr",".nu",".nz",".om",".pa",".pe",".pf",".pg",".ph",".pk",".pl",".pm",".pn",".pr",".ps",".pt",".pw",".py",".qa",".re",".ro",".rs",".ru",".rw",".sa",".sb",".sc",".sd",".se",".sg",".sh",".si",".sj",".sk",".sl",".sm",".sn",".so",".sr",".st",".su",".sv",".sy",".sz",".tc",".td",".tf",".tg",".th",".tj",".tk",".tl",".tm",".tn",".to",".tp",".tr",".tt",".tv",".tw",".tz",".ua",".ug",".uk",".um",".us",".uy",".uz",".va",".vc",".ve",".vg",".vi",".vn",".vu",".wf",".ws",".ye",".yt",".yu",".za",".zm",".zr",".zw");
	var t=q;var j=true;
	var o=t.lastIndexOf(".");
	var u=t.substring(0,o);
	var n=t.substring(o,t.length);
	var nsplit = n.split('/');
	n = nsplit[0];
	if(o>2&&o<57){ 
		for(var s=0;s<r.length;s++)
		{ 
			if(n==r[s])
			{ 
				j=true;break;
			}
			else
			{
				j=false
			}
		}
	}
	else
	{ 
		return false
	}
	return true
}function closeElement(b){document.getElementById(b).style.display="none"}function showEditLInk(){if(document.getElementById("nameField").value!=""){set_cookie("clusterCookie","name");document.getElementById("greenBox").style.display="block";document.getElementById("linkListid").style.display="block"}else{document.getElementById("linkListid").style.display="none";document.getElementById("greenBox").style.display="none";document.getElementById("linkDiv").style.display="none"}}function showEditPrivacy(d,e){var f=document.getElementById("isPrivacy").checked;if(f==true){set_cookie("clusterCookie","privacy")}else{delete_cookie("clusterCookie")}}function showEditTag(){if(document.getElementById("ClusterTags").value!=""){set_cookie("clusterCookie","tag")}else{if(document.getElementById("ClusterName").value==""){delete_cookie("clusterCookie")}}}function onSubmitDelete(){var b=confirm("Are you sure you want to delete this category?");if(b==true){return true}return false}
function onSubmitDeleteCluster(){ 
	var b=confirm("Are you sure you want to delete this category?");if(b==true){return true}return false}function showEditLinkDiv(){document.getElementById("linkDiv").style.display="block"}function updateLinkDiv(){if((document.getElementById("LinkTitle").value!="")&&(document.getElementById("LinkUrl").value!="")){if(urlValidation(document.getElementById("LinkUrl").value)!="False"){document.getElementById("linkDiv").style.display="none";document.getElementById("LinkTitle").value="";document.getElementById("LinkUrl").value="";toggleElements()}else{document.getElementById("linkDiv").style.display="block";document.getElementById("linkUrlError").style.display="block";document.getElementById("linkUrlError").innerHTML="Enter a valid url."}}else{document.getElementById("linkDiv").style.display="block";if(document.getElementById("LinkTitle").value==""){document.getElementById("linkTitleError").style.display="block";document.getElementById("linkTitleError").innerHTML="Enter Title."}else{document.getElementById("linkTitleError").style.display="none"}if(document.getElementById("LinkUrl").value==""){document.getElementById("linkUrlError").style.display="block";document.getElementById("linkUrlError").innerHTML="Enter Url."}else{document.getElementById("linkUrlError").style.display="none"}}}function toggleElements(){toggleDisabled(document.getElementById("saveCluster"))}function feedback(){var d=document.getElementById("feedback_span");var c=document.getElementById("feedback_form").style.right;if(window.innerWidth<900||document.body.clientWidth<900){document.getElementById("floatingDiv").style.position="absolute";document.getElementById("floatingDiv").style.right="293px";document.getElementById("floatingDiv").style.left="0";if(document.getElementById("feedback_form").style.right=="0px"){document.getElementById("floatingDiv").style.right="25px"}}else{document.getElementById("floatingDiv").style.position="relative"}if(!isNull(d)){d.innerHTML=""}if(c=="-293px"){document.getElementById("feedback_handle").src="/img/bookmarks_over.gif";document.getElementById("feedback_form").style.right="0px"}if(c=="0px"){document.getElementById("feedback_form").style.right="-293px";document.getElementById("feedback_handle").src="/img/bookmarks.gif"}}function isNull(b){return(b==null)}function checkUsername(b){if(document.getElementById("UserUsername").value==""){document.getElementById("UserUsernameError").innerHTML="Enter a name";return false}else{document.getElementById("UserUsernameError").innerHTML="";return true}}function hideComment(c){var d=setTimeout("hideCommentDiv()",3000)}function hideCommentDiv(){document.getElementById("showComment").style.display="none"}function setLockImage(){var b="";b+='<a href="#tabs-2"><img src="/images/locked.gif" border="0" id="showImage"></a>';document.getElementById("priProDiv").className="menuList ui-state-default ui-corner-top ui-state-disabled ui-droppable";document.getElementById("priProDiv").innerHTML=b}function hideText(b){document.getElementById(b).value=""}function setUnlockImage(){timer=setTimeout("changeUnlockImage()",300000)}function changeUnlockImage(){var c="";c+='<img src="/img/lock.gif" border="0"><a href="/enterPasscode" class="lockImage">Unlock</a>';document.getElementById("enterPasscodeDiv").innerHTML=c;var d="";d+="Private Links";document.getElementById("showPrivateLinks").innerHTML=d;var d="";d+='<span ><img src="/img/clutterLock.gif"> </span><span style="text-align:right;"> To view hidden clutter,<br/>you must open the privacy<br/>tab on top of page.</span>';document.getElementById("privateLinkDiv").innerHTML=d}function stoper(){clearTimeout(timer)}function setUnlcockedImage(){var b="";b+='<img src="/img/unlock.gif" border="0"><a href="showPrivateClusters/public" class="lockCluster">Lock</a><br/><a href="/showPrivateClusters/private/open" id="showPrivate">My private Clusters</a>';document.getElementById("enterPasscodeDiv").innerHTML=b}function changePasscodeField(){document.getElementById("passcodeTdId").innerHTML='<input id="passcodeId" class="blackPasscode" type="password"  size="6" maxlength="4" label="" name="data[Home][passcode]"/>';if(document.getElementById("passcodeId") != null){if(document.getElementById("passcodeId") != null){document.getElementById("passcodeId").focus()}}}function queryAction(){var d="Are you sure you want to continue?";var c="/deleteAccount";if(confirm(d)){window.location=c}}function changeTabImage(){if(get_cookie("lock_status")!=null){$("#showImage").attr("src","/images/menuLock.png");$("#privateProId").attr("href","#tabs-2");$("#lockId").css({visibility:"visible"});$("#lockId").html('<img src="/images/lockIt.png" id="lockClusterID" onmouseover="document.getElementById(\'lockClusterID\').src=\'/images/lockITOrange.png\'" onmouseout="document.getElementById(\'lockClusterID\').src=\'/images/lockIt.png\'" style="cursor:pointer;"/>')}}
	function delete_cookie(c){var d=new Date();d.setTime(d.getTime()-1);document.cookie=c+="=; expires="+d.toGMTString()}function get_cookie(c){var d=document.cookie.match("(^|;) ?"+c+"=([^;]*)(;|$)");if(d){return(unescape(d[2]))}else{return null}}function set_cookie(k,p,n,q,o,m,r,l){var s=k+"="+escape(p);if(n){var t=new Date(n,q,o);s+="; expires="+t.toGMTString()}if(m){s+="; path="+escape(m)}if(r){s+="; domain="+escape(r)}if(l){s+="; secure"}document.cookie=s}var displayDragSuccessTimer=null;
	function displayDragSuccessMessage(f,g){var e=document.getElementById("saveSuccessDiv");
	var h=document.getElementById("pubProDiv");
	if(g!=null){document.getElementById("niftyWarningMessage").style.width="440px";
	document.getElementById("displayDragMessage").innerHTML='<div style="float:left;padding-left:40px"><img src="/images/loading.gif" height="14px" align="middle"/></div><div style="padding-right:25px;">'+f+"</div>"}else{document.getElementById("displayDragMessage").innerHTML='<div style="float:left;padding-left:10px"><img src="/images/loading.gif" height="14px" align="middle"/></div><div style="padding-right:20px;">'+f+"</div>"}e.style.display="block";displayDragSuccessTimer=setTimeout("cleanDragSaveSuccessMessage()",5000)}
	function cleanDragSaveSuccessMessage(){if(displayDragSuccessTimer){clearTimeout(displayDragSuccessTimer)}var b=document.getElementById("saveSuccessDiv");b.style.display="none"}
	function setHome(f){if(document.all){this.style.behavior="url(#default#homepage)";this.setHomePage("http://www.studiogazal.com");document.body.setHomePage(f)}else{if(window.sidebar){if(window.netscape){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")}catch(e){alert("Action denied by browser. To enable, please enter 'about:config' in address line and change the value of 'signed.applets.codebase_principal_support' to 'true'")}}var d=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);d.setCharPref("browser.startup.homepage",f+"/home")}}}function showBrowser(b){if(b=="IE7"){document.getElementById("browserId").innerHTML="Internet Explorer 7";document.getElementById("specific").innerHTML=' 1. Click the Tools button, and make sure that the Menu Bar is checked.<br />2. Choose "Import and Export" from the File menu.<br /> 3. Click Next, choose "Export Favorites" and click Next.<br />  4. Choose which folder you want to export from (the top one will export all of your favorites) and click Next.<br />5. Choose a location for your file (such as your desktop) and click Next.<br />  6. Click Finish, then OK when it says "Successfully exported favorites". '}else{if(b=="IE8"){document.getElementById("browserId").innerHTML="Internet Explorer 8";document.getElementById("specific").innerHTML="Use your browsers export bookmarks option, and save to a file on your desktop. "}else{if(b=="safari"){document.getElementById("browserId").innerHTML="Safari";document.getElementById("specific").innerHTML='1. Choose "Export Bookmarks" from the File menu.<br /> 2. Choose a location for your file (such as your desktop) and click Save.'}else{if(b=="chrome"){document.getElementById("browserId").innerHTML="Chrome";document.getElementById("specific").innerHTML="Use your browsers export bookmarks option, and save to a file on your desktop. "}else{if(b=="opera"){document.getElementById("browserId").innerHTML="Opera";document.getElementById("specific").innerHTML='1. Choose "Import and Export" from the File menu.<br/>2. Choose "Export Opera Bookmarks". Don’t choose the similar looking "Export bookmarks as HTML" option, which is incompatible<br/>3. Choose a location for your file (such as your desktop) and click Save.<br/>'}else{if(b=="mozilla"){document.getElementById("browserId").innerHTML="Mozilla Firefox";document.getElementById("specific").innerHTML='1. Choose "Organize Bookmarks" from the Bookmarks menu.<br />   2. Choose "Export..." from the File menu.<br />   3. Choose a location for your file (such as your desktop) and click Save.<br />'}}}}}}}function setStyleIE(){var e=document.getElementsByTagName("*");var h=e.length;var f;for(var g=0;g<h;g++){if(e[g].className=="link ui-draggable"){e[g].style.marginLeft="0px";e[g].style.left="15px"}}}
function toggle2(q,r,p)
{ 
	if(navigator.appVersion.indexOf("MSIE 7")>-1||navigator.appVersion.indexOf("MSIE 8")>-1) {if(p==2){setStyleIE()}}

	var m=document.getElementById(q);
	var t=q.split("_");
	var o=document.getElementById(r);
	if(q=="pubClutter"){var n=document.getElementById("hide")}
	if(q=="priClutter"){var n=document.getElementById("privImg")}
	if(q!="pubClutter"&&q!="priClutter"){var n=document.getElementById("clustercollap_"+t[1])}
	var active1 = new Array();
	if(getClassName("ui-state-active") != '')
	{
		active =getClassName("ui-state-active")[0].id;
		var active1 =active.split('_');
	}
	else
	{
		active1[1] = 0;
		active = 0;
	}
	
	if(active=="priProDiv")
	{
		var status = 1;
	}
	else {var status = 0;} 
	if(m.style.display=="block")
	{if(q!="pubClutter"&&q!="priClutter"){n.className="collapseclust1_"+t[1]
		$('#showClustersImg_'+t[1]).attr('tooltipText','Expand'); 
	}
		if(q=="pubClutter"){n.alt="plus"}if(q=="priClutter"){n.alt="plus"}
		m.style.display="none";
		var l=new RegExp("minusClust_roll.png","g");
		var s="plus.png";
		iconName=o.innerHTML.replace(l,s);o.innerHTML=iconName;
		if(q=="priClutter"){setMinHeightLarge()}
		$.get("/updateCollapseStatus/"+t[1]+'/1/'+status+'/cluster/'+active1[1]);
		var items = getClassName("hideshow_"+active1[1]);
		var counter = 0;
		for(var i =0; i< items.length; i++)
		{ 
			if(items[i])
			{
				image = $(items[i]).attr("src");
				var source = image.split('/images/');
				if(source[1] == 'minus.png')
				{
					counter = counter+1;
				}
			}
		}
		if(counter == 0)
		{
			
			document.getElementById('collpaseText_'+active1[1]+'_1').innerHTML = 'Expand All';
			document.getElementById('collpaseText_'+active1[1]+'_2').innerHTML = 'Expand All';
			document.getElementById('secCollapse_'+active1[1]+'_2').src = '/images/plusImg.png';
			document.getElementById('secCollapse_'+active1[1]+'_1').src = '/images/plusImg.png';
			
		}
	}
	else
	{if(q!="pubClutter"&&q!="priClutter"){n.className="collapseclust_"+t[1]
	$('#showClustersImg_'+t[1]).attr('tooltipText','Collapse'); 
	}if(q=="pubClutter"){n.alt="minus"}if(q=="priClutter"){n.alt="minus"}
		m.style.display="block";
		var l=new RegExp("plusClust_roll.png","g");var s="minus.png";
		iconName=o.innerHTML.replace(l,s);
		o.innerHTML=iconName;if(q=="priClutter"){setMinHeightSmall()}
		$.get("/updateCollapseStatus/"+t[1]+'/0/'+status+'/cluster');
		var items = getClassName("hideshow_"+active1[1]);
		var counter = 0;
		for(var i =0; i< items.length; i++)
		{
			if(items[i])
			{
				image = $(items[i]).attr("src");
				var source = image.split('/images/');
				if(source[1] == 'plus.png')
				{
					counter = counter+1;
				}
			}
		}
		if(counter == 0)
		{
			document.getElementById('collpaseText_'+active1[1]+'_1').innerHTML = 'Collapse All';
			document.getElementById('collpaseText_'+active1[1]+'_2').innerHTML = 'Collapse All';
			document.getElementById('secCollapse_'+active1[1]+'_2').src = '/images/minusImg.png';
			document.getElementById('secCollapse_'+active1[1]+'_1').src = '/images/minusImg.png';
		}
}
}
function toggleCommon(k,m){var h=document.getElementById(k);var j=k.split("_");var n=document.getElementById(m);if(h.style.display=="block"){h.style.display="none";var l=new RegExp("minus_roll.png","g");var i="plus_roll.png";iconName=n.innerHTML.replace(l,i);n.innerHTML=iconName}else{h.style.display="block";var l=new RegExp("plus_roll.png","g");var i="minus_roll.png";iconName=n.innerHTML.replace(l,i);n.innerHTML=iconName}}
function togglepublic(c)
{if(navigator.appVersion.indexOf("MSIE 7")>-1||navigator.appVersion.indexOf("MSIE 8")>-1){setStyleIE()}
if(c ==1)
{
	var item1 = 1;
	var item2 = 2;
}
else
{
	var item1 = 2;
	var item2 = 1;
}
active = new Array();
if(getClassName("ui-state-active") != '')
{
var active = getClassName("ui-state-active")[0].id.split('_');
}
else
{
	active[1] = 0;
}
	var images = $('#secCollapse_'+active[1]+'_'+c).attr('src').split('images/');
	var d = 'secCollapse_'+active[1]+'_'+c; 
	if(images[1] == 'minusImg_roll.png')
	{
		$.get("/updateCollapseStatus/"+active[1]+"/1");
		$('.all_clusters_'+active[1]).css({display:'none'});
		$('.hideshow_'+active[1]).attr('src','/images/plus.png');

		document.getElementById('secCollapse_'+active[1]+'_'+item1).src='/images/plusImg_roll.png';
		document.getElementById('secCollapse_'+active[1]+'_'+item2).src='/images/plusImg.png';
		var u=new RegExp("minus_roll.png","g");var p="plus_roll.png";
		
		$('.collpaseText_'+active[1]).html('Expand All');
		$('.showClustersImgClass').attr('tooltipText','Expand'); 
	} else {
		$.get("/updateCollapseStatus/"+active[1]+"/0");
		$('.all_clusters_'+active[1]).css({display:'block'});
		$('.hideshow_'+active[1]).attr('src','/images/minus.png');

		document.getElementById('secCollapse_'+active[1]+'_'+item1).src='/images/minusImg_roll.png';
		document.getElementById('secCollapse_'+active[1]+'_'+item2).src='/images/minusImg.png';
		$('.collpaseText_'+active[1]).html('Collapse All');
		$('.showClustersImgClass').attr('tooltipText','Collapse'); 
	}
}
function toggleprivate(w){if(w=="1"){var z="hideallclusters1"}if(w=="2"){var z="hideallclusters2"}var r=document.getElementById(z);var o=r.innerHTML.split('.png"');var i=o[0].split("images/");var t=document.getElementsByTagName("*");
if(i[1]=="minusImg_roll"){
$.get("/updateCollapseStatus/1/1");
} else {
	$.get("/updateCollapseStatus/1/0");
}
for(var q=0;q<t.length;q++){if(t[q].className=="all_clusters_1"){var v=document.getElementById(t[q].id);var x=t[q].id.split("showclusters_");var y=document.getElementById("showClustersImg_"+x[1]);var s=document.getElementById("clustercollap_"+x[1]);if(i[1]=="minusImg_roll"){if(v.style.display=="block"){s.className="collapseclust1_"+x[1];v.style.display="none";var u=new RegExp("minus.png","g");var p="plus.png";iconName=y.innerHTML.replace(u,p);y.innerHTML=iconName}var u=new RegExp("minus_roll.png","g");var p="plus_roll.png";iconName1=r.innerHTML.replace(u,p);r.innerHTML=iconName1;document.getElementById("collpaseText3").innerHTML="Expand All";document.getElementById("collpaseText4").innerHTML="Expand All";if(w=="1"){document.getElementById("secCollapse2").setAttribute("src","/images/plusImg_roll.png");document.getElementById("secCollapse3").setAttribute("src","/images/plusImg.png")}if(w=="2"){document.getElementById("secCollapse2").setAttribute("src","/images/plusImg.png");document.getElementById("secCollapse3").setAttribute("src","/images/plusImg_roll.png")}}else{if(i[1]=="plusImg_roll"){if(v.style.display=="none"){s.className="collapseclust_"+x[1];v.style.display="block";var u=new RegExp("plus.png","g");var p="minus.png";iconName=y.innerHTML.replace(u,p);y.innerHTML=iconName}var u=new RegExp("plus_roll.png","g");var p="minus_roll.png";iconName1=r.innerHTML.replace(u,p);r.innerHTML=iconName1;document.getElementById("collpaseText3").innerHTML="Collapse All";document.getElementById("collpaseText4").innerHTML="Collapse All";if(w=="1"){document.getElementById("secCollapse2").setAttribute("src","/images/minusImg_roll.png");document.getElementById("secCollapse3").setAttribute("src","/images/minusImg.png")}if(w=="2"){document.getElementById("secCollapse2").setAttribute("src","/images/minusImg.png");document.getElementById("secCollapse3").setAttribute("src","/images/minusImg_roll.png")}}}}}if(i[1]=="minusImg_roll"){setPosition("collapse","private")}else{setPosition("expand","private")}}
function setMinHeightLarge(){document.getElementById("pubClutter").style.height="275px";document.getElementById("priClutter").style.height="70px"}
function setMinHeightSmall(type)
{ 
	if(get_cookie("lock_status")==""||get_cookie("lock_status")==null)
	{
		document.getElementById("pubClutter").style.height="228px";
		document.getElementById("listItem_0").style.height="225px";
		document.getElementById("priClutter").style.height="58px"
	}
	else
	{ 
		var src = $('#privImg').attr('src');
		if(src == '/images/minus.png')
		{
			document.getElementById("pubClutter").style.height="130px";
			document.getElementById("listItem_0").style.height="129px";
			document.getElementById("priClutter").style.height="148px"
		}
		else
		{
			if(type==null)
			{
				document.getElementById("pubClutter").style.height="228px";
				document.getElementById("listItem_0").style.height="225px";
				document.getElementById("priClutter").style.height="58px";
			}
			else
			{
				document.getElementById("pubClutter").style.height="130px";
				document.getElementById("listItem_0").style.height="129px";
				document.getElementById("priClutter").style.height="148px"
			}
		}
	}
}

function getElementsByClassName(j,k){if(!k){k=document.getElementsByTagName("body")[0]}var m=[];var l=new RegExp("\\b"+j+"\\b");var n=k.getElementsByTagName("*");for(var a=0,i=n.length;a<i;a++){if(l.test(n[a].className)){m.push(n[a])}}return m}
function selectbox(e,f)
{ 
	$('.link').css({backgroundColor:'#ffffff'});
	$('.popup').css({display:'none'});
	var elements = getElementsByClassName('selected_class');for(var i =0;i<elements.length;i++){elements[i].style.display='none';}var g=document.getElementById("selectbox_ul_"+e);if(f=="show"){if(navigator.appVersion.indexOf("MSIE 7")>-1){var h=1000;$("div").each(function(){if(this.className!="link ui-draggable"){$(this).css("zIndex",h);h-=1}});var h=-10;$(".abstract_background").css("zIndex",h)}setTimeout('document.getElementById("selectbox_ul_'+e+'").style.display="block";',100); }if(f=="hide"){g.style.display="none"}}
function IEZstyle(){if(navigator.appVersion.indexOf("MSIE 7")>-1){var b=1;$("div").each(function(){$(this).css("zIndex",b)});$(".abstract_background").css("zIndex",-10);$(".abstract_beach").css("zIndex",-100)}}function tooltipIE7(){if(navigator.appVersion.indexOf("MSIE 7")>-1){var b=1000;$("div").each(function(){if(this.className!="tooltip"){$(this).css("zIndex",b);b-=1}});$(".abstract_background").css("zIndex",-10);$(".abstract_beach").css("zIndex",-100);setStyleIE()}}function loginpopHide(){$("#loginDiv").css("display","none");$("#loginDefault").css("display","block");$("#content").css("zIndex",1000);$("#feedback_form").css("zIndex","")}function setMinHeightSmallUpdate(){var f=document.getElementById("privClutterImg").innerHTML;var d=f.split('<img src="/images/');var e=d[1].split(".png");if(e[0]=="plus"){document.getElementById("pubClutter").style.height="275px";document.getElementById("listItem_0").style.height="265px";document.getElementById("priClutter").style.height="58px"}else{document.getElementById("pubClutter").style.height="128px";document.getElementById("listItem_0").style.height="125px";document.getElementById("priClutter").style.height="140px"}}function setTrashMessage(){if(get_cookie("trashCookie")==null){document.getElementById("trash").innerHTML="Drag item here<br/> to delete"}}function loadjscssfile(d,f){if(f=="js"){var e=document.createElement("script");e.setAttribute("type","text/javascript");e.setAttribute("src",d)}else{if(f=="css"){var e=document.createElement("link");e.setAttribute("rel","stylesheet");e.setAttribute("type","text/css");e.setAttribute("href",d)}}if(typeof e!="undefined"){document.getElementsByTagName("head")[0].appendChild(e)}}
function onCluster(b){document.getElementById("newCluster"+b).setAttribute("src","/images/newCluster_roll.png");temp=document.getElementById("createCluster"+b);temp.style.fontWeight="bold";temp.style.textDecoration="underline";}function offCluster(b){document.getElementById("newCluster"+b).setAttribute("src","/images/newCluster.png");temp=document.getElementById("createCluster"+b);temp.style.textDecoration="none";temp.style.fontWeight="normal"}function highlightLink(b){document.getElementById("addLink"+b).setAttribute("src","/images/add_link_darker.png");temp=document.getElementById("addNewLink"+b);temp.style.fontWeight="bold";temp.style.textDecoration="underline";}function dimLink(b){document.getElementById("addLink"+b).setAttribute("src","/images/add_link.png");temp=document.getElementById("addNewLink"+b);temp.style.fontWeight="normal";temp.style.textDecoration="none";}
function onCollapsepub(c)
{ 
	if(getClassName("ui-state-active") != '')
	{
		var active = getClassName("ui-state-active")[0].id.split('_');
		
		var images = $('#secCollapse_'+active[1]+'_'+c).attr('src').split('images/');
		var d = 'secCollapse_'+active[1]+'_'+c;
		temp1=document.getElementById("collpaseText_"+active[1]+'_'+c);
	}
	else
	{ 
		var images = $('#secCollapse_0_'+c).attr('src').split('images/');
		var d = 'secCollapse_0_'+c;
		temp1=document.getElementById("collpaseText_0_"+c);
	}
	if(images[1] == 'plusImg.png')
	{
		document.getElementById(d).setAttribute("src","/images/plusImg_roll.png")
	}
	else
	{
		document.getElementById(d).setAttribute("src","/images/minusImg_roll.png")
	}
	
	temp=temp1.innerHTML;
	temp1.style.fontWeight="bold";
	temp1.style.textDecoration="underline";

}
function offCollapsepub(c)
{ 
	
	if(getClassName("ui-state-active") != '')
	{
		var active = getClassName("ui-state-active")[0].id.split('_');
		var images = $('#secCollapse_'+active[1]+'_'+c).attr('src').split('images/');
		var d = 'secCollapse_'+active[1]+'_'+c;
		temp1=document.getElementById("collpaseText_"+active[1]+'_'+c);
	}
	else
	{
		var images = $('#secCollapse_0_'+c).attr('src').split('images/');
		var d = 'secCollapse_0_'+c;
		temp1=document.getElementById("collpaseText_0_"+c);
	}
	if(images[1] == 'plusImg_roll.png')
	{
		document.getElementById(d).setAttribute("src","/images/plusImg.png")
	}
	else
	{
		document.getElementById(d).setAttribute("src","/images/minusImg.png")
	}
	
	temp=temp1.innerHTML;
	temp1.style.fontWeight="normal";
	temp1.style.textDecoration="none";

}
function onCollapsepriv(c){temp1=document.getElementById("collpaseText"+c);temp=temp1.innerHTML;temp1.style.fontWeight="bold";temp1.style.textDecoration="underline";if(c=="3"){var d="secCollapse2"}if(c=="4"){var d="secCollapse3"}if(temp=="Collapse All"){document.getElementById(d).setAttribute("src","/images/minusImg_roll.png")}else{document.getElementById(d).setAttribute("src","/images/plusImg_roll.png")}}function offCollapsepriv(c){temp1=document.getElementById("collpaseText"+c);temp=temp1.innerHTML;temp1.style.fontWeight="normal";temp1.style.textDecoration="none";if(c=="3"){var d="secCollapse2"}if(c=="4"){var d="secCollapse3"}if(temp=="Collapse All"){document.getElementById(d).setAttribute("src","/images/minusImg.png")}else{document.getElementById(d).setAttribute("src","/images/plusImg.png")}}function changeclustImage(c,d){if(d=="0"){document.getElementById(c).setAttribute("src","/images/make_roll.png")}if(d=="1"){document.getElementById(c).setAttribute("src","/images/make.png")}}
function clustercollap(e,f){
	var d=document.getElementById("clustercollap_"+e);
	if(getClassName("ui-state-active"))
	{
		active = new Array();
		if(getClassName("ui-state-active") != '')
		{
			var active = getClassName("ui-state-active")[0].id.split('_');
		}
		else
		{
			active[1]=0;
		}
//		if(d.className=="collapseclust_"+e)
//		{ 
			if(f=="0")
			{ 
				if($("#hide"+e).attr("src") == '/images/minus.png')
				{
					document.getElementById("hide"+e).setAttribute("src","/images/minusClust_roll.png");
				}
				else
				{
					document.getElementById("hide"+e).setAttribute("src","/images/plusClust_roll.png");
				}
				
			}
			if(f=="1")
			{ 
				if($("#hide"+e).attr("src") == '/images/minusClust_roll.png')
				{
					document.getElementById("hide"+e).setAttribute("src","/images/minus.png");
				}
				else
				{
					document.getElementById("hide"+e).setAttribute("src","/images/plus.png");
				}
			}
//		}
//		if(d.className=="collapseclust1_"+e)
//		{ 
//			if(f=="0")
//			{ 
//				document.getElementById("hide"+e).setAttribute("src","/images/plusClust_roll.png")
//			}
//			if(f=="1")
//			{ 
//				document.getElementById("hide"+e).setAttribute("src","/images/plus.png")
//			}
//		}
	}
}

function onpubClutter(c){var d=document.getElementById("hide");if(d.alt=="minus"){if(c=="0"){document.getElementById("hide").setAttribute("src","/images/minusClust_roll.png")}if(c=="1"){document.getElementById("hide").setAttribute("src","/images/minus.png")}}if(d.alt=="plus"){if(c=="0"){document.getElementById("hide").setAttribute("src","/images/plusClust_roll.png")}if(c=="1"){document.getElementById("hide").setAttribute("src","/images/plus.png")}}}function onprivClutter(c){var d=document.getElementById("privImg");if(d.alt=="minus"){if(c=="0"){document.getElementById("privImg").setAttribute("src","/images/minusClust_roll.png")}if(c=="1"){document.getElementById("privImg").setAttribute("src","/images/minus.png")}}if(d.alt=="plus"){if(c=="0"){document.getElementById("privImg").setAttribute("src","/images/plusClust_roll.png")}if(c=="1"){document.getElementById("privImg").setAttribute("src","/images/plus.png")}}}function onbluebox(h){if(h=="0"){var e=document.getElementById("titleBoxTop");var f=document.getElementById("titleBoxMiddle");var g=document.getElementById("titleBoxBottom");e.id="titleBoxTop1";f.id="titleBoxMiddle1";g.id="titleBoxBottom1"}if(h=="1"){var e=document.getElementById("titleBoxTop1");var f=document.getElementById("titleBoxMiddle1");var g=document.getElementById("titleBoxBottom1");e.id="titleBoxTop";f.id="titleBoxMiddle";g.id="titleBoxBottom"}}function checkGuestUser(){if((get_cookie("guest_cluster_add")==null)&&(get_cookie("guest_page_login_cookie")==null)){}}function checkemail(g){var e=g;var f=true;var h=/^.+@.+\..{2,3}$/;if(h.test(e)){f=true}else{f=false}return(f)}
function closeBookmarkletPage(){var b=setInterval("closeBookmarklet()",1000)}
function closeBookmarklet(){if(get_cookie("bookmarklet_click")!=null)
{
	if(document.getElementById("blueBox")!=null){document.getElementById("blueBox").style.display="none"}
	if(document.getElementById("guestclutterlabel")!=null){document.getElementById("guestclutterlabel").style.display="none"}
	$('#listItem_0').removeClass('clutterBarDiv');
	$('#listItem_0').addClass('cluster');
	if(navigator.appVersion.indexOf("MSIE 9")>-1)
	{
		if(parseInt(get_cookie("bookmarklet_click"))!= 3)
		{
			$('.getButtonTab').css({display:'none'});
			$('.spanEditId').css({display:'none'});
			$('.divEditId').css({display:'block'});
			$('.newCluster').css({paddingRight:'16px'});
			$('.collapse').css({paddingRight:'16px'});
//			$('#divEditTabEmpty').css({marginLeft:'-10px'});
//			$('#lableEdit').css({paddingTop:'6px'});
			$('#lableDivid').css({marginLeft:'25px'});
		}
	}
	else
	{
		if(get_cookie("bookmarklet_click")!= 3){
			$('.getButtonTab').css({display:'none'});
			$('.spanEditId').css({display:'none'});
			$('.divEditId').css({display:'block'});
			$('.newCluster').css({paddingRight:'16px'});
			$('.collapse').css({paddingRight:'16px'});
//			$('#lableEdit').css({paddingTop:'4px'});
			$('#lableDivid').css({marginLeft:'25px'});
//			$('#divEditTabEmpty').css({marginLeft:'-10px'});
		}
	}
	document.getElementById("pubClutter").style.backgroundImage="none"}
}
function closeclutterbar(){var b=setInterval("closeclutterbaroption()",1000)}function closeclutterbaroption(){if(get_cookie("bookmarklet_click")!=null){if(document.getElementById("guestclutterlabel") != null){document.getElementById("guestclutterlabel").style.display="none"}}}
function createDialogBox(){ 
	var today = new Date();
	today.setTime( today.getTime() );
	expires = 60 * 1000 * 60 * 60 * 24;
	var expires_date = new Date( today.getTime() + (expires) );

	document.cookie = "bookmarklet_click" + "=" +escape(3) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" );

	alert("You can get the browser button later from your account settings.")
	$.ajax({type:"POST",url:"/updateBlueBoxStatus",data:d,success:function(c){ 
		if(document.getElementById("blueBox")!=null){document.getElementById("blueBox").style.display="none"}
	}
	})
	
}
function closeUpdateWindow()
{ 
	var today = new Date();
	today.setTime( today.getTime() );
	expires = 60 * 1000 * 60 * 60 * 24;
	var expires_date = new Date( today.getTime() + (expires) );

	document.cookie = "update_click" + "=" +escape(1) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" );
	document.getElementById("linkBox").style.display="none"
}
function getPosition(d){screenWidth=window.innerWidth;if(document.getElementById("wrapper")!=null){var f=document.getElementById("wrapper")}else{var f=document.getElementById("wrapper1")}if(d=="abstract2"){dleft_width=f.offsetLeft-310}else{dleft_width=f.offsetLeft-160}if(d!="public"){dright_width=f.offsetLeft+885;var e=f.offsetLeft-250}else{dright_width=f.offsetLeft+755;var e=f.offsetLeft-250}if(document.getElementById("abst1")!=null){setTimeout("document.getElementById(\"abst1\").style.left=dleft_width+'px';",10)}if(document.getElementById("abst2")!=null){setTimeout(" document.getElementById(\"abst2\").style.left=dright_width+'px';",10)}if(document.getElementById("abtr3")!=null){setTimeout(' document.getElementById("abtr3").style.right=\''+e+"px';",10)}}function getBackgroundPosition(J){if(J=="private"){if(document.getElementById("mainBoxMiddle")){var D=document.getElementById("mainBoxMiddle")}else{var D=document.getElementById("mainBoxMiddle1")}D.style.height="auto"}var L="";if(document.getElementById("wrapper")!=null){var y=document.getElementById("mainBoxBottom");var M=document.getElementById("wrapper")}else{var y=document.getElementById("mainBoxBottom1");var M=document.getElementById("wrapper1");L="true"}var K=y.offsetTop;var B=K-50;if(L==""){var F=y.scrollHeight+170;var H=y.scrollHeight+420;var v=y.scrollHeight+380}else{var F=y.scrollHeight+360;var H=y.scrollHeight+620;var v=y.scrollHeight+580}var w=y.offsetHeight+170;var N=y.offsetHeight+130;var I=y.offsetLeft;var z=I-270;var C=I-390;var E=I+640;var G=I+960;document.getElementById("cloudleft").style.left=z+"px";document.getElementById("island").style.left=C+"px";document.getElementById("kite").style.left=E+"px";document.getElementById("cloudRight").style.left=G+"px";document.getElementById("island").style.left=C+"px";if(document.documentElement.clientHeight){var u=document.documentElement.clientHeight}else{var u=window.innerHeight}var A=(u-y.offsetHeight)-60;if(document.getElementById("mainBoxMiddle")){var D=document.getElementById("mainBoxMiddle")}else{var D=document.getElementById("mainBoxMiddle1")}var x=D.offsetHeight;if(u>x){}}
function getSkyPosition(p)
{ 
	var j;var l;var o;var n;var m;var j;var k;var r;var q;
 	if(document.getElementById("wrapper")!=null)
 	{ 
	 	 j=document.getElementById("wrapper");
	 	 l=document.getElementById("mainBoxBottom")
 	}
 	else
 	{ 
 		j=document.getElementById("wrapper1");
 		l=document.getElementById("mainBoxBottom1")
 	}
 	o=j.offsetLeft-380;
 	n=j.offsetLeft+825;
 	m=l.offsetTop;
 	if(document.documentElement.clientHeight)
 	{ 
 	 	k=document.documentElement.clientHeight
 	}
 	else
 	{ 
 		k=window.innerHeight
 	}
 	r=k-l.offsetHeight-70;
 	document.getElementById("ray").style.left=o+"px";
 	document.getElementById("birds").style.left=n+"px";
 	if(document.getElementById("mainBoxMiddle"))
 	{ 
 	 	eleBody=document.getElementById("mainBoxMiddle")
 	}
 	else
 	{ 
 		eleBody=document.getElementById("mainBoxMiddle1")
 	}
 	offsetHeightEle=eleBody.offsetHeight;
}
function getBackgroundTopPosition(){var i;var j;var l;var k;var g;var h;if(window.innerHeight){l=window.innerHeight}else{l=document.documentElement.clientHeight}if(document.getElementById("wrapper")!=null){h=document.getElementById("wrapper");i=document.getElementById("mainBoxBottom")}else{h=document.getElementById("wrapper1");i=document.getElementById("mainBoxBottom1")}val2=l-i.offsetHeight;k=h.offsetHeight+450;g=k-300;document.getElementById("cloudRight").style.top=g+"px";document.getElementById("left_cloud").style.top=g+"px"}function getElementsByClassName(j,k){if(!k){k=document.getElementsByTagName("body")[0]}var m=[];var l=new RegExp("\\b"+j+"\\b");var n=k.getElementsByTagName("*");for(var a=0,i=n.length;a<i;a++){if(l.test(n[a].className)){m.push(n[a])}}return m}function highLightTexxt(b){document.getElementById(b).select()}function loginpopHide(){$("#loginDiv").css("display","none");$("#loginDefault").css("display","block");$("#content").css("zIndex",1000);$("#feedback_form").css("zIndex","")}jQuery(function(b){b("#searchBtn").click(function(){var d=b("#hidvalId").attr("value");var a=document.getElementById("autoComplete").value;val=d.split("http");b("#autoComplete").attr("value","search this page or the web");b("input.default-value").focus();b("input.default-value").css("color","#999");if(a!="search this page or the web"){if((d==null)||(val[1]==null)){ 
	if(document.getElementById('bretts') == null)
		{
			window.open("http://www.google.com/cse?cx=partner-pub-4097087019459577%3Apzdb0ork2p7&ie=ISO-8859-1&q="+a+"&sa=Search&siteurl="+window.location.href)
		}
		else
		{
			window.open("http://www.google.com/cse?cx=partner-pub-3794031805111237%3Awxsz3p6ecgq&ie=ISO-8859-1&q="+a+"&sa=Search&siteurl="+window.location.href)
		}
}else{window.open(d)}}})});jQuery(function(b){b("#contactUS").click(function(){b("#mainBoxMiddle").load("/contactUs/public/1");b("#contact_tab").hide();b("#lockId").hide();b("#linkPortion2").hide();b(".link1").hide()})});jQuery(function(b){b("#contactUS1").click(function(){if(document.getElementById("mainBoxMiddle1")!=null){b("#mainBoxMiddle1").load("/contactUs/public/2")}else{if(document.getElementById("mainBoxMiddle")!=null){b("#mainBoxMiddle").load("/contactUs/public/2")}}b(".link1").hide()})});jQuery(function(b){b("#faq1").click(function(){b("#mainBoxMiddle").load("/FAQ/public/1");b("#contact_tab").hide();b("#lockId").hide();b("#linkPortion2").hide()})});jQuery(function(b){b("#faq2").click(function(){if(document.getElementById("linkPortion2")!=null){document.getElementById("linkPortion2").style.display="none"}if(document.getElementById("mainBoxMiddle1")!=null){b("#mainBoxMiddle1").load("/FAQ/public/2")}else{if(document.getElementById("mainBoxMiddle")!=null){b("#mainBoxMiddle").load("/FAQ/public/2")}}})});function oneditLink(d,c){if(d=="0"){document.getElementById("addLinkId_"+c).setAttribute("src","/images/make_roll.png");document.getElementById("addLinkText_"+c).style.fontWeight="bold"}if(d=="1"){document.getElementById("addLinkId_"+c).setAttribute("src","/images/make.png");document.getElementById("addLinkText_"+c).style.fontWeight="normal"}}function ondeleteLink(d,c){if(d=="0"){document.getElementById("deleteLinkId_"+c).setAttribute("src","/images/cross1-03_roll.png");document.getElementById("deleteLinkText_"+c).style.fontWeight="bold"}if(d=="1"){document.getElementById("deleteLinkId_"+c).setAttribute("src","/images/cross1-03.png");document.getElementById("deleteLinkText_"+c).style.fontWeight="normal"}}function onvideoOver(){var d=document.getElementById("guestCont").style.display;var c="guestCloseImg";if(d=="block"){document.getElementById(c).setAttribute("src","/images/minus_roll.png")}else{document.getElementById(c).setAttribute("src","/images/plus_roll.png")}}function offvideoOver(){var d=document.getElementById("guestCont").style.display;var c="guestCloseImg";if(d=="block"){document.getElementById(c).setAttribute("src","/images/minus.png")}else{document.getElementById(c).setAttribute("src","/images/plus.png")}}function checkReload(){var b=setInterval("checkPageRefresh()",1500)}function checkPageRefresh(){ 
	if(get_cookie("pagereload")!=null){ 
		delete_cookie("pagereload");
		if(get_cookie("clutter_add")!=null)
		{ 
			delete_cookie("clutter_add");
			
//			setTimeout(function(){window.location=window.location.href},100);
		}
		else
		{
			
//			window.location='http://'+window.location.host;
		}
		setTimeout(function(){window.location=window.location.href},100);
		
	}}
function setTabTimeOut(){idleTime=0;if(get_cookie('timer')!= null){idleTime=1800-get_cookie('timer');}var b=setInterval("timerIncrement()",1000);$("#pubProDiv").mousemove(function(a){idleTime=0})}
function timerIncrement(){ if(get_cookie('turn_off_timer') == null){idleTime++;if(idleTime>1800){if(get_cookie("privateLock")!=null){idleTime=180}else{if(get_cookie('reset_timer') != null){idleTime=0; delete_cookie('reset_timer');} else {doPreload()}}}}}
function doPreload(){if(get_cookie("lock_status")!=null){delete_cookie("lock_status");$("#tabs-2").load("/enterPasscode");setMinHeightSmall();var f=document.getElementsByTagName("body");var e=document.getElementsByTagName("*");for(var g=0;g<e.length;g++){if(e[g].className=="ac_results"){f[0].removeChild(e[g])}}loadjscssfile("/js/jquery.autocomplete.js","js");$("#priClutter").addClass("privateClutterBlue");$("#priClutter").css("overflow","hidden");$("#priClutter").css("border-bottom","3px solid #d8d8d8");$("#privaSeparator").css("display","none");$("#showPrivateLinks").html("Private Clusters");$('#tabs-1').css({'display':'block'}); $("#priClutter").html('<div class="yellowLock" style="margin-right:7px;"><a href="#" onclick="setPrivacyTab();"><input type="image"  style="border:2px solid #E19D38;" alt="Private Clutter Lock" src="/images/privateClutterYellowLock.gif" name="Lock"/> </a></div>	<div class="privateClutterText" style="font-family:arial;font-size:12px;font-weight:normal;margin-top:15px;"> <a href="#" style="font-size:13px" onclick="setPrivacyTab();">Open privacy tab</a><br/> to view hidden clutter. </div>');$("#tabs-1").removeClass("ui-tabs-hide");$("#priProDiv").addClass("ui-state-default ui-corner-top ui-droppable");$("#priProDiv").removeClass("ui-state-active");$("#priProDiv").removeClass("ui-tabs-selected");$("#pubProDiv").addClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-droppable");$("#tabs-2").addClass("ui-tabs-hide");$("#showImage").attr("src","/images/locked.gif");$("#privateClutImg").attr("src","/images/privateClutterLock.gif");$("#privaSeparator").css("display","none");$("#privatepro").attr("src","/images/mylinks.gif");$("#lockId").css({visibility:"hidden"});$(".link1").css({display:"block"});$("#pubProDiv").droppable("destroy");
$("#priProDiv").droppable({accept:".cluster, .link",hoverClass:"trashFeedback",tolerance:"touch",over:function(b,c){a("#pubProDiv").css("margin-top","0px");a("#pubProDiv").css({height:"30px"})},out:function(b,c){a("#pubProDiv").css("margin-top","1px");a("#pubProDiv").css({height:"30px"})},
drop:function(i,h)
	{
		var d=document.getElementsByTagName("body");
		var g=document.getElementsByTagName("*");
		for(var c=0;c<g.length;c++) 
		{ 
			if(g[c].className=="ac_results") 
			{ 
				d[0].removeChild(g[c])
			}
		}
		loadjscssfile("/js/jquery.autocomplete.js","js");
		loadjscssfile("/js/autocompleteAction.js","js");
		var f=a(h.draggable).attr("id").split("_");
		a("#selectbox_ul_"+f[1]).unbind("mouseover");
		a(h.draggable).unbind("click");
		var b=navigator.appName;a("#pubProDiv").css("margin-top","1px");
		a("#pubProDiv").css({height:"30px"});
		a("#priProDiv").css({margin:"0 0.2em -1px 0"});
		if(f[0]=="linkList") 
		{ 
			a(h.helper).remove();
			set_cookie("drag_cookie",a(h.draggable).attr("id"));
			if(get_cookie('drag-element') == null) {
				a.get("/updateCluster/"+a(h.draggable).attr("id")+"_1");
				setTimeout(function(){a("#clusterLinkId").load("/showPrivateLinks")},300);
			}
			else
			{
				var tt = get_cookie('drag-element');
				var tt = tt.split(',');
				var val = new Array();
				valString = '';
				for(var j=0;j<tt.length;j++)
				{
					if(jQuery.inArray(tt[j], val) == -1)
					{
						valString = valString+tt[j]+'_';
						val.push(tt[j]);
						$('#linkList_'+tt[j]).remove();
					}
				}
				var dragId = get_cookie('drag-element-id');
				if(dragId ==0)
				{
					var value = $('#linkCount').html();
					var splitVal = value.split('(');
					var splitval1 = splitVal[1].split(')');
					var count=parseInt(splitval1[0]);
					var countVal1 = count-parseInt(val.length);
					if(countVal1 == 0)
					{
						$('.multipleCheckboxText').css({display:'none'});
						$('.selectMenuId_'+dragId).css({display:'none'});

					}
					setTimeout(function(){$('#linkCount').html('('+countVal1+')');},100);
				}
				else if(dragId ==-10)
				{
					var value = $('#linkCountPrivate').html();
					var splitVal = value.split('Clutter(');
					var splitval1 = splitVal[1].split(')');
					var count=parseInt(splitval1[0]);

					var countVal1 = count-parseInt(val.length);
					if(countVal1 == 0)
					{
						$('.multipleCheckboxText').css({display:'none'});
						$('.selectMenuId_'+dragId).css({display:'none'});

					}
					setTimeout(function(){$('#linkCountPrivate').html('Hidden Clutter('+countVal1+')');},100);
				}
				else
				{
					var value = $('#linkCountId_'+dragId).html();
					var splitVal = value.split('(');
					var splitval1 = splitVal[1].split(')');
					var count=parseInt(splitval1[0]);

					var countVal1 = count-parseInt(val.length);
					if(countVal1 == 0)
					{
						$('.multipleCheckboxText').css({display:'none'});
						$('.selectMenuId_'+dragId).css({display:'none'});
						$('#linkCountId_'+dragId).html('(empty)');
						$('#showClustersImg_'+dragId).css({visibility:'hidden'});
						var w=$("#linksDivId_"+dragId);
						$('.delete_'+dragId).css({display:'block'});
						$('.share_'+dragId).css({display:'block'});
						$('.edit_'+dragId).css({display:'block'});
						$('.turnOff_'+dragId).css({display:'none'});
						$('.multiMove_'+dragId).css({display:'block'});
						w.html('<div class="link" style="border: medium none ; display: none; padding-bottom: 0px; cursor: move;"> </div>')
					}
					else
					{
						$('#linkCountId_'+dragId).html('('+countVal1+')');
					}
					
				}
				var value = $('#linkCountPrivate').html();
				var splitVal = value.split('Clutter(');
				var splitval1 = splitVal[1].split(')');
				var count=parseInt(splitval1[0]);

				var countVal = count+parseInt(val.length);
				setTimeout(function(){$('#linkCountPrivate').html('Hidden Clutter('+countVal+')');},100);
				setTimeout(function(){$('#listItem_-10').load('/updateClusters/-10/'+valString);},200);
				set_cookie('update-trash-links');
				delete_cookie('drag-element');
			}
//			setMinHeightSmall()
		}
		else 
		{ 
			a.get("/updateCluster/"+a(h.draggable).attr("id")+"_1");
			setTimeout(function(){a("#privateClutDiv").load("/getPrivateClusters")},300)
		}
		a(h.draggable).css({display:"none"});
		displayDragSuccessMessage("Moving to privacy tab.")}
});
if(document.getElementById("mainBoxMiddle")){var h=document.getElementById("mainBoxMiddle")}else{var h=document.getElementById("mainBoxMiddle1")}h.style.height="auto"}
}
(function(b){b.fn.showMenu=function(a){var d=b.extend({},b.fn.showMenu.defaults,a);b(this).bind("click",function(c){var e=b(d.query).width();b(d.query).show().css({top:c.pageY+"px",left:(c.pageX-e)+"px",position:"absolute",opacity:d.opacity,zIndex:d.zindex});return false});b(document).bind("mousedown",function(c){if(b(c.target).parents(d.query).size()>0&&d.handler){d.handler(c)}b(d.query).hide()})};b.fn.showMenu.defaults={zindex:2000,query:document,opacity:1}})(jQuery);
jQuery(function(c)
{var d=100;c("div.cluster").each(function()
{var a=c(this);setTimeout(function()
{a.sortable({items:".link",
scroll: true,
//connectWith:[".cluster"],
forcePlaceholderSize:true,
forceHelperSize:true,
dropOnEmpty:true,
helper: 'clone',
revert:true,
appendTo: 'body',
//distance:30,
tolerance: 'pointer',
//refreshPositions: true,
start:function(b,e){
	delete_cookie('update-trash-links');
	delete_cookie('drag-element-id');
	delete_cookie('drag-element');
	delete_cookie('receive');
	var idElements = this.id.split('_');
	set_cookie('drag-element-id', idElements[1]);
	var multiCookie= get_cookie('multimove');
	if(get_cookie('single-drag-element') != null)
	{
		c(e.helper).addClass("dragging");
	}
	else
	{
		if((get_cookie('multimove') != null) && (multiCookie == idElements[1]))
		{

			var id = c(e.item).attr('id').split('_');
			if($('#'+id[1]).attr('checked') == false)
			{
				c(e.helper).addClass("dragging")
				set_cookie('single-drag-element');
			}
			else
			{
				$('.link').css({backgroundColor:'#ffffff'});
				c(e.helper).addClass("dragging2");
				var val = [];
				var counter = 0;
				var items = $('input:checked');
				var select =$("input:checkbox[name=type"+idElements[1]+"]:checked").size()-1;
				var selected = new Array();
	
				multiCheckboxes = getClassName('multi_'+idElements[1]);
				for(var t=0;t<multiCheckboxes.length;t++)
				{
					if($('#'+multiCheckboxes[t].id).attr('checked') == true)
					{
						selected.push($('#'+multiCheckboxes[t].id).val());
						$('#linkList_'+$('#'+multiCheckboxes[t].id).val()).css({display:'none'});
					}
				}
				if(selected.length > 0)
				{
					set_cookie('drag-element', selected);
					counter = selected.length-1;
					c(e.helper).html('<div style="padding-left:40px;">Move '+counter+' links</div>');
				}
			}
		}
		else
		{
			c(e.helper).addClass("dragging")
			set_cookie('single-drag-element');

		}
	}
},
receive: function(event, ui)
{
	var C="#"+this.id;var B=c(C).sortable("serialize");
	var x=B.split("&");
	var positionVal = new Array();
	var itemListArray = new Array();
	for(var y=0;y<x.length;y++)
	{
		var xx = x[y].split('=');
		positionVal.push(xx[1]);

	}
	$ids = this.id.split('_');
	delete_cookie('drag-element-id');
	if(get_cookie('single-drag-element') == null) {
		if(get_cookie('multimove') != null)
		{
			var tt = get_cookie('drag-element');
			if(tt != null)
			{
				var tt = tt.split(',');
				var val = new Array();
				valString = '';
				for(var j=0;j<tt.length;j++)
				{ 
					if(checkArray(val,tt[j]) == -1)
					{
						val.push(tt[j]);

						var position = getPositionVal(positionVal, tt[j]);
						if(parseInt(position))
						{
							var positionLink = position;
						}
						valString = valString+tt[j]+'_';
						$('#fav_'+tt[j]).attr('id', 'fav_'+$ids[1]);
					}
				}
				if(positionLink)
				{
					valString = '';
					var itemVal = positionVal[positionLink];
					var position1 = getPositionVal(val, itemVal);
					position=parseInt(position1)+parseInt(positionLink);
					itemListArray[position] = itemVal;
					var g = parseInt(position1)-parseInt(positionLink);
					var ttVal = position1-1;
					for(var t=0; t<=position1-1;t++)
					{
						var po = position-1;
						var itemPos = po - ttVal;
						itemListArray[itemPos]=val[t];
						ttVal =ttVal-1;
					}
					for(var u=position1+1; u<val.length;u++)
					{
						var pos = u -position1;
						var posi = parseInt(pos)+parseInt(position);
						itemListArray[parseInt(posi)]=val[u];
					}
					for(var e=0;e<positionVal.length;e++)
					{
						if(positionVal[e] != itemVal)
						{
							if(e>positionLink)
							{
								var maxLength = val.length - position1;
								maxLength1=parseInt(maxLength)+parseInt(positionLink);
								itemListArray[itemListArray.length]=positionVal[e];
							}
							else
							{
								itemListArray[e]=positionVal[e];
							}
						}
					}
					for(var j=0;j<itemListArray.length;j++)
					{
						valString = valString+itemListArray[j]+'_';
					}
				}
				else
				{
					valString = '';
					for(var t=0;t<val.length; t++)
					{
						itemListArray.push(val[t]);
					}
					for(var r =0; r<positionVal.length;r++)
					{
						if(jQuery.inArray(positionVal[r], itemListArray) == -1)
						{
							itemListArray.push(positionVal[r]);
						}
					}
					for(var j=0;j<itemListArray.length;j++)
					{
						valString = valString+itemListArray[j]+'_';
					}
				}
				if($ids[1] ==0)
				{
					var value = $('#linkCount').html();
					var splitVal = value.split('(');
					var splitval1 = splitVal[1].split(')');
					var valueNew = parseInt(splitval1[0])+parseInt(val.length);
					set_cookie('link-count',parseInt(val.length));
//					$('#linkCount').html('('+valueNew+')'); 
					setTimeout(function(){$('#listItem_0').load('/updateClusters/'+$ids[1]+'/'+valString);},500);
				}				
				else
				{
					var value = $('#linkCountId_'+$ids[1]).html();
					var splitVal = value.split('(');
					var splitval1 = splitVal[1].split(')');
					val11 = jQuery.unique(val);
					if(splitval1[0] != 'empty')
					{
						var valueNew = parseInt(splitval1[0])+parseInt(val11.length);
					}
					else
					{
						var valueNew = parseInt(val11.length);
					}
//					$('#linkCountId_'+$ids[1]).html(' ('+valueNew+')');
//					document.getElementById('linkCountId_'+$ids[1]).style.color='#7D9D30';
					set_cookie('link-count',parseInt(val.length));
					setTimeout(function(){$('#linksDivId_'+$ids[1]).load('/updateClusters/'+$ids[1]+'/'+valString);},500);
				}
				for(var y=0;y<val.length;y++)
				{
					$('#linkList_'+val[y]).remove();
				}
				set_cookie('receive',1);
			}
			
		}
	}
	else
	{
		linkid = ui.item.attr('id');
		linkIdVal = linkid.split('_');
		if($ids[1] == 0 || $ids[1] == -10)
		{
			$('.linkDrag_'+linkIdVal[1]).attr("id",'menuLink__'+linkIdVal[1]);
		}
		else
		{
			$('.linkDrag_'+linkIdVal[1]).attr("id",'menuLink_'+$ids[1]+'_'+linkIdVal[1]);
		}
		
		$('.rightMenu4_'+linkIdVal[1]).attr("id",'rightMenu4_'+$ids[1]+'_'+linkIdVal[1]);
		$('#favId_'+linkIdVal[1]).attr("class",'icon1 fav_'+$ids[1]);
		$('#'+linkIdVal[1]).attr("class",'multi_'+$ids[1]+' multipleCheckbox');
		$('#'+linkIdVal[1]).attr("name",'type'+$ids[1]);
		$('#favId_'+linkIdVal[1]).css({display:'block'});
		$('#'+linkIdVal[1]).css({display:'none'});
		if($ids[1] == 0)
		{
			var cluId = 'menuLink__'+linkIdVal[1];
		}
		else
		{
			var cluId = 'menuLink_'+$ids[1]+'_'+linkIdVal[1];
		}
		document.getElementById('favId_'+linkIdVal[1]).onmouseout = function(){document.getElementById(cluId).style.textDecoration='none';}
		document.getElementById('favId_'+linkIdVal[1]).onmouseover = function(){document.getElementById(cluId).style.textDecoration='underline';}
	}
	$('.selectMenuId_'+$ids[1]).css({display:'block'});
	$('#showClustersImg_'+$ids[1]).css({visibility:'visible'});
},

stop:function(e,l){ 
	if(get_cookie('update-trash-links') == null )
	{
		var b=this.id.split("_");c(l.item).css({width:""}).removeClass("dragging");c(".cluster").sortable("enable");
		var o=document.getElementsByTagName("body");var m=document.getElementsByTagName("*");if(get_cookie("guest_cluster_add")!=null|| get_cookie("guest_cookie")!=null){var n=new Date().getTime();c("#info").load("/updateAccountAction/"+n)}if(document.getElementById("mainBoxMiddle")){var p=document.getElementById("mainBoxMiddle")}else{var p=document.getElementById("mainBoxMiddle1")}
		//		        if(get_cookie("drag_cookie")!=null){delete_cookie("drag_cookie");if(b[1]==0){c("#linkCount").load("/getCount/0")}}
		//		        if(get_cookie("drag_public_cookie")!=null){delete_cookie("drag_public_cookie");if(b[1]==-10){c("#linkCountPrivate").load("/getCount/1")}}
		if(get_cookie('single-drag-element') == null) {
			var multiCookie= get_cookie('multimove');
			if((get_cookie('multimove') != null))
			{
				if(get_cookie('receive') == null)
				{
					var tt = get_cookie('drag-element');
					var tt = tt.split(',');
					var val = new Array();
					for(var j=0;j<tt.length;j++)
					{
						if(jQuery.inArray(tt[j], val) == -1)
						{
							val.push(tt[j]);
							$('#linkList_'+tt[j]).css({display:'block'});
							$('#linkList_'+tt[j]).css({backgroundColor:'#F8FF64'});
						}
					}
				}
				else if(parseInt(get_cookie('receive')) == 1)
				{
					if(multiCookie == b[1]){
						var itemCount = get_cookie('link-count');
						if(b[1] ==0)
						{
							var countVal = $('.listRowRight > div').size();
							if(countVal == 0)
							{
								setTimeout(function(){$('#linkCount').html('(0)');},500);
								$('#multiSelect_'+b[1]).css({display:'none'});
								$('#showClustersImg_'+b[1]).css({visibility:'hidden'});
								var w=c("#linksDivId_"+b[1]);
								w.html('<div class="link" style="border: medium none ; display: none; padding-bottom: 0px; cursor: move;"> </div>')
							}
							else
							{
								setTimeout(function(){$('#linkCount').html(' ('+countVal+')');},500);
							}
						}						
						else
						{
							var countVal = $('#linksDivId_'+b[1]+' > div').size();
							if(countVal == 0)
							{
								setTimeout(function(){$('#linkCountId_'+b[1]).html('(empty)');},500);
								document.getElementById('linkCountId_'+b[1]).style.color='grey';
								delete_cookie('multimove');
								$('#multiSelect_'+b[1]).css({display:'none'});
								$('#showClustersImg_'+b[1]).css({visibility:'hidden'});
								$('.delete_'+b[1]).css({display:'block'});
								$('.share_'+b[1]).css({display:'block'});
								$('.edit_'+b[1]).css({display:'block'});
								$('.turnOff_'+b[1]).css({display:'none'});
								$('.multiMove_'+b[1]).css({display:'block'});
								var w=c("#linksDivId_"+b[1]);
								w.html('<div class="link" style="border: medium none ; display: none; padding-bottom: 0px; cursor: move;"> </div>')
							}
							else
							{
								setTimeout(function(){$('#linkCountId_'+b[1]).html(' ('+countVal+')');},500);
							}
						}
						var C="#"+this.id;
						var B=c(C).sortable("serialize");
						var x=B.split("&");
						if(B.length<1)
						{c("#showClustersImg_"+b[1]).css({visibility:"hidden"})}
						else{c("#showClustersImg_"+b[1]).css({visibility:"visible"})}
						for(var y=0;y<x.length;y++)
						{
							var E=x[y].split("[]=");
							if(y!=0){c("#linkList_"+E[1]).css("border-top","1px solid #D7D9D8")}
							else{c("#linkList_"+E[1]).css("border-top","0px solid #D7D9D8")}
						}

						delete_cookie('link-count');
						delete_cookie('drag-element');
						set_cookie('single-drag-element');
						delete_cookie('receive')
					}

				}

			}
		}
	}
	else
	{
		delete_cookie('update-trash-links');
		delete_cookie('drag-element-id');
		delete_cookie('drag-element');
		delete_cookie('receive');
	}
	delete_cookie("drag_cookie");
	delete_cookie('single-drag-element');
},
over:function(event, ui) {
	var ids = this.id.split("_");var imageID ='#hide'+ids[1]; image = $(imageID).attr("src");
	if(image) {
		if(image == '/images/plus.png')
		{
			document.getElementById('showclusters_'+ids[1]).style.display = 'block';
		} else if(image != '/images/minus.png') {
			if(document.getElementById('showClustersImg_'+ids[1]).style.visibility == 'hidden')	{
				document.getElementById('showclusters_'+ids[1]).style.display = 'block';
			}
		}
	}
},
out: function(event, ui)
{var ids = this.id.split("_");var imageID ='#hide'+ids[1]; image = $(imageID).attr("src");
if(image == '/images/plus.png')
{
	document.getElementById('showclusters_'+ids[1]).style.display = 'none';
}
},

update:function(D,b){
	if((get_cookie("drag_cookie")==null)&&(get_cookie("drag_public_cookie")==null)){
		var multiCookie= get_cookie('multimove');
		var C="#"+this.id;var i=this.id.split("_");
		if(get_cookie('single-drag-element') != null) {
			var clusterUId= i[1];
			var B=c(C).sortable("serialize");
			var x=B.split("&");
			if(B.length<1)
			{c("#showClustersImg_"+i[1]).css({visibility:"hidden"})}
			else{c("#showClustersImg_"+i[1]).css({visibility:"visible"})}
			for(var y=0;y<x.length;y++)
			{
				var E=x[y].split("[]=");
				if(y!=0){c("#linkList_"+E[1]).css("border-top","1px solid #D7D9D8")}
				else{c("#linkList_"+E[1]).css("border-top","0px solid #D7D9D8")}
			}
			if(get_cookie("guest_cluster_add")!=null)
			{
				c("#info").load("/updatePosition/link_"+this.id+"/"+B)
			}
			else
			{
				c.get("/updatePosition/link_"+this.id+"/"+B)
				c.get("/updateDragBonus");
			}
			if(B.length==0)
			{ 
				x.length=0
			}
			var t=/chrome/.test(navigator.userAgent.toLowerCase());

				if(i[1]==-10)
				{ 
					var z = 'Hidden Clutter('+x.length+')';
					c("#linkCountPrivate").html(z)
				}
				else
				{
					if(i[1]==0)
					{ 
						if(get_cookie('cltter_bar') == null)
						{
							var v=document.getElementById("guestClutter");
							if(v!=null) 
							{ 
								var u=document.getElementById("listItem_0");
								if(x.length==0)
								{ 
									v.style.display="block"
								}
								else
								{ 
									v.style.display="none"
								} 
							}
							var count = '('+x.length+')';
							$("#linkCount").html(count);
						}
						delete_cookie('cltter_bar');
					}
					else
					{ 
						if(x.length == 0)
						{ 
							var term = 'empty';
							$('#linkCountId_'+i[1]).css("color","#999999");
						}
						else 
						{ 
							var term=x.length;
//							$('#linkCountId_'+i[1]).css("color","#7D9D30");
						}
						document.getElementById('linkCountId_'+i[1]).innerHTML = ' ('+term+')';
						var w=c("#linksDivId_"+i[1]);
						if(w.children().length==0)
						{ 
							w.html('<div class="link" style="border: medium none ; display: none; padding-bottom: 0px; cursor: move;"> </div>');
							$('#multiSelect_'+i[1]).css({display:'none'});
							$('.selectMenuId_'+i[1]).css({display:'none'});
							delete_cookie('multimove');
						}
					}
				}
		}

}else{}
}}).sortable( "option", "connectWith", ".cluster" );
},200)});
                		
c(".trash").droppable({accept:".link,.cluster",hoverClass:"trashImage",tolerance:'intersect',drop:function(b,e){
	
	set_cookie("trashCookie",1,2000);id=c(e.draggable).attr("id").split("_");
	if(id[0]=="listItem"){
		if(onSubmitDeleteCluster())
		{ 
			if(get_cookie('drag_category_tab') == 0)
			{
				$('#newFeature').css({display:'block'});
			}
			c.get("/deleteSortableLink/"+c(e.draggable).attr("id"));
			c(e.draggable).css({display:"none"});
			var elementsCluster = getClassName('clusterTab_'+get_cookie('edit_tab_id'));
			var counter = 0;
			if(elementsCluster.length >0)
			{
				for(var t =0;t<elementsCluster.length; t++)
				{
					if(elementsCluster[t].style.display != 'none')
					{
						counter = counter+1;
					}
				}
			}
			if(counter == 1 || counter == 0)
			{
				$('#linkPortion1').css({display:'none'});
				$('#linkPortion2').css({display:'none'});
				$('#emptyTabMenu').css({display:'block'});
				$('#publicClusterDiv1'+get_cookie('edit_tab_id')).css({display:'none'});
				$('.thickbox').unbind('click');
				loadjscssfile("/js/jqueryThickbox.js","js");
				$('#publicClusterDiv'+get_cookie('edit_tab_id')).css({display:'block'});
			}
			set_cookie('trash_delete','cluster_'+ c(e.draggable).attr("id"));
			set_cookie('drag_category_tab',1);
			displayTrashMessage('cluster');
		}
	}
	else
	{
		c(e.draggable).css({display:"none"});
		c(e.helper).css({display:"none"});
		c(e.helper).remove();
		var h=c(e.draggable).parent().attr("id");
		
		if(h== '')
		{
			var h=c(e.draggable).parent().parent().attr("id");
		}
		var a=/chrome/.test(navigator.userAgent.toLowerCase());
		if(get_cookie('drag-element') == null) 
		{
			if(navigator.appVersion.indexOf("MSIE 7")>-1||navigator.appVersion.indexOf("MSIE 8")>-1)
            {
               setTimeout(function(){c(e.draggable).css({display:"none"});},600)
               if(h == 'listRowRightDiv')
				{
					set_cookie('cltter_bar',1);
					var count = $('#linkCount').html();
					var countSp = count.split('(');
					var count11 = countSp[1].split(')');
					var countOriginal = count11[0] - 1;
					$('#linkCount').html('('+countOriginal+')');
				}
            }
            else
            { 
            	if(a==true)
                {
                    c(e.draggable).css({display:"none"});
                 	c(e.draggable).remove()
                    c(e.helper).remove();
                }
                else
                {
                    if(navigator.appVersion.indexOf("Safari")>-1)
                    {
                        c(e.draggable).css({display:"none"});
                        c(e.helper).css({display:"none"});
                    }
                    else
                    {
                        c(e.draggable).remove()
                        c(e.helper).remove();
                    }
                }
        	}
        	if(get_cookie('right_click_cookie') != 1)
			{
				$('#newFeature').css({display:'block'});
			}
        	set_cookie('right_click_cookie','1');
         	c.get("/deleteSortableLink/"+c(e.draggable).attr("id"));
			set_cookie('trash_delete','link_'+ c(e.draggable).attr("id"));
			set_cookie('trash_delete_link_parent',h);
			displayTrashMessage('link');
			
		}
		else
		{
			set_cookie('receive',0);
			var tt = get_cookie('drag-element');
			var tt = tt.split(',');
			var val = new Array();
			valString = '';
			var trashString = '';
			if(tt.length >2)
			{
				if(onSubmitDeleteLinks())
				{
					c(e.helper).remove();
					setTimeout(function(){c(e.draggable).css({display:"none"});},600)
					for(var j=0;j<tt.length;j++)
					{
						if(jQuery.inArray(tt[j], val) == -1)
						{
							valString = valString+tt[j]+'_';
							trashString = trashString+tt[j]+'-';
							val.push(tt[j]);
							$('#linkList_'+tt[j]).remove();
						}
					}
	
					var dragId = get_cookie('drag-element-id');
					if(dragId ==0)
					{
						var value = $('#linkCount').html();
						var splitVal = value.split('(');
						var splitval1 = splitVal[1].split(')');
						var count=parseInt(splitval1[0]);
						var countVal = count-parseInt(val.length);
						if(countVal == 0)
						{
							$('.multipleCheckboxText').css({display:'none'});
							$('.selectMenuId_'+dragId).css({display:'none'});
	
						}
						setTimeout(function(){$('#linkCount').html('('+countVal+')');},100);
					}
					else if(dragId ==-10)
					{
						var value = $('#linkCountPrivate').html();
						var splitVal = value.split('Clutter(');
						var splitval1 = splitVal[1].split(')');
						var count=parseInt(splitval1[0]);
	
						var countVal = count-parseInt(val.length);
						if(countVal == 0)
						{
							$('.multipleCheckboxText').css({display:'none'});
							$('.selectMenuId_'+dragId).css({display:'none'});
	
						}
						setTimeout(function(){$('#linkCountPrivate').html('Hidden Clutter('+countVal+')');},100);
					}
					else
					{
						var value = $('#linkCountId_'+dragId).html();
						var splitVal = value.split('(');
						var splitval1 = splitVal[1].split(')');
						var count=parseInt(splitval1[0]);
	
						var countVal = count-parseInt(val.length);
						if(countVal == 0)
						{
							$('.multipleCheckboxText').css({display:'none'});
							$('.selectMenuId_'+dragId).css({display:'none'});
							$('#linkCountId_'+dragId).html('(empty)');
							$('#showClustersImg_'+dragId).css({visibility:'hidden'});
							var w=c("#linksDivId_"+dragId);
							$('.delete_'+dragId).css({display:'block'});
							$('.share_'+dragId).css({display:'block'});
							$('.edit_'+dragId).css({display:'block'});
							$('.turnOff_'+dragId).css({display:'none'});
							$('.multiMove_'+dragId).css({display:'block'});
							if(document.getElementById('linksDivId_'+dragId) != null)
							{ 
								var ni =document.getElementById('linksDivId_'+dragId);
								var newdiv = document.createElement('div');
								newdiv.setAttribute('class','link');
								newdiv.setAttribute('style','border: medium none ; display: none; padding-bottom: 0px; cursor: move;');
								newdiv.innerHTML = '';
								ni.appendChild(newdiv);
//								document.getElementById('linksDivId_'+dragId).innerHTML = "<div class='link' style='border: medium none ; display: none; padding-bottom: 0px; cursor: move;'> </div>"
							}
						}
						else
						{
							$('#linkCountId_'+dragId).html('('+countVal+')');
						}
	
					}
					if(get_cookie('right_click_cookie') != 1)
					{
						$('#newFeature').css({display:'block'});
					}
					set_cookie('right_click_cookie','1');
					$.get("/deleteSortableLink/"+c(e.draggable).attr("id")+'/'+valString);
					delete_cookie('drag-element');
					set_cookie('trash_delete','links_'+ trashString);
					set_cookie('trash_delete_link_count',val.length);
					set_cookie('trash_delete_link_parent',h);
					displayTrashMessage('links');
				}
				else
				{
					var tt = get_cookie('drag-element');
					set_cookie('update-trash',tt);
					set_cookie('update-trash-links',tt);
					var tt = tt.split(',');
					c(e.helper).remove();
					var h=c(e.draggable).parent().parent().attr("id"); 
					var listItems = h.split('_');
					var deleteItem = c(e.draggable).attr("id");
					$('#'+deleteItem).remove();
					var val = new Array();
					valString = '';
					for(var j=0;j<tt.length;j++)
					{
						if(jQuery.inArray(tt[j], val) == -1)
						{
							valString = valString+tt[j]+'_';
						}
					}
					if(listItems[1] == -10)
					{
						setTimeout(function(){$('#listItem_-10').load('/updateTrashLinks/'+listItems[1]);},100);
					}
					else if(listItems[1] == 0)
					{
						setTimeout(function(){$('#listItem_0').load('/updateTrashLinks/'+listItems[1]);},100);
					}
					else
					{
						setTimeout(function(){$('#linksDivId_'+listItems[1]).load('/updateTrashLinks/'+listItems[1]);},100);
					}
					
					delete_cookie('drag-element');

				}
			}
			else
			{
				if(get_cookie('right_click_cookie') != 1)
				{
					$('#newFeature').css({display:'block'});
				}
				set_cookie('right_click_cookie','1');
				c.get("/deleteSortableLink/"+c(e.draggable).attr("id"));
				c(e.helper).remove();
				c(e.draggable).remove();
				
				var dragId = get_cookie('drag-element-id');
				delete_cookie('drag-element');
				if(dragId ==0)
				{
					var value = $('#linkCount').html();
					var splitVal = value.split('(');
					
					var splitval1 = splitVal[1].split(')');
					var count=parseInt(splitval1[0]);
					var countVal = count-1;
					if(countVal == 0)
					{
						$('.multipleCheckboxText').css({display:'none'});
						$('.selectMenuId_'+dragId).css({display:'none'});

					}
					setTimeout(function(){$('#linkCount').html('('+countVal+')');},100);
				}
				else if(dragId ==-10)
				{
					var value = $('#linkCountPrivate').html();
					var splitVal = value.split('Clutter(');
					var splitval1 = splitVal[1].split(')');
					var count=parseInt(splitval1[0]);

					var countVal = count-1;
					if(countVal == 0)
					{
						$('.multipleCheckboxText').css({display:'none'});
						$('.selectMenuId_'+dragId).css({display:'none'});

					}
					setTimeout(function(){$('#linkCountPrivate').html('Hidden Clutter('+countVal+')');},100);
				}
				else
				{
					var value = $('#linkCountId_'+dragId).html();
					var splitVal = value.split('(');
					var splitval1 = splitVal[1].split(')');
					var count=parseInt(splitval1[0]);

					var countVal = count-1;
					if(countVal == 0)
					{
						$('.multipleCheckboxText').css({display:'none'});
						$('.selectMenuId_'+dragId).css({display:'none'});
						$('#linkCountId_'+dragId).html('(empty)');
						$('#showClustersImg_'+dragId).css({visibility:'hidden'});
						var w=c("#linksDivId_"+dragId);
						$('.delete_'+dragId).css({display:'block'});
						$('.share_'+dragId).css({display:'block'});
						$('.edit_'+dragId).css({display:'block'});
						$('.turnOff_'+dragId).css({display:'none'});
						$('.multiMove_'+dragId).css({display:'block'});
						w.html('<div class="link" style="border: medium none ; display: none; padding-bottom: 0px; cursor: move;"> </div>')
					}
					else
					{
						$('#linkCountId_'+dragId).html('('+countVal+')');
					}

				}
				if(get_cookie('right_click_cookie') != 1)
				{
					$('#newFeature').css({display:'block'});
				}
				set_cookie('right_click_cookie','1');
				c.get("/deleteSortableLink/"+c(e.draggable).attr("id"));
				set_cookie('trash_delete','link_'+ c(e.draggable).attr("id"));
				set_cookie('trash_delete_link_parent',h);
				displayTrashMessage('link');
			}
		}

	}
}});
    c("div.pane").sortable({handle:".header",forcePlaceholderSize:true,forceHelperSize:true,dropOnEmpty:true,revert:true,tolerance: 'pointer',cursor:"crosshair",start:function(a,b){c(b.helper).addClass("dragging")},stop:function(a,b){c(b.item).css({width:""}).removeClass("dragging");c(".pane").sortable("enable");if(get_cookie("guest_cluster_add")!=null || get_cookie("guest_cookie")!=null){var e=new Date().getTime();c("#info").load("/updateAccountAction/"+e)}
   },update:function(b,a){ 
   	var f=c("#"+this.id).sortable("serialize");c("#info").load("/updatePosition/cluster_"+this.id+"/"+f)}}).sortable( "option", "connectWith", ".pane" ).disableSelection();
    c(".faqMain").sortable({connectWith:[".faqMain"],
    items:".faqDrqg",
//    placeholder:"cluster-ui-selected",
    forcePlaceholderSize:true,forceHelperSize:true,dropOnEmpty:true,revert:true,cursor:"crosshair",start:function(a,b){},stop:function(a,b){c(b.item).css({width:""}).removeClass("dragging")},update:function(b,a){var f=c(".faqMain").sortable("serialize");c("#info").load("/updatePosition/faq_0/"+f)}});
    c("#showPrivateLinks").droppable({accept:".link",hoverClass:"trashFeedback",drop:function(a,b){var e=c(b.draggable).attr("id").split("_");c(b.draggable).css({display:"none"});c.get("/updateCluster/"+c(b.draggable).attr("id")+"_1")}});c("#showPublicLinks").droppable({accept:".link",hoverClass:"trashFeedback",drop:function(a,b){var e=c(b.draggable).attr("id").split("_");c(b.draggable).css({display:"none"});c.get("/updateCluster/"+c(b.draggable).attr("id")+"_0")}});c(".cluster .link").css({cursor:"move"}).mousedown(function(a){if(!c(this).hasClass("dragging")){c(this).css({width:c(this).width()+"px"})}}).mouseup(function(){if(!c(this).hasClass("dragging")){c(this).css({width:""})}else{c(".cluster").sortable("disable")}});c(".cluster").css({cursor:"move"}).mousedown(function(a){if(!c(this).hasClass("dragging")){c(this).css({width:c(this).width()+"px"})}}).mouseup(function(){if(!c(this).hasClass("dragging")){c(this).css({width:""})}else{c(".pane").sortable("disable")}})});jQuery(function(b){b.fn.jOverlay.options={method:"GET",data:"",url:"",color:"#000",opacity:"0.6",zIndex:9999,center:true,imgLoading:"",bgClickToClose:true,success:null,timeout:0}});
    jQuery(function(b){b(".addLinkClass").live("click",function()
    { 
    	b("#btnDiv").css({visibility:"hidden"});
    	b("#linkDivId").css({display:'block'});
    	var urlV = b(this).attr("href");
    		b.ajax({type:"POST",url:urlV,success:function(c){ 
    			b("#linkDiv").css({display:'block'});
    			b("#linkDiv").html(c);
    			document.getElementById('nameField').disabled = 'disable';
    			document.getElementById('titleId').focus();
    			},error:function(c){alert(c)}})
    	return false})});
  jQuery(function(b){b(".showPublic").live("click",function(){b("#profileDiv").load(b(this).attr("href"),function(){b(this).fadeIn(300)});b("#enterPasscodeDiv").html('<a href="/enterPasscode" class="lockImage"><img src="/img/lock.gif" border="0px"/></a>');return false})});jQuery(function(b){b(".lockImage").live("click",function(){b("#enterPasscodeDiv").load(b(this).attr("href"),function(){b(this).fadeIn(300)});return false})});jQuery(function(b){b(".lockCluster").live("click",function(){b("#profileDiv").load(b(this).attr("href"),function(){b(this).fadeIn(300)});return false})});jQuery(function(b){b("#showEnterPasscode").live("click",function(){b("#showPrivateLinks").load(b(this).attr("href"),function(){b(this).fadeIn(300)});return false})});jQuery(function(b){b("#showPublicLinks").live("click",function(){b("#clutterBarLinks").load(b(this).attr("href"),function(){b(this).fadeIn(300)});return false})});jQuery(function(b){b("#showPrivate").live("click",function(){b("#profileDiv").load(b(this).attr("href"),function(){b(this).fadeIn(300)});return false})});jQuery(function(b){b("#showPrivateClutterLinks").live("click",function(){b("#clutterBarLinks").load(b(this).attr("href"),function(){b(this).fadeIn(300)});return false})});
    jQuery(function(b){b("#lockId").live("click",function()
    {delete_cookie('timer');delete_cookie('timer_start');b("#tabs-1").removeClass("ui-tabs-hide");delete_cookie('cookie_reset_timer');delete_cookie("lock_status");delete_cookie("turn_off_timer");delete_cookie("reset_timer");b("#tabs-2").load("/enterPasscode");setMinHeightSmall();var f=document.getElementsByTagName("body");var a=document.getElementsByTagName("*");for(var g=0;g<a.length;g++){if(a[g].className=="ac_results"){f[0].removeChild(a[g])}}loadjscssfile("/js/jquery.autocomplete.js","js");b("#priClutter").addClass("privateClutterBlue");b("#priClutter").css("overflow","hidden");b("#priClutter").css("border-bottom","3px solid #d8d8d8");b("#privaSeparator").css("display","none");b("#showPrivateLinks").html("Private Clutters");$('#tabs-1').css({'display':'block'}); b("#priClutter").html('<div class="yellowLock" style="margin-right:7px;"><a href="#" onclick="setPrivacyTab();"><input type="image"  style="border:2px solid #E19D38;" alt="Private Clutter Lock" src="/images/privateClutterYellowLock.gif" name="Lock"/> </a></div><div class="privateClutterText" style="font-family:arial;font-size:12px;font-weight:normal;margin-top:15px;"> <a href="#" style="font-size:13px" onclick="setPrivacyTab();">Open privacy tab</a><br/> to view hidden clutter. </div>');b("#priProDiv").addClass("ui-state-default ui-corner-top ui-droppable");b("#priProDiv").removeClass("ui-state-active");b("#priProDiv").removeClass("ui-tabs-selected");b("#pubProDiv").addClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-droppable");b("#tabs-2").addClass("ui-tabs-hide");b("#showImage").attr("src","/images/locked.gif");b("#privateClutImg").attr("src","/images/privateClutterLock.gif");b("#lockId").css({visibility:"hidden"});b("#privatepro").attr("src","/images/mylinks.gif");b(".link1").css({display:"block"});setPosition("collapse","public");b("#pubProDiv").droppable("destroy");
    b("#priProDiv").droppable({accept:".cluster, .link",hoverClass:"trashFeedback",tolerance:"touch",over:function(b,c){a("#pubProDiv").css("margin-top","0px");a("#pubProDiv").css({height:"30px"})},out:function(b,c){a("#pubProDiv").css("margin-top","1px");a("#pubProDiv").css({height:"30px"})},
drop:function(i,h)
{
	var d=document.getElementsByTagName("body");
	var g=document.getElementsByTagName("*");
	for(var c=0;c<g.length;c++) 
	{ 
		if(g[c].className=="ac_results") 
		{ 
			d[0].removeChild(g[c])
		}
	}
	loadjscssfile("/js/jquery.autocomplete.js","js");
	loadjscssfile("/js/autocompleteAction.js","js");
	var f=a(h.draggable).attr("id").split("_");
	a("#selectbox_ul_"+f[1]).unbind("mouseover");
	a(h.draggable).unbind("click");
	var b=navigator.appName;a("#pubProDiv").css("margin-top","1px");
	a("#pubProDiv").css({height:"30px"});
	a("#priProDiv").css({margin:"0 0.2em -1px 0"});
	if(f[0]=="linkList") 
	{ 
		a(h.helper).remove();
		set_cookie("drag_cookie",a(h.draggable).attr("id"));
		if(get_cookie('drag-element') == null) {
			a.get("/updateCluster/"+a(h.draggable).attr("id")+"_1");
			setTimeout(function(){a("#clusterLinkId").load("/showPrivateLinks")},300);
		}
		else
		{
			var tt = get_cookie('drag-element');
			var tt = tt.split(',');
			var val = new Array();
			valString = '';
			for(var j=0;j<tt.length;j++)
			{
				if(jQuery.inArray(tt[j], val) == -1)
				{
					valString = valString+tt[j]+'_';
					val.push(tt[j]);
					$('#linkList_'+tt[j]).remove();
				}
			}
			var dragId = get_cookie('drag-element-id');
			if(dragId ==0)
			{
				var value = $('#linkCount').html();
				var splitVal = value.split('(');
				var splitval1 = splitVal[1].split(')');
				var count=parseInt(splitval1[0]);
				var countVal1 = count-parseInt(val.length);
				if(countVal1 == 0)
				{
					$('.multipleCheckboxText').css({display:'none'});
					$('.selectMenuId_'+dragId).css({display:'none'});

				}
				setTimeout(function(){$('#linkCount').html('('+countVal1+')');},100);
			}
			else if(dragId ==-10)
			{
				var value = $('#linkCountPrivate').html();
				var splitVal = value.split('Clutter(');
				var splitval1 = splitVal[1].split(')');
				var count=parseInt(splitval1[0]);

				var countVal1 = count-parseInt(val.length);
				if(countVal1 == 0)
				{
					$('.multipleCheckboxText').css({display:'none'});
					$('.selectMenuId_'+dragId).css({display:'none'});

				}
				setTimeout(function(){$('#linkCountPrivate').html('Hidden Clutter('+countVal1+')');},100);
			}
			else
			{
				var value = $('#linkCountId_'+dragId).html();
				var splitVal = value.split('(');
				var splitval1 = splitVal[1].split(')');
				var count=parseInt(splitval1[0]);

				var countVal1 = count-parseInt(val.length);
				if(countVal1 == 0)
				{
					$('.multipleCheckboxText').css({display:'none'});
					$('.selectMenuId_'+dragId).css({display:'none'});
					$('#linkCountId_'+dragId).html('(empty)');
					$('#showClustersImg_'+dragId).css({visibility:'hidden'});
					var w=$("#linksDivId_"+dragId);
					$('.delete_'+dragId).css({display:'block'});
					$('.share_'+dragId).css({display:'block'});
					$('.edit_'+dragId).css({display:'block'});
					$('.turnOff_'+dragId).css({display:'none'});
					$('.multiMove_'+dragId).css({display:'block'});
					w.html('<div class="link" style="border: medium none ; display: none; padding-bottom: 0px; cursor: move;"> </div>')
				}
				else
				{
					$('#linkCountId_'+dragId).html('('+countVal1+')');
				}
				
			}
			var value = $('#linkCountPrivate').html();
			var splitVal = value.split('Clutter(');
			var splitval1 = splitVal[1].split(')');
			var count=parseInt(splitval1[0]);

			var countVal = count+parseInt(val.length);
			setTimeout(function(){$('#linkCountPrivate').html('Hidden Clutter('+countVal+')');},100);
			setTimeout(function(){$('#listItem_-10').load('/updateClusters/-10/'+valString);},200);
			set_cookie('update-trash-links');
			delete_cookie('drag-element');
		}
//			setMinHeightSmall()
	}
	else 
	{ 
		a.get("/updateCluster/"+a(h.draggable).attr("id")+"_1");
		setTimeout(function(){a("#privateClutDiv").load("/getPrivateClusters")},300)
	}
	a(h.draggable).css({display:"none"});
	displayDragSuccessMessage("Moving to privacy tab.")}
});
    return false})});jQuery(function(b){b("#savePass").click(function(){var a=b(this).parents("form");var d=b(this).parents("form").serialize();b.ajax({type:"POST",url:"/editPassword",data:d,success:function(c){b("#settingsRight").html(c)}})})});jQuery(function(b){b("#savePin").click(function(){var a=b(this).parents("form");var d=b(this).parents("form").serialize();b.ajax({type:"POST",url:"/editPrivacyPin",data:d,success:function(c){b("#settingsRight").html(c)}})})});jQuery(function(b){b("#saveEmail").click(function(){var a=b(this).parents("form");var d=b(this).parents("form").serialize();b.ajax({type:"POST",url:"/editEmail",data:d,success:function(c){b("#settingsRight").html(c)}})})});jQuery(function(b){b("#saveContact").click(function(){var a=b(this).parents("form");var d=b(this).parents("form").serialize();b.ajax({type:"POST",url:"/contactUs",data:d,success:function(c){ 
    	if(document.getElementById("settingsRight")!=null)
		{
			b("#settingsRight").html(c)
		}
    	else if(document.getElementById("mainBoxMiddle1")!=null)
		{
			b("#mainBoxMiddle1").html(c)
		}
		else
		{
			b("#mainBoxMiddle").html(c)
		}
    }})})});jQuery(function(b){b("#saveContact1").click(function(){var g=b(this).parents("form");var h=b("#adminType",g).attr("value");var f=b(this).parents("form").serialize();var a="/contactUs/public/1";b.ajax({type:"POST",url:a,data:f,success:function(c){ 
    	if(document.getElementById("mainBoxMiddle1")!=null)
		{
			b("#mainBoxMiddle1").html(c)
		}
		else
		{
			b("#mainBoxMiddle").html(c)
		}}})})});jQuery(function(b){b("#saveContact2").click(function(){var a=b(this).parents("form");var d=b(this).parents("form").serialize();b.ajax({type:"POST",url:"/contactUs/public/2",data:d,success:function(c){b("#demo").html(c)}})})});
		jQuery(function(b){b("#saveDelicious").click(function()
		{ 
			var a=b(this).parents("form");
			var d=b(this).parents("form").serialize();
			if(document.getElementById('saveTo').value == 'exi')
			{
				if(parseInt($('.existingCluster').val()))
				{
					document.getElementById('errorMessage').innerHTML = '';
				}
				else
				{
					document.getElementById('errorMessage').innerHTML = '<b style="color:red;">Please select a tab</b>';
					return false;
				}
			}
			else
			{
				document.getElementById('errorMessage').innerHTML = '';
			}
			b.ajax({type:"POST",url:"/importBookmark",data:d,success:function(c){b("#settingsRight").html(c) 
			}})
		}
			)});jQuery(function(b){b("#exportBookPriv1").click(function(){var a=b(this).parents("form");var d=b(this).parents("form").serialize();b.ajax({type:"POST",url:"/exportBookmark",data:d,success:function(c){var g="<h1>Bookmarks</h1>";var h=c.indexOf(g);if(h==-1){b("#settingsRight").html(c)}else{if(h==0){b("#form").submit()}}}})})});jQuery(function(b){b("#saveFaq").click(function(){var h=b(this).parents("form");var a=b("#pinNumber1",h).attr("value");var g=b("#pinNumber2",h).attr("value");if((a=="")||(g=="")){document.getElementById("error").style.display="block"}else{document.getElementById("error").style.display="none";var f=b(this).parents("form").serialize();b.ajax({type:"POST",url:"/addFaq",data:f,success:function(c){location.href="/FAQ/admin"}})}})});
function setPosition(i,e,h){

}
function getClassName(h,g){if(!g){g=document.getElementsByTagName("body")[0]}var b=[];var f=new RegExp("\\b"+h+"\\b");var e=g.getElementsByTagName("*");for(var d=0,c=e.length;d<c;d++){if(f.test(e[d].className)){b.push(e[d])}}return b};
function setPrivacyTab()
{
	document.getElementById('tabs-1').style.display='none';
	$('#tabs-2').removeClass('ui-tabs-hide');
	loadjscssfile('/js/show_private_links.js','js');
	$('#tabs-2').css({'display':'block'});
	setTabLabels('private');
	$('#priProDiv').droppable('destroy');
	$('.link1').css({'display':'none'});
	$('#pubProDiv').droppable( {  			
								accept: '.cluster, .link', 
								tolerance:'touch', 
								hoverClass: 'trashFeedback', 
								drop: function(e, ui) { 
									var element = document.getElementsByTagName('body');
									var elements = document.getElementsByTagName('*');
									for(var j=0;j<elements.length;j++)
									{
										if(elements[j].className == 'ac_results')
										{
												element[0].removeChild(elements[j]);
										}	
									}
									loadjscssfile('/js/jquery.autocomplete.js','js');
									var idElements = $(ui.draggable).attr('id'). split('_');
									$.get('/updateCluster/'+$(ui.draggable).attr('id')+'_0');
									if(idElements[0] == 'linkList')
									{
										if(get_cookie('drag-element') == null) {
										setTimeout(function() {$('#pubCluttLinks').load('/showPublicClutterLinks');}, 300);
										set_cookie('drag_public_cookie',$(ui.draggable).attr('id'));
										}
										else
										{
											var tt = get_cookie('drag-element');
											var tt = tt.split(',');
											var val = new Array();
											valString = '';
											for(var j=0;j<tt.length;j++)
											{
												if(jQuery.inArray(tt[j], val) == -1)
												{
													valString = valString+tt[j]+'_';
													val.push(tt[j]);
													$('#linkList_'+tt[j]).remove();
												}
											}
											var dragId = get_cookie('drag-element-id');
											if(dragId ==0)
											{
												var value = $('#linkCount').html();
												var splitVal = value.split('(');
												var splitval1 = splitVal[1].split(')');
												var count=parseInt(splitval1[0]);
												var countVal1 = count-parseInt(val.length);
												if(countVal1 == 0)
												{
													$('.multipleCheckboxText').css({display:'none'});
													$('.selectMenuId_'+dragId).css({display:'none'});
							
												}
												setTimeout(function(){$('#linkCount').html('('+countVal1+')');},100);
											}
											else if(dragId ==-10)
											{
												var value = $('#linkCountPrivate').html();
												var splitVal = value.split('Clutter(');
												var splitval1 = splitVal[1].split(')');
												var count=parseInt(splitval1[0]);
							
												var countVal1 = count-parseInt(val.length);
												if(countVal1 == 0)
												{
													$('.multipleCheckboxText').css({display:'none'});
													$('.selectMenuId_'+dragId).css({display:'none'});
							
												}
												setTimeout(function(){$('#linkCountPrivate').html('Hidden Clutter('+countVal1+')');},100);
											}
											else
											{
												var value = $('#linkCountId_'+dragId).html();
												var splitVal = value.split('(');
												var splitval1 = splitVal[1].split(')');
												var count=parseInt(splitval1[0]);
							
												var countVal1 = count-parseInt(val.length);
												if(countVal1 == 0)
												{
													$('.multipleCheckboxText').css({display:'none'});
													$('.selectMenuId_'+dragId).css({display:'none'});
													$('#linkCountId_'+dragId).html('(empty)');
													$('#showClustersImg_'+dragId).css({visibility:'hidden'});
													var w=$('#linksDivId_'+dragId);
													$('.delete_'+dragId).css({display:'block'});
													$('.share_'+dragId).css({display:'block'});
													$('.edit_'+dragId).css({display:'block'});
													$('.turnOff_'+dragId).css({display:'none'});
													$('.multiMove_'+dragId).css({display:'block'});
													w.html('<div class=\'link\' style=\'border: medium none ; display: none; padding-bottom: 0px; cursor: move;\'> </div>')
												}
												else
												{
													$('#linkCountId_'+dragId).html('('+countVal1+')');
												}
												
											}
											var value = $('#linkCount').html();
											var splitVal = value.split('(');
											var splitval1 = splitVal[1].split(')');
											var count=parseInt(splitval1[0]);
							
											var countVal = count+parseInt(val.length);
											setTimeout(function(){$('#linkCount').html('('+countVal+')');},100);
											setTimeout(function(){$('#listItem_0').load('/updateClusters/0/'+valString);},200);
											set_cookie('update-trash-links');
											delete_cookie('drag-element');
										}
									}
									else
									{
										setTimeout(function() {$('#publicClutDiv').load('/showPublicClusters')}, 300);
									}
									$(ui.draggable).css({display:'none'});
									displayDragSuccessMessage('Moving to public tab.')
								}  
							});
}
function onSubmitDragLinks(){var a=confirm("Are you sure you want to move links from this category into your inbox?");if(a==true){return true}return false}
jQuery(function(a){
	a("#pubCluttLinks").droppable({accept:".cluster",tolerance:"intersect",
	drop:function(i,h)
	{ 
		var f=a(h.draggable).attr("id").split("_");
		var id = 'linksDivId_'+f[1];
		var count = $("#"+id+" > div").length;
		if(count >1)
		{
			if(onSubmitDragLinks())
			{
				$('#linkCountId_'+f[1]).html(' (empty)');
				$('#linkCountId_'+f[1]).css({color:'grey'});
				$("#"+id).html('<div class="link" style="display: none; border: medium none; padding-bottom: 0px; cursor: move;"> </div>');
				$('#pubCluttLinks').load("/updateClutter/0/"+f[1]);
			}
		}
		else
		{
			var displayproperty = $("#"+id+" > div").css('display');
			if(displayproperty == 'block')
			{
				if(onSubmitDragLinks())
				{
					$('#linkCountId_'+f[1]).html(' (empty)');
					$('#linkCountId_'+f[1]).css({color:'grey'});
					$("#"+id).html('<div class="link" style="display: none; border: medium none; padding-bottom: 0px; cursor: move;"> </div>');
					$('#pubCluttLinks').load("/updateClutter/0/"+f[1]);
				}
			}
			else
			{
				alert("This category is empty. There are zero links to move.");
				return false;
			}
		}
			
	}})});

if(get_cookie('lock_status') != null)	
{
jQuery(function(a){
	a("#clusterLinkId").droppable({accept:".cluster,",tolerance:"intersect",
	drop:function(i,h)
	{ 
		var f=a(h.draggable).attr("id").split("_");
		var f=a(h.draggable).attr("id").split("_");
		var id = 'listContentMiddleId_'+f[1];
		var count = $("#"+id+" > div").length;
		if(count >1)
		{
			if(onSubmitDragLinks())
			{
				$("#"+id).html('<div class="link" style="display: none; border: medium none; padding-bottom: 0px; cursor: move;"> </div>');
				$('#clusterLinkId').load("/updateClutter/1/"+f[1]);
			}
		}
		else
		{
			var displayproperty = $("#"+id+" > div").css('display');
			if(displayproperty == 'block')
			{
				if(onSubmitDragLinks())
				{
					$("#"+id).html('<div class="link" style="display: none; border: medium none; padding-bottom: 0px; cursor: move;"> </div>');
					$('#clusterLinkId').load("/updateClutter/1/"+f[1]);
				}
			}
			else
			{
				alert("This category is empty. There are zero links to move.");
				return false;
			}
		}
	}})});
}

function checkGetReadyButton()
{
	return confirm(" If you have already set up the button, click ‘OK’.  Otherwise, please click ‘cancel’ and set up the button")
}

function lockTimer()
{
	delete_cookie('timer_start');
	delete_cookie('timer');
	delete_cookie('cookie_reset_timer');
	set_cookie('turn_off_timer','1');
	var q = "<p style='color:#7f7f7f;padding-top:6px;font-family:arial;font-size:12px;'>To lock the privacy tab, click the 'lock-it' button above.</p>" ;
	document.getElementById('showTimer').innerHTML = q;
}
function display_c(start,type){
	if(get_cookie('turn_off_timer') == null)
	{
	window.start = parseFloat(start);
	if(get_cookie('lock_status') != null){
		if(get_cookie('timer') != null)
		{   
			if(type != null) 
			{
				var d = new Date();
				var dd= d.getTime();
				
				if(get_cookie('timer_start') != null)
				{
					var timerVal = get_cookie('timer_start');
					vv = dd - timerVal;
					var time = vv/1000;
					startTime = get_cookie('timer') - time;
					window.start = startTime;
					delete_cookie('timer_start');
					set_cookie('timer_start',dd);

				}
				else
				{
					window.start = get_cookie('timer'); 
					set_cookie('timer_start',dd);
				}
			}
			else
			{
				window.start = get_cookie('timer'); 
			}
		}
		var end = 0 // change this to stop the counter at a higher value
		var refresh=1000; // Refresh rate in milli seconds
		if(window.start >= end ){
		mytime=setTimeout('display_ct()',refresh)
	}
	} else {
		delete_cookie('timer');
		delete_cookie('cookie_reset_timer');
		if(type != null) 
		{
			var d = new Date();
			var dd= d.getTime();
			set_cookie('timer_start',dd);
		}
	}
	}
}

function display_ct() {
	if(get_cookie('turn_off_timer') == null)
	{
		if(get_cookie('cookie_reset_timer') !=null)
		{
			window.start = 1800;
			delete_cookie('cookie_reset_timer');
		}
		// Calculate the number of days left
		var days=Math.floor(window.start / 86400);
		// After deducting the days calculate the number of hours left
		var hours = Math.floor((window.start - (days * 86400 ))/3600)
		// After days and hours , how many minutes are left
		var minutes = Math.floor((window.start - (days * 86400 ) - (hours *3600 ))/60)
		// Finally how many seconds left after removing days, hours and minutes.
		var secs = Math.floor((window.start - (days * 86400 ) - (hours *3600 ) - (minutes*60)))
		
		var x =  '<p style="color:#7f7f7f;"><span id="ct">Tab will auto-lock in <b style="color:black;">'+minutes + "</b> minutes and <b style='color:black;'>" + secs + "</b> seconds. </span></p>" ;
		var y = '<a href="#" style="color:#7092be;" onclick="set_cookie(\'cookie_reset_timer\',\'1\');set_cookie(\'reset_timer\',\'1\');">reset timer</a> <label style="color:#7f7f7f;">|</label> <a href="#" style="color:#7092be;" onclick="lockTimer();">turn off auto-lock</a>';
	//	alert(document.getElementById('ct'));
		if(document.getElementById('showTimer') != null) {
		document.getElementById('showTimer').innerHTML = x+y;
		 }
		window.start= window.start- 1;
		if(get_cookie('timer') != null)
		{
			delete_cookie('timer');
			set_cookie('timer',window.start);
		}
		else
		{
			set_cookie('timer',window.start);
		}
		tt=display_c(window.start);
	}
}

function setHover(divId,type)
{
	if(type == 'on')
	{
		document.getElementById(divId).style.textDecoration = 'underline';
	}
	else
	{
		document.getElementById(divId).style.textDecoration = 'none';
	}
}

function deleteMultiCokie(id)
{
	delete_cookie('multimove');
	$('#multiSelect_'+id).css({display:'none'});
	$('.multi_'+id).css({display:'none'});
	$('.fav_'+id).css({display:'block'});
	$('.multipleCheckbox').attr('checked', false);
	$('.link').css({backgroundColor:'#ffffff'});
	$('.delete_'+id).css({display:'block'});
	$('.share_'+id).css({display:'block'});
	$('.edit_'+id).css({display:'block'});
	$('.turnOff_'+id).css({display:'none'});
	$('.multiMove_'+id).css({display:'block'});
}

function setYellowLink(id,clusterId)
{
	if(document.getElementById(id).checked == true)
	{
		delete_cookie('single-drag-element');
		document.getElementById(id).value=id;
		document.getElementById('linkList_'+id).style.backgroundColor='#f8ff64';
	}
	else
	{
		multiCheckboxes = getClassName('multi_'+clusterId);
		var selected = new Array();
		for(var t=0;t<multiCheckboxes.length;t++)
		{
			if($('#'+multiCheckboxes[t].id).attr('checked') == true)
			{
				selected.push($('#'+multiCheckboxes[t].id).val());
			}
		}
		if(selected.length<1)
		{
			set_cookie('single-drag-element');
		}
		document.getElementById(id).value='';
		document.getElementById('linkList_'+id).style.backgroundColor='white';
//		$('a').bind('click');
	}
}

function onSubmitDeleteLinks(){ 
	var b=confirm("Are you sure you want to delete multiple links?");if(b==true){return true}return false}
function getPositionVal(arrayName,arrayItem)
{
    for(var i=0;i<arrayName.length;i++){ 
    	if(arrayName[i]==arrayItem)
            return i;
    }
}

function openUrl(url, cluster_id, link_id, icon)
{
	if(cluster_id == 0)
	{
		cluster_id = '';
	}
	if(get_cookie('multimove') !=null)
	{
		var element1 = get_cookie('multimove');
		var element2 = cluster_id;
		var parentId = $('.url_'+link_id).parent().attr("id");
		var parentIdElements = $('.url_'+link_id).parent().attr("id").split('_');
		if((parseInt(element1) == parseInt(parentIdElements[1])) || ((parseInt(element1) == 0) && (parentIdElements[1] == '')))
		{
			$('.url_'+link_id).removeAttr("href");
			if(document.getElementById(link_id).checked == false)
			{
				delete_cookie('single-drag-element');
				document.getElementById(link_id).checked = true;
				document.getElementById(link_id).value=link_id;
				document.getElementById('linkList_'+link_id).style.backgroundColor='#f8ff64';
			}
			else
			{
				multiCheckboxes = getClassName('multi_'+cluster_id);
				document.getElementById(link_id).checked = false;
				var selected = new Array();
				for(var t=0;t<multiCheckboxes.length;t++)
				{
					if($('#'+multiCheckboxes[t].id).attr('checked') == true)
					{
						selected.push($('#'+multiCheckboxes[t].id).val());
					}
				}
				if(selected.length<1)
				{
					set_cookie('single-drag-element');
				}
				document.getElementById(link_id).value='';
				document.getElementById('linkList_'+link_id).style.backgroundColor='white';
			}
		}
		else
		{
			if(icon)
			{ 
				window.open(url);
			}
			else
			{ 
				$('.url_'+link_id).attr('href',url);
				$('.url_'+link_id).attr('target','_blank');
			}
		}
	}
	else
	{ 
		if(icon)
		{ 
			window.open(url);
		}
		else
		{ 
			$('.url_'+link_id).attr('href',url);
			$('.url_'+link_id).attr('target','_blank');
		}
	}
}

function setYelloLink(link_id,cluster_id)
{
	if(get_cookie('multimove') != null)
	{
		if(get_cookie('multimove') == cluster_id)
		{
			if(document.getElementById(link_id).checked == false)
			{
				delete_cookie('single-drag-element');
				document.getElementById(link_id).checked = true;
				document.getElementById(link_id).value=link_id;
				document.getElementById('linkList_'+link_id).style.backgroundColor='#f8ff64';
			}
			else
			{
				multiCheckboxes = getClassName('multi_'+cluster_id);
				document.getElementById(link_id).checked = false;
				var selected = new Array();
				for(var t=0;t<multiCheckboxes.length;t++)
				{
					if($('#'+multiCheckboxes[t].id).attr('checked') == true)
					{
						selected.push($('#'+multiCheckboxes[t].id).val());
					}
				}
				if(selected.length<1)
				{
					set_cookie('single-drag-element');
				}
				document.getElementById(link_id).value='';
				document.getElementById('linkList_'+link_id).style.backgroundColor='white';
			}
		}
	}
}

function getMousePosition(e) {
 
	e = e ? e : window.event;
	var position = {
		'x' : e.clientX,
		'y' : e.clientY
	}

	return position;

}

function getScrollPosition() {
 
		var x = 0;
		var y = 0;
 
		if( typeof( window.pageYOffset ) == 'number' ) {
			x = window.pageXOffset;
			y = window.pageYOffset;
		} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
			x = document.documentElement.scrollLeft;
			y = document.documentElement.scrollTop;
		} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
			x = document.body.scrollLeft;
			y = document.body.scrollTop;
		}
 
		var position = {
			'x' : x,
			'y' : y
		}
 
		return position;
 
	}

function showNewLinkDiv()
{
	if(document.getElementById("nameField").value!="")
	{ 
		set_cookie("clusterCookie","name");
		document.getElementById("greenBox").style.display="block";
		document.getElementById("linkDiv").style.display="block" 
		document.getElementById("linkDivId").style.display="block" 
		document.getElementById("btnDiv").style.visibility="hidden" 
		document.getElementById("linkListid").style.display="block";
	}
	else
	{ 
		document.getElementById("linkListid").style.display="none";
		document.getElementById("greenBox").style.display="none";
		document.getElementById("linkDiv").style.display="none"
		document.getElementById("linkDivId").style.display="none" 
		document.getElementById("btnDiv").style.visibility="visible" 
		
	}
}

function displayTrashMessage(type)
{ 
	var e=document.getElementById("trashUndo");
	var h=document.getElementById("pubProDiv");
	if(displayTrashTimer)
	{  
		clearTimeout(displayTrashTimer);
	};
	var b=document.getElementById("trashUndo");b.style.display="none";
	text = '';
	var text1 = '&nbsp;<a id="undoTrashElement" class="undoTrashElement" style="font-weight:bold;padding-left:10px;text-decoration:underline;color:blue;cursor:pointer;" onClick=\"trashUndo()\">UNDO</a>'
	if(type== 'cluster')
	{
		var text = '<div style="padding-top:5px;">CATEGORY DELETED'+text1+'</div>';
	}
	else if(type== 'link')
	{
		var text = '<div style="padding-top:5px;">1 LINK DELETED'+text1+'</div>';
	}
	else if(type== 'links')
	{
		var count = get_cookie('trash_delete_link_count');
		var text = '<div style="padding-top:5px;">'+count+' LINKS DELETED'+text1+'</div>';
	}
	e.innerHTML = text;
	e.style.display="block";
	displayTrashTimer=setTimeout("cleanTrashMessage()",7000)
}

function cleanTrashMessage(){if(displayTrashTimer){clearTimeout(displayTrashTimer)}var b=document.getElementById("trashUndo");b.style.display="none"}

function trashUndo()
{
	var trashCookie = get_cookie('trash_delete');
	var cookiItems = trashCookie.split('_');
	if(cookiItems[0] == 'cluster')
	{
		$.get('/undoTrash/'+cookiItems[2]+'/cluster');
		if(getClassName("ui-state-active") != '' && getClassName("ui-state-active") != null)
		{
			$('#publicClusterDiv1'+get_cookie('edit_tab_id')).css({display:'block'});
 			$('#publicClusterDiv'+get_cookie('edit_tab_id')).css({display:'none'});
 			$('#linkPortion1').css({display:'block'});
 			$('#emptyTabMenu').css({display:'none'});
 			if(isScrolledIntoView('linkPortion1') == false)
			{
				$('#linkPortion2').css({display:'block'});
			}
			else
			{
				$('#linkPortion2').css({display:'none'});
			}
		}
		$('#listItem_'+cookiItems[2]).css({display:'block'});
//		document.getElementById('listItem_'+cookiItems[2]).style.display = 'block';
	}
	else if(cookiItems[0] == 'link')
	{
		if(navigator.appVersion.indexOf("MSIE 8")>-1)
		{
			setTimeout(function(){$.get('/undoTrash/'+cookiItems[2]+'/link');},500);
		}
		else
		{
			setTimeout(function(){$.get('/undoTrash/'+cookiItems[2]+'/link');},100);
		}
		var item = get_cookie('trash_delete_link_parent');
		var items = item.split('_');
		var x = ''; 
		if(get_cookie('multimove') ==null)
		{
			var y = items[1]+'/undo';
			x = y;
		}
		else
		{ 
			if(parseInt(get_cookie('multimove')) == parseInt(get_cookie('drag-element-id')))
			{
				x = items[1];
			}
			else
			{
				x = items[1]+'/undo';
			}
		}
		if(!(items[1]))
		{
			setTimeout(function(){$('#listItem_0').load('/updateTrashLinks/'+x);},300);
		}
		else
		{
			if(navigator.appVersion.indexOf("MSIE 8")>-1)
			{
				setTimeout(function(){$('#linksDivId_'+items[1]).load('/updateTrashLinks/'+x);},1500);
			}
			else
			{
				setTimeout(function(){$('#linksDivId_'+items[1]).load('/updateTrashLinks/'+x);},500);
			}
		}
	}
	else if(cookiItems[0] == 'links')
	{ 
		
		var cookieItems1 = cookiItems[1].split('-');
		var valString ='';
		for(var i=0; i<cookieItems1.length; i++)
		{
			if(cookieItems1[i] !='')
			{
				valString = valString+cookieItems1[i]+'_';
			}
		}
		$.get('/undoTrash/'+11+'/links/'+valString);
		var item = get_cookie('trash_delete_link_parent');
		var items = item.split('_');
		if(!(items[1]))
		{
			setTimeout(function(){$('#listItem_0').load('/updateTrashLinks/'+items[1]);},700);
		}
		else
		{
			setTimeout(function(){$('#linksDivId_'+items[1]).load('/updateTrashLinks/'+items[1]);},700);
		}
		$('#multiSelect_'+items[1]).css({display:'block'});
	}
	var e=document.getElementById("trashUndo");
	delete_cookie('trash_delete');
	delete_cookie('trash_delete_link_parent');
	delete_cookie('trash_delete_link_count');
	e.style.display="none";
}

function editTabShow(id)
{
	var idVals = id.split('_');
	$('#editTabContent').load('/editTab/'+idVals[1]);
	$('#editTabContent').css({display:'block'});
	$('.tabContentDiv').css({display:'none'});
	$('#blueBox').css({display:'none'});
	if(document.getElementById('adsDiv') != null)
	{
		$('#adsDiv').css({display:'none'});
	}
}
function checkPrivacy(id)
{
	var ids = id.split('Privacy');
	document.getElementById('privacyValue').value = ids[1];
}


function onSubmitDeleteTab(name){
	var b=confirm('Do you really want to delete the tab "'+name+'"?  (All links and categories in this tab will be DELETED!)');if(b==true){return true}
	return false
}

function setTabnames(id)
{
	var cookieItems = id;
	var e = document.getElementById('liul_'+cookieItems);
	if(document.getElementById("mainBoxTop") != null)
	{
		var e1 = document.getElementById("mainBoxTop");
		var type = 1;
	}
	else
	{
		var e1 = document.getElementById("mainBoxTop1");
		var type = 0;
	}
	var originalString = document.getElementById('tabnameField_'+id).innerHTML;
	
	var el = document.getElementById("contact_tab");
	
	var widthUl = el.style.width.split('px');
	
	var activeTabs = getClassName("tabLi");
	var marginVal = activeTabs.length*3;
	var paddingVal = activeTabs.length*4;
	
	var marginlabel = activeTabs.length*3;
	var width = widthUl[0] - marginVal-30-paddingVal-marginlabel;
	var originalWidthVal = width;
	var widthOriginal = document.getElementById('tabnameField_'+id).offsetWidth;

	width = width - widthOriginal;

	var t = parseInt((width /(activeTabs.length-1))-4);
	var tabNum = activeTabs.length-1;
	if(document.getElementById('tabNameString').offsetWidth > originalWidthVal)
	{
	$(".tabLi").each(function (index, item) {
	    var obj = $(item).find("label");
	  
	    var liId = this.id.split('_');
	    var width = t;
	    if (obj.length) {
	        var placename = $(obj).text();
	        var original =  $(obj).text();
	        if ($(obj).width() > width && placename.length > 0) {
	            var limit = 0;
	            do {
	                limit++;
	                placename = placename.substring(0, placename.length - 1);
	                $(obj).text(placename + "...");
	            } while ($(obj).width() > width && limit < 1000)
	            if(liId[1] != cookieItems)
	            {
	            	widthVal = document.getElementById('tabnameField_'+liId[1]).offsetWidth+5;
	            	$('#tabnameId_'+liId[1]).css({width:widthVal+'px'});
	            	$('#tabnameId_'+liId[1]).html($(obj).text()) ;
	            	tabNum --;
	            	t1 = t-widthVal;
	            	t2 = t1/tabNum;
	            	t = t+ parseInt(t2);
	            }
	            else
	            {
	            	 $('#tabnameId_'+liId[1]).css({width:widthOriginal+'px'});
	            	$('#tabnameId_'+liId[1]).html(original) ;
	            }
	            $('#tabnameField_'+liId[1]).html(original);
	            
	            
	        }
	        else
	        {
	        	if(liId[1] != cookieItems)
	            {
	            	widthVal = document.getElementById('tabnameField_'+liId[1]).offsetWidth+5;
	            	$('#tabnameId_'+liId[1]).css({width:widthVal+'px'});
	            	tabNum --;
	            	t1 = t-widthVal;
	            	t2 = t1/tabNum;
	            	t = t+ parseInt(t2);
	            }
	            else
	            {
	            	$('#tabnameId_'+liId[1]).css({width:widthOriginal+'px'});
	            }
            	$('#tabnameId_'+liId[1]).html(original) ;
	        }
	    }
	});
	}
	else
	{
		$(".tabLi").each(function (index, item) { 
			var obj = $(item).find("label");
	    	var liId = this.id.split('_');
	    	var placename = $(obj).text();
	    	$('#tabnameId_'+liId[1]).css({width:'auto'});
        	$('#tabnameId_'+liId[1]).html($(obj).text()) ;
		});
	}
//	var widthval = activeTabs.length;
//	var nameString = document.getElementById('nameString').innerHTML;
//	var stringCount= 10*nameString.length; 
//	var itemCount = stringCount - widthOriginal; 
//	var yyy = widthval-1;
//	var j = e1.offsetWidth - widthOriginal;
//	var weightFraction1 = parseInt(j/yyy);
//	var weightFraction = parseInt(t/10);
//	var activeTabs = getClassName("tabnameField");
//	if(itemCount > width)
//	{ 
//		var name =document.getElementById('tabnameField_'+cookieItems) .innerHTML; 
//		document.getElementById('tabnameId_'+cookieItems).innerHTML = name;
//		document.getElementById('tabnameId_'+cookieItems).style.width=widthOriginal+'px';
//
//		for(var i=0;i<activeTabs.length; i++)
//		{
//			var items = activeTabs[i].id.split('_'); 
//			items[2] = parseInt(activeTabs[i].innerHTML.length);
//			if(items[1] != cookieItems)
//			{
//				document.getElementById('tabnameId_'+items[1]).style.width=t+'px';
//				var charactrePixels = 10*items[2];
//				
//				if(items[2] >weightFraction)
//				{
//					var name = activeTabs[i].innerHTML; 
//					if(type == 0)
//					{
//						var correctedName = name.substring(0,weightFraction-2);
//					}
//					else
//					{
//						if(i<4)
//						{
//								var correctedName = name.substring(0,weightFraction+1);
//						}
//						else
//						{
//							var correctedName = name.substring(0,weightFraction+1);
//						}
//					}
//					
//					var add = '..';
//					var nameValue = correctedName+add;
//					
//					document.getElementById('tabNameString').innerHTML = nameValue;
//					
//					if(document.getElementById('tabNameString').offsetWidth >= t)
//					{
//						var fraction = document.getElementById('tabNameString').offsetWidth - t;
//						if(fraction>10)
//						{
//							fraction = parseInt(fraction/10);
//						}
//						else
//						{
//							fraction = 1;
//						}
//						correctedName = name.substring(0,weightFraction-fraction);
//						nameValue = correctedName+add;
//					}
//					document.getElementById('tabnameId_'+items[1]).innerHTML = nameValue;
//				}
//				else
//				{
//					var name = activeTabs[i].innerHTML; 
//					document.getElementById('tabnameId_'+items[1]).innerHTML = name;
//				}
//			}
//			else
//			{
//				var name = activeTabs[i].innerHTML; 
//					document.getElementById('tabnameId_'+items[1]).innerHTML = name;
//			}
//			
//		}
//	}
//	else
//	{
//		for(var i=0;i<activeTabs.length; i++)
//		{
//			var items = activeTabs[i].id.split('_'); 
//			var name = activeTabs[i].innerHTML; 
//			document.getElementById('tabnameId_'+items[1]).innerHTML = name;
//		}
//	}
}
function onTab(b){ 
	temp=document.getElementById("newTab"+b);
	temp.style.fontWeight="bold";
	temp.style.textDecoration="underline";
}
function offTab(b)
{
	temp=document.getElementById("newTab"+b);
	temp.style.textDecoration="none";
	temp.style.fontWeight="normal"
}
function onButton(b){ 
	temp=document.getElementById("getButton"+b);
	temp.style.fontWeight="bold";
	temp.style.textDecoration="underline";
}
function offButton(b)
{
	temp=document.getElementById("getButton"+b);
	temp.style.textDecoration="none";
	temp.style.fontWeight="normal"
}

function onEditTab(b){ 
	temp=document.getElementById("editTab"+b);
	temp.style.fontWeight="bold";
	temp.style.textDecoration="underline";
}

function offEditTab(b)
{
	temp=document.getElementById("editTab"+b);
	temp.style.textDecoration="none";
	temp.style.fontWeight="normal"
}
function isScrolledIntoView(elem) {
    var docViewTop = $(window).scrollTop(),
        docViewBottom = docViewTop + $(window).height(),
        elemTop = $('#'+elem).offset().top,
     elemBottom = elemTop + $('#'+elem).height();
   //Is more than half of the element visible
   return ((elemTop + ((elemBottom - elemTop)/2)) >= docViewTop && ((elemTop + ((elemBottom - elemTop)/2)) <= docViewBottom));
}

function checkArray(arrayItems, item)
{ 
	if(arrayItems == '')
	{
		return -1; 
		
	}
	else
	{
		for(var i=0; i<arrayItems.length; i++)
		{
//			if(navigator.appVersion.indexOf("MSIE 9")>-1)
//			{
				if(parseInt(arrayItems[i]) == parseInt(item))
				{
					return 0;
				}
				else
				{
					return -1;
				}
//			}
//			else
//			{
//				if(arrayItems[i] == item)
//				{
//					return 0;
//				}
//				else
//				{
//					return -1;
//				}
//			}
		}
	}
}


jQuery(function($){ 
    	$("#getContacts").click(function(){ 
    		$("#getContacts").unbind("click");
    		var a=$(this).parents("form");
    		var d=$(this).parents("form").serialize();
    		if(document.getElementById('name').value == '')
    		{
    			$("#errorMessages").html('Please enter your name');
    			$('#errorMessages').css({display:'block'});
    			return false;
    		}
    		else if(document.getElementById('email').value == '')
    		{
    			$("#errorMessages").html('Please enter your email address');
    			$('#errorMessages').css({display:'block'});
    			return false;
    		}
    		else if(document.getElementById('password').value == '')
    		{
    			$("#errorMessages").html('Please enter your password');
    			$('#errorMessages').css({display:'block'});
    			return false;   		
    		}
    		else
    		{
	    		$.ajax({type:"POST",url:"/getContacts",data:d,success:function(c){ 
	    			$("#errorMessages").html(c);
	    			$('#errorMessages').css({display:'block'});
	    		}
	    		})
    		}
    	})}
    );




jQuery(function($){
	$('#TB_closeWindowButton').click(function(){ 
		$('.thickbox').unbind('click');
		loadjscssfile("/js/jqueryThickbox.js","js");
		$("#TB_imageOff").unbind("click");
		$("#TB_closeWindowButton").unbind("click");
		$("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
		$("#TB_load").remove();
		if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
			$("body","html").css({height: "auto", width: "auto"});
			$("html").css("overflow","");
		}
		document.onkeydown = "";
		document.onkeyup = "";
	})
})

jQuery(function($){ 
	$("#sendEmailInvitation").click(function(){
		var a=$(this).parents("form");
		var d=$(this).parents("form").serialize();
		$.ajax({type:"POST",url:"/inviteFriends/email",data:d,success:function(c){ 
			$("#sendEmailError").html(c);
			$('#sendEmailError').css({display:'block'});
		}
		})
	})}
);

function onSubmitAddLinks(){
	var saveTo = $('#saveTo').val();
	if(saveTo == 'exi')
	{
        if(parseInt($('.existingCluster').val()))
        {
            var siteUrl = $('#LinkUrl').val();
			$urlValid = urlValidationLink(siteUrl).split('___');
			if($urlValid[0] != 'True') {
				$('#errorMessage').html('Please enter a valid url.');
				$('#errorMessage').css({display:'block'});
				return false;
			} else { 
				document.form.submit();
			}
        }
        else
        {
           $('#errorMessage').html('Please select a category');
           $('#errorMessage').css({display:'block'});
           return false;
        }
	}
	else
	{
		var siteUrl = $('#LinkUrl').val();
		$urlValid = urlValidationLink(siteUrl).split('___');
		if($urlValid[0] != 'True') {
			$('#errorMessage').html('Please enter a valid url.');
			$('#errorMessage').css({display:'block'});
			return false;
		} else { 
			document.form.submit();
		}
	}
}


function showLoadingImage(id,url)
{ 
	if((get_cookie('click_tab') == null) && ((get_cookie('drag_tab_cookie') == null)))
	{
		set_cookie('click_tab');
		
		if(document.getElementById(id).offsetWidth <70)
		{
			var width = '70px';
		}
		else
		{
			var width = document.getElementById(id).offsetWidth+'px';
		}
		document.getElementById(id).style.width = width;
		document.getElementById(id).style.paddingBottom = '15px';
		document.getElementById(id).innerHTML = '<img src="/images/loadingTab.gif" style="height:3px;margin-top:10px;">';
		setTimeout(function(){window.location.href=url;},300);
	}
}

function changeClutterSize(scroll, type)
{
	var heightClutter = $(window).height();
	var windowHeight = document.getElementById('mainContent').offsetHeight;
	var newHeight = heightClutter - 480;
//	alert(newHeight);
	if(newHeight < 80)
	{
		newHeight = 105;
	}
	else
	{
	if(heightClutter<windowHeight)
	{
		var heightDiff = windowHeight-heightClutter;
		newHeight = heightClutter-640;
		if(scroll != null)
		{
			if(type == null)
			{
				if(isScrolledIntoView('footer') == false)
				{
					newHeight = newHeight+240;
				}
				else
				{
					var bottomHeight = document.getElementById('mainBoxBottom').offsetHeight;
					newHeight = newHeight-bottomHeight+200; 
				}
			}
			else
			{
				if($(window).scrollTop() > 59)
				{
					if(heightClutter>document.getElementById('mainLeft').offsetHeight)
					{
						newHeight = document.getElementById('mainLeft').offsetHeight - 150-29-43-20-29-25-18-30-30; 
					}
					else
					{
						newHeight = newHeight+167; 
					}
				}
				else
				{
					if($(window).scrollTop() > 0)	
					{
						newHeight = newHeight+115; //alert('p'); alert($(window).scrollTop() );
					}
					else
					{
					    newHeight = newHeight+55;
					}
				}
			}
		}
		else
		{
			newHeight = heightClutter-570;
		}
	}
	else
	{
		var adHeight = 0
//		if(document.getElementById('adsDiv') != null)
//		{
//			adHeight = document.getElementById('adsDiv').offsetHeight;
//			newHeight = document.getElementById('mainLeft').offsetHeight+adHeight-425;
//		}
//		else
//		{
			newHeight = document.getElementById('mainLeft').offsetHeight-290;
//		}
	}
	
	newHeight = newHeight+150;
	}
	var mainBoxHeight = newHeight+53+130;
	if(mainBoxHeight > 200)
	{
		$('#mainBoxMiddle').css({minHeight:mainBoxHeight+'px'});
	}
	var newHeightList = newHeight-20;
	$('#listItem_0').css({height:newHeightList+'px'});
	$('#listRowRightDiv').css({height:newHeightList+'px'});
	$('#pubClutter').css({height:newHeight+'px'});
	var ee=$('#adsDiv').offset();

}

jQuery(function(a){
	a(".clutterBarDiv").droppable({accept:".link",tolerance:"intersect",
	drop:function(i,h)
	{ 
		alert('You must first set up the browser button to start using your Inbox!')
		return false;
	}})});
