var searchTab;

$(document).ready(function(){
       $("#qry").Watermark("Enter Keywords to search");
       
       $("#divsTip").hide();
       $("#searchTip").click(function () {
            $("#divsTip").slideToggle("slow", function () {
                                            var vCss=$("#searchTip").css("background-image");
                                            if (vCss.indexOf("down") > 0)
                                                $("#searchTip").css("background-image","url(includes/images/itemmoveup.gif)");
                                            else
                                                $("#searchTip").css("background-image","url(includes/images/itemmovedown.gif)");         
                                                });
       });
       
       
       $("#maincontent").css("top",0);
       $("#xsnazzy").css("margin-top",0);
       
       
       
       
       fnGetRecentPopularurls();
       
       
       
       $('#tabs').tabs();
       //setupDependencies(Ajax_FormID);
       
       // Dialog			
				$('#dialog').dialog({
					autoOpen: false,
					width: 400,
					buttons: {
						"Login": function() { 
				            return login();
							$(this).dialog("close"); 
						}, 
						"Cancel": function() { 
							$(this).dialog("close"); 
						} 
					}
				});
				
				
				// Dialog Link
				$('#dialog_link').click(function(){
				    resetSignin();
				    if($('#dialog_link').text()=="Sign out"){logout();return;};
				    if($('#dialog_link').text()=="Sign in"){$('#dialog').dialog('open');};
				    
					
					return false;
				});
				
				
				$('#A1').click(function(){
				    resetAccount();
				    if($('#A1').text()=="Create Account"){$('#dlgSignUp').dialog('option', 'title', 'Sign Up');newAccount();return;};
				    if($('#A1').text()=="Edit Account"){editAccount();return;};
				    
					
					return false;
				});
				
				
				$('#dlgSignUp').dialog({
					autoOpen: false,
					width: 400,
					buttons: {
						"Ok": function() { 
				            return SignUp();
							$(this).dialog("close"); 
						}, 
						"Cancel": function() { 
							$(this).dialog("close"); 
						} 
					}
				});
				
				$('#dlgSendEmail').dialog({
					autoOpen: false,
					width: 400,
					buttons: {
						"Ok": function() { 
				            return sEmail();
							$(this).dialog("close"); 
						}, 
						"Cancel": function() { 
							$(this).dialog("close"); 
						} 
					}
				});
				
            $('#dlgFPW').dialog({
					autoOpen: false,
					width: 400,
					buttons: {
						"Ok": function() { 
						    return fPW();
							$(this).dialog("close"); 
						}, 
						"Cancel": function() { 
							$(this).dialog("close"); 
						} 
					}
				});

	
	
	    var remember = $.cookie('remember');
        if ( remember == 'true' ) {
            var username = $.cookie('username');
            var e = $.cookie('email');
            
            $('#spanUser').text(username);
            $('#dialog_link').html("Sign out");
            $('#A1').text("Edit Account");
            
            
                showUserReqList(e);
                
                var url = getReqURL()
                
				if (url=='cn'){
	                window.frames['ifSubmitTkt'].location ='SubmitTicket.aspx';
	                }
	            
	            if (url=='cs'){
	                window.frames['ifSubmitTkt'].location ='SubmitTicket_course.aspx';
	             }
	             if (url=='ps'){
	                window.frames['ifSubmitTkt'].location ='SubmitTicket_PS.aspx';
	             }
                if (url==''){
	                window.frames['ifSubmitTkt'].location ='LoginPrompt.htm';
	             }
	             
                var iframeElement = document.getElementById('ifSubmitTkt');
                iframeElement.style.width = "100%";
                iframeElement.style.height = "500px";

        }

	
	
				
    });
    
    $('#qry').bind('keypress', function(e) {        
    if(e.keyCode==13){ 
        
    // Enter pressed... do anything here...        
        searchForm();
        return false;
    }});
    
    $('#dialog input').bind('keypress', function(e) {        
    if(e.keyCode==13){                
    // Enter pressed... do anything here...        
        login();
    
    }});
    
    
    $('#dlgSignUp input').bind('keypress', function(e) {        
    if(e.keyCode==13){                
    // Enter pressed... do anything here...        
        SignUp();
    
    }});
    
    
    $('#dlgFPW input').bind('keypress', function(e) {        
    if(e.keyCode==13){                
    // Enter pressed... do anything here...        
        fPW();
    
    }});
    

    var maintab = $("#RightPane").jqDynTabs({tabcontrol:$("#mainTabArea"), tabcontent :$("#mainPanelArea"), position:"top", imgpath:"includes/images/"});
    
    function Waiting(button){
        
    }
    function searchForm(){
        if ($('#qry').val()=='Enter Keywords to search') {return};
        
        search($('#qry').val(),$('#selOptions').val(),($('#chkKWD').checked)?$('#chkKWD').val():'',($('#chkANS').checked)?$('#chkANS').val():'',(('#chkTTL').checked)?$('#chkTTL').val():'',$('#selDisplay').val());
        
        $("#divStats").hide();
        
    }
    
    function editAccount(){
        $('#dlgSignUp').dialog('open');
        $('#dlgSignUp').dialog('option', 'title', 'Edit Account');
        var e = $.cookie('email');

        var result = Main.GetAccountInfo(e);
        if (result.error==null){
            $('#txtUserName_su').val(result.value.Rows[0].Email);
	    $('#txtUserName_su').attr('readOnly','true');
            $('#txtPassword_su').val(result.value.Rows[0].Password);
            $('#txtrePassword_su').val(result.value.Rows[0].Password);
            $('#txtFirstName_su').val(result.value.Rows[0].AccountName);
            $('#txtPhone_su').val(result.value.Rows[0].Phone);
        
        }
        
        
        
    }

    function resetAccount(){
    $('#txtUserName_su').val("");
    $('#txtPassword_su').val("");
    $('#txtrePassword_su').val("");
    $('#txtFirstName_su').val("");
    $('#txtPhone_su').val("");

    
    }
    
    function search(q,O,K,A,T,D){
    var opt,cl;
    
    
    opt = (K=='')&&(A=='')&&(T=='')?'KWD':(K!='')&&(A=='')&&(T=='')?K:(K=='')&&(A!='')&&(T=='')?A:(K=='')&&(A=='')&&(T!='')?T:'ALL';
    
    opt="ALL"
    
    cl=(D==10)?'mh4':(D==25)?'mh2':'mh3';
    
    var ti = maintab.getTabIndex();
    
//        for(var i=1;i<ti;i++)
//          maintab.TabCloseEl(1);
            
//        fnGetRecentPopularurls();
        
        Main.GetArticles(q,opt,O,D,getReqURL(),function(result){// attach the template
            
            
                if (result.error==null){
			        var table='',i=0; 
			        table = '<BR/><BR/><table id="tblSearchResult" name="tblSearchResult" width=100%>';
		                table +='';
		                if(result.value.Rows.length==0){
		                    table +=    '<tbody class="scrollingContent"><tr><td>Your Search did not return any results, consider changing the search keywords.</td></tr>';
		                }; 
		                for(i = 0; i < result.value.Rows.length; i++) {
			                table +=    '<tbody class="scrollingContent"><tr>' +
			                            '<td class='+cl +'><b>' + (i+1) + '.</b>&nbsp;&nbsp;</td>' +
						                '<td class='+cl +'>' + 
						                '<a href="javascript:void(0)"  onclick="newTab(' + result.value.Rows[i].ArticleID +',\''+ result.value.Rows[i].ArticleID + '-' + result.value.Rows[i].Title.substring(0,13) +'...\');">' +
						                result.value.Rows[i].Title + '</a>&nbsp;<br><font color=green>' + result.value.Rows[i].CategoryTree + '.</font></td></tr>' 
    						            
    						            
		                }
            			
		                table += '</tbody></table>';
    			        
    			        if (!(maintab.tabExists("Search Results")))
    			           searchTab=maintab.CreateTab("Search Results",false,null,table,0);
    			        else
    			            {
    			            $(searchTab).html(table);
    			            }
    			            
    			            
                }		//if	
        }); //GetArticles
               
                     
	};



function showUserReqList(user){
    
    
    var result = Main.GetUserRequestList(user,getReqURL());
        
        var $tabs = $('#tabs').tabs(); 
        $tabs.tabs('select', 2);
        
        if (result.error==null){
            if (result.value.Rows.length>0){
        var table='';
         table = '<h4>Recent Requests</h4><table id="tblrecentTickets" name="tblrecentTickets">';
			        alt = '';
			        table +='';
			        table +='<thead><tr>'+ 
			                    //'<td class="tcapb" style="background-color:#3c3c3c;color:White;">Edit</td>'+
								'<td class="tcapb" style="background-color:#3c3c3c;color:White;">iTicketID</td>'+
                                '<td class="tcapb" style="background-color:#3c3c3c;color:White;">Source</td>'+
                                '<td class="tcapb" style="background-color:#3c3c3c;color:White;">IssueType</td>'+
                                '<td class="tcapb" style="background-color:#3c3c3c;color:White;">ProblemDescription</td>'+
                                '<td class="tcapb" style="background-color:#3c3c3c;color:White;">InsertDate</td>'+
                                

							    //'<td class="tcapb" style="background-color:#3c3c3c;color:White;">Updated By</td>'+
							    
					        '</tr></thead><tbody class="scrollingContent">';
                
			        for(i = 0; i < result.value.Rows.length; i++) {
				        table += '<tr>' +
				                   // '<td width=5><a href="javascript:void(0)" onclick="GetSolInfo(' + result.value.Rows[i].iArticleID +');">Edit</a>&nbsp;</td>'+    
									'<td>'+result.value.Rows[i].iTicketID+'&nbsp;</td>'+
                                    '<td>'+result.value.Rows[i].Source+'&nbsp;</td>'+
                                    '<td>'+result.value.Rows[i].IssueType+'&nbsp;</td>'+
                                    '<td>'+result.value.Rows[i].ProblemDescription+'&nbsp;</td>'+
                                    '<td>'+result.value.Rows[i].InsertDate+'&nbsp;</td>'+
                                    
							        //'<td>' + result.value.Rows[i].UpdateBy 	+ '&nbsp;</td>' +
							        
							       '</tr>';
				        (alt == '')
					        ?	alt = 'alt'
					        :	alt = '';
			        }
        			
			        table += '</tbody></table>';
			          
			          
        			$('#recentTickets').html(table);
        			var r = (navigator.userAgent.indexOf('Firefox')) > 0 ? '99%':'500' ;
        			initTableWidget('tblrecentTickets','99%',r,Array('N','S','S','S','S'));
                    //$('recentTickets').style.display='';
                    return;
            }
       }
    
}

    

	
	function fnGetRecentPopularurls(){
	    var x= getReqURL();
	    
	    Main.GetRecentAndPopularArticles(x,function(result){// attach the template
                if (result.error==null){
			        var table='',i=0; 
			        table = '<table width=95%><tr><td><BR/><P style="font-size:13px;color:#DD8025;font-weight:bold">Recent Articles:</P><BR/>';
		                table +='';
		                if(result.value.Tables.Table.Rows.length==0){
		                    table +=    'Your Search did not return any results, consider changing the search keywords';
		                };
		                table+='<ul>' 
		                for(i = 0; i < result.value.Tables.Table.Rows.length; i++) {
			                table +=    '<li><a href="javascript:void(0)"  onclick="newTab(' + result.value.Tables.Table.Rows[i].ArticleID +',\''+ result.value.Tables.Table.Rows[i].ArticleID + '-' + result.value.Tables.Table.Rows[i].Title.substring(0,13) +'...\');">' +
						                result.value.Tables.Table.Rows[i].Title + '</a><br><font color=green style="size:11px">' + result.value.Tables.Table.Rows[i].CategoryTree + '.</font></li><BR>' 
		                }
            			
		                table += '</ul></td><td>'
		                
		                
		                table += '<BR/><P style="font-size:13px;color:#DD8025;font-weight:bold">Most popular Articles:</P><BR/>';
		                table +='';
		                if(result.value.Tables.Table1.Rows.length==0){
		                    table +=    'Your Search did not return any results, consider changing the search keywords. or Click Here to Open a Request';
		                };
		                table+='<ul>' 
		                for(i = 0; i < result.value.Tables.Table1.Rows.length; i++) {
			                table +=    '<li><a href="javascript:void(0)"  onclick="newTab(' + result.value.Tables.Table1.Rows[i].ArticleID +',\''+ result.value.Tables.Table1.Rows[i].ArticleID + '-' + result.value.Tables.Table1.Rows[i].Title.substring(0,13) +'...\');">' +
						                result.value.Tables.Table1.Rows[i].Title + '</a>(' + result.value.Tables.Table1.Rows[i].HitCount + ')<br><font color=green style="size:11px">' + result.value.Tables.Table1.Rows[i].CategoryTree + '.</font></li><BR>' 
		                }
            			
		                table += '</ul>'
		                table += '</td></tr></table>';
    			       
    			        //$('#divStats').html(table);
    			        
    			        maintab.CreateTab('Recent / Popular articles',false,null,table,"T0");
    			        searchTab=maintab.CreateTab("Search Results",false,null,"Enter any keyword in the search textbox click search button",1);
    			        goHome();
                }		//if	
        }); //GetArticles
	}
	
	function newTab(id,title){
	    $("#divStats").hide();
	    
	    if (!maintab.tabExists(title)) {
    			if( maintab.getTabIndex() >= 7) // maximum 5 tabs open 
    				    maintab.TabCloseEl(3);
    				
    				
    				Main.GetArticleInfo(id,function(result){
    				    
    				    if (result.error==null){
    				            
    				        var html = '<table width=100% ><tr><td align=right>'
    				            html += '<a href="javascript:void(0)" onclick=launchFull(\"td'+id+'\");>'
    				            html += '<img src="includes/images/icon_print.gif" title=Print align=baseline>&nbsp;Print Topic</a>&nbsp;&nbsp;&nbsp;&nbsp;'
    				            html += '<a href="javascript:void(0)" onclick=sendEmail(\"'+id+'\");>'
    				            html += '<img src="includes/images/iEmail.gif" title=Email align=baseline>&nbsp;Email Topic</a>&nbsp;&nbsp;&nbsp;&nbsp;'
    				            html += '<a href="javascript:void(0)" onclick="goHome();">'
    				            html += '<img src="includes/images/Home1.gif" title=Home align=baseline>&nbsp;Home</a>&nbsp;&nbsp;&nbsp;&nbsp;'
    				            html += '</td></tr><tr><td id=td'+id+' name=td'+id+' class="article">'+'<br>'
    				            html += '<h1 class="sh2">' + result.value.Tables.Table.Rows[0].Title +'</h1><br>' 
    				            html += result.value.Tables.Table.Rows[0].Article +'<br></td><td width="15px">&nbsp;</td><td width="275px"><span width="100%" id=span'+id+' name=span'+id+ '></span></td></tr></table><div id="dvArt'+id+'"></div>';
    				            
                            var sh=""
    				            sh+="<table width=100% border=1 cellspacing=1 cellpadding=1 id=btmtbl>"
    				            sh+="<tr><thead colsapn=4>Topic Information</thead>"
    				            sh+="</tr>"
    				            sh+="<tr><td class=lbl>KB ID</td><td>"+id+"</td>"
    				            sh+="<td class=lbl># hits</td><td>"+result.value.Tables.Table.Rows[0].HitCount+"</td></tr>"
    				            sh+="<tr><td class=lbl>Created Date</td><td>"+result.value.Tables.Table.Rows[0].CreatedDate+"</td>"
    				            sh+="<td class=lbl>Created By</td><td>"+result.value.Tables.Table.Rows[0].CreatedBy+"</td></tr>"
    				            sh+="<tr><td class=lbl>Last Modified Date</td><td>"+result.value.Tables.Table.Rows[0].LastModifiedDate+"</td>"
    				            sh+="<td class=lbl>Modified By</td><td>"+result.value.Tables.Table.Rows[0].LastModifiedBy+"</td></tr>"
    				            sh+="</table>"
    				        
    				        var salso= '<br><P style=\'font-size:16px;color:#DD8025;font-weight:bold\'>See also:</P><ul>';
    				            for(var i = 0; i < result.value.Tables.Table1.Rows.length; i++) {
        				            salso+= '<li class="salso"><img src="includes/images/side_expand.gif" align=baseline />&nbsp;<a href="javascript:void(0)"  onclick="newTab(' + result.value.Tables.Table1.Rows[i].ArticleID +',\''+ result.value.Tables.Table1.Rows[i].ArticleID + '-' + result.value.Tables.Table1.Rows[i].Title.substring(0,13) +'...\');">'+result.value.Tables.Table1.Rows[i].Title+'</a></li>';
                                    }
                                salso+= '</ul>';                                    				            
    				        maintab.CreateTab(title,true,null,html,id);
    				        
    				        $("#dvArt"+id).html(sh);
    				        $("#span"+id).html(salso);
    				        
    				        
    			        }
    			        else{
    			            
    			        }	
    				});
    				
            	
        }
	}


function goHome(){
    
 maintab.tabExists('Recent / Popular articles');
 

//   $("#divStats").show();

        
}
function launchFull(html) {
    var str = "left=0,screenX=0,top=0,screenY=0"; 
    if (window.screen) {
      var ah = screen.availHeight - 60;
      var aw = screen.availWidth - 10;
      str += ",status=yes,height=" + ah;
      str += ",innerHeight=" + ah;
      str += ",scrollbars=1,width=" + aw;
      str += ",resizable,innerWidth=" + aw;
    } else {
      str += ",resizable=yes"; // so the user can resize the window manually
    }

  var Win = window.open("about:blank", 'Print', str);
  
  Win.document.write(document.all(html).innerHTML);
  
}

function sendEmail(id){
    
         document.all.hdnAID.value=id;
         $('#dlgSendEmail').dialog('open');
}

function sEmail(){
    if($('#txtEATo').val()==''){
        $('#spnStatus_su').text('Enter To Email address');
        return;
    }
    if($('#txtEAFrom').val()==''){
        $('#spnStatus_su').text('Enter from Email address');
        return;
    }
    if($('#txtEAName').val()==''){
        $('#spnStatus_su').text('Enter Name');
        return;
    }
    
    //alert([$('#txtEATo').val(), $('#txtEAName').val(), $('#txtEAFrom').val(),$('#hdnAID').val()]);
   Main.SendEmail($('#txtEATo').val(), $('#txtEAName').val(), $('#txtEAFrom').val(),$('#hdnAID').val());
    $('#dlgSendEmail').dialog('close');
}



function setProperties(user){


}



function login(){
    
	if($('#txtUserName').val()==''){
        $('#spnStatus').text('Enter email address');
        return;
    }
	if($('#txtPassword').val()==''){
        $('#spnStatus').text('Enter password');
        return;
    }


    Main.Login($('#txtUserName').val(), $('#txtPassword').val(),function(result)
    {
    
     if (result.error==null){
            if(result.value[0]!='Login Failed')
            {
                $('#spanUser').text(result.value[1]);
                $('#dialog').dialog('close');
                $('#dialog_link').html("Sign out");
                $('#A1').text("Edit Account");
                
                
                if ($('#remember').attr('checked')) {
                    var username = result.value[1];
                    var email = Main.GetEncryptedVal(result.value[2]).value;
                    // set cookies to expire in 14 days
                    $.cookie('username', username, { expires: 14 });
                    $.cookie('email', email, { expires: 14 });
                    $.cookie('remember', true, { expires: 14 });
                } else {
                // reset cookies
                    var username = result.value[1];
                    var email = Main.GetEncryptedVal(result.value[2]).value;
                    // set cookies to expire in 14 days
                    $.cookie('username', username, { expires: 1 });
                    $.cookie('email', email, { expires: 1 });
                    $.cookie('remember', true, { expires: 1 });
                }

                
                
                
                showUserReqList($('#txtUserName').val());
                
                var x = getReqURL()
                
				if (x=='cn'){
	                window.frames['ifSubmitTkt'].location ='SubmitTicket.aspx';
	                }
	            
	            if (x=='cs'){
	                window.frames['ifSubmitTkt'].location ='SubmitTicket_course.aspx';
	             }
	             if (x=='ps'){
	                window.frames['ifSubmitTkt'].location ='SubmitTicket_PS.aspx';
	             }
                if (x==''){
	                window.frames['ifSubmitTkt'].location ='LoginPrompt.htm';
	             }
                var iframeElement = document.getElementById('ifSubmitTkt');
                iframeElement.style.width = "100%";
                iframeElement.style.height = "500px";

                
            
                return true;      
            }
            
            if(result.value[0]=='Login Failed')
            {
                $('#spnStatus').text('Login Failed');
                $('#tdAcctNew').css("display","");
                return false;      
            }    
       }     
    });
}

function logout(){
    
   
            $('#spanUser').text("Guest");
            $('#dialog_link').html("Sign in");
            $('#A1').text("Create Account");
            window.frames['ifSubmitTkt'].location ='LoginPrompt.htm';
            $('#recentTickets').text("");
            
            var remember = $.cookie('remember');
            if ( remember == 'true' ) {

                $.cookie('username', null);
                $.cookie('email', null);
                $.cookie('remember', null);
            }
                            
            return true;      
   
}

function SignUp(){
    
    if($('#txtUserName_su').val()==''){
        $('#spnStatus_su').text('Enter User Name');
        return;
    }
    if($('#txtPassword_su').val()==''){
        $('#spnStatus_su').text('Enter password');
        return
    }
    if($('#txtrePassword_su').val()==''){
        $('#spnStatus_su').text('Enter password');
        return;
    }
    
    if($('#txtFirstName_su').val()==''){
        $('#spnStatus_su').text('Enter First Name');
        return;
    }
    
    if($('#txtPhone_su').val()==''){
        $('#spnStatus_su').text('Enter Phone');
        return;
    }
    
    
    if($('#txtPassword_su').val()!=$('#txtrePassword_su').val()){
         $('#spnStatus_su').text('Both passwords don\'t match, try again');
         return;
    }
 
    if($('#A1').text()=='Edit Account'){
        Main.UpdateAccount($('#txtUserName_su').val(), $('#txtPassword_su').val(), $('#txtFirstName_su').val(),'',$('#txtPhone_su').val(), $('#txtUserName_su').val(), function(result)
        {
                if (result.error==null)
                {
                    if (result.value.Rows[0].retval>0)
                    {
                        alert(result.value.Rows[0].msg);
                        $('#dlgSignUp').dialog('close');
                     }
                    else 
                    if (result.value.Rows[0].retval < 0)
                    {
                        
                        alert(result.value.Rows[0].msg);
                    }
                }
                
            }
         );
    }
    else{
         Main.SignUp($('#txtUserName_su').val(), $('#txtPassword_su').val(), $('#txtFirstName_su').val(),'',$('#txtPhone_su').val(), $('#txtUserName_su').val(), function(result)
            {
                if (result.error==null)
                {
                    if (result.value.Rows[0].AccountID>0)
                    {
                        alert(result.value.Rows[0].Msg);
                        $('#dlgSignUp').dialog('close');
                     }
                    else 
                    if (result.value.Rows[0].AccountID < 0)
                    {
                        
                        alert(result.value.Rows[0].Msg)
                    }
                }
                
            }
         );
   }  
}

//$('#txtPassword_su').keyup(function(){
//    $('#spnStatus_su').text('');
//});

function newAccount(){
    $('#dialog').dialog('close');
    $('#dlgSignUp').dialog('open');
    
}

function forgotPW(){
    $('#txtFPWEmail').val('');
    $('#spnFPWStatus').text('');
    
    $('#dlgFPW').dialog('open');
    $('#dialog').dialog('close');
    $('#dlgSignUp').dialog('close');
    
}


function getReqURL(){
     var fullURL = parent.document.URL 
	 var xxx = fullURL.substring(fullURL.indexOf('?')+3, fullURL.length)
	 xxx= xxx.replace('#','');
	 return xxx;   			
				
}

function resetSignin(){
    $('#txtUserName').val('');
    $('#txtPassword').val('');
    $('#spnStatus').text('');
    
    
    
}


function fPW(){
    if($('#txtFPWEmail').val()==''){
        $('#spnFPWStatus').text('Enter To Email address');
        return;
    }
    
    //alert([$('#txtEATo').val(), $('#txtEAName').val(), $('#txtEAFrom').val(),$('#hdnAID').val()]);
   Main.ForgotPassword($('#txtFPWEmail').val(), '',getReqURL(),function(result)
            {
                if (result.error==null)
                {
                    if(result.value[0]!='Login Failed')
                    {
                        alert(result.value[0]);
                        $('#dlgFPW').dialog('close');
                     }
                    else 
                    if (result.value[0]=='Login Failed')
                    {
                      $('#spnFPWStatus').text('The data you entered does not match with our records.');  
                    }
                }
                
            }
   
   );
    
}

function fnrdoSearchopt()
{
	var src = getReqURL();

	if(document.all.rdoSearchopt[0].checked == true){
	    if (searchTab!=null){
	        searchTab.cell.innerHTML = "&nbsp;Search Results&nbsp;";
	        $(searchTab).html("Enter any keyword in the search textbox click search button");
	        }
		}
	else if(document.all.rdoSearchopt[1].checked == true)
	{
	    searchTab.cell.innerHTML = "&nbsp;Browse by Topic&nbsp;&nbsp;";
	    $.get("ProbeByCtgry.asp?r="+src, null,
                    function(data){
                    $(searchTab).html(data);
         });
	        //$(searchTab).html(sdata);
	    
		//top.document.all.MainCPH.style.display = "none";
	}
	maintab.tabExists('Search Results');
}