1

Topic: Google search

Hi,
I want to add google search to the right corner off the header. Any help smile

Re: Google search

Hello!

I had it before in my template file "main.tpl", you can always try to use the code.

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" <!-- forum_local -->>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- forum_head -->



</head>
<body>

    <div id="back">
        <div id="page">
        <div id="page-wrapper">
        <div id="header">
        <div id="logo"></div>


<div id="brd-wrap" class="brd">
<div <!-- forum_page -->>

<div id="brd-head" class="gen-content">
    
    
</div>

<div id="brd-navlinks" class="gen-content">
    <!-- forum_navlinks -->
    <!-- forum_admod -->
</div>

<div id="brd-visit" class="gen-content">
    <!-- forum_welcome -->
    <!-- forum_visit -->
</div>

<!-- forum_announcement -->

<div class="hr"><hr /></div>

<div id="brd-main">

    <!-- forum_main_title -->

<script type="text/javascript" src="include/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('search', '1');

function postform()
{        
        var customSearchControl = new google.search.CustomSearchControl('MYGOOGLESEARCHCODE');
        var drawOptions = new google.search.DrawOptions();
        customSearchControl.draw(document.getElementById("contactArea"), drawOptions);
        customSearchControl.execute(document.getElementById("query_input").value);
        $('.brd').css("display", "none");
        centerPopup();
        loadPopup();
        return false;
}

$(document).ready(function() {
    
    $("#searchbtn").click(function () {
        var customSearchControl = new google.search.CustomSearchControl('MYGOOGLESEARCHCODE');
        var drawOptions = new google.search.DrawOptions();
        customSearchControl.draw(document.getElementById("contactArea"), drawOptions);
        customSearchControl.execute(document.getElementById("query_input").value);
        $('.brd').css("display", "none");
        centerPopup();
        loadPopup();
});
    
    $("#popupContactClose").click(function(){
        $('.brd').css("display", "block");
        disablePopup();
    });
    //Click out event!
    $("#backgroundPopup").click(function(){
        $('.brd').css("display", "block");
        disablePopup();
    });
    //Press Escape event!
    $(document).keypress(function(e){
        if(e.keyCode==27 && popupStatus==1){
            disablePopup();
        }
    });

    
    
});
</script>

<div id="searchcont" style="float:right;">
    <form method="post" action="" onsubmit="return postform()">
    
    <input type="text" id="query_input" />
    <input type="button" value="Sök" id="searchbtn" style=" background-color: #333333;border: 1px solid #000000;
    border-radius: 2px 2px 2px 2px;
    color: #FFFFFF;
    font-family: inherit;
    font-size: 11px;
    font-weight: bold;
    height: 27px;
    min-width: 54px;
    padding: 0 8px;" />
    </form>
</div>
<center>






</center>


    <!-- forum_crumbs_top -->
    <!-- forum_main_menu -->
    <!-- forum_main_pagepost_top -->

    <!-- forum_main -->
    
    
    <!-- forum_main_pagepost_end -->
    <!-- forum_crumbs_end -->
</div>

<!-- forum_qpost -->

<!-- forum_info -->

<div class="hr"><hr /></div>



<!-- forum_debug -->


</div>
</div>

    <link rel="stylesheet" href="popup_files/general.css" type="text/css" media="screen">
    <script src="popup_files/jquery-1.js" type="text/javascript"></script>
    <script src="popup_files/popup.js" type="text/javascript"></script>
    <div style="position: absolute; top: 76px; left: 479px; display: none;" id="popupContact">
        <a id="popupContactClose">x</a>
        <h1>Search Result</h1>
        <p id="contactArea"></p>
    </div>
    <div style="height: 536px; opacity: 0.7; display: none;" id="backgroundPopup"></div>
<script type="text/javascript">
var popupStatus = 0;

//loading popup with jQuery magic!
function loadPopup(){
    //loads popup only if it is disabled
    if(popupStatus==0){
        $("#backgroundPopup").css({
            "opacity": "0.7"
        });
        $("#backgroundPopup").fadeIn("slow");
        $("#popupContact").fadeIn("slow");
        popupStatus = 1;
    }
}

//disabling popup with jQuery magic!
function disablePopup(){
    //disables popup only if it is enabled
    if(popupStatus==1){
        $("#backgroundPopup").fadeOut("slow");
        $("#popupContact").fadeOut("slow");
        popupStatus = 0;
    }
}

//centering popup
function centerPopup(){
    //request data for centering
    var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;
    var popupHeight = $("#popupContact").height();
    var popupWidth = $("#popupContact").width();
    //centering
    $("#popupContact").css({
        "position": "absolute",
        "top": windowHeight/2-popupHeight/2,
        "left": windowWidth/2-popupWidth/2
    });
    //only need force for IE6
    
    $("#backgroundPopup").css({
        "height": windowHeight
    });
    
}
</script>
<style type="text/css">
#backgroundPopup
{
display:none;
position:fixed;
_position:absolute; /* hack for internet explorer 6*/
height:100%;
width:100%;
top:0;
left:0;
background:#000000;
border:1px solid #cecece;
z-index:1;
}
#popupContact{
display:none;
position:fixed;
_position:absolute; /* hack for internet explorer 6*/
height:484px;
width:508px;
background:#FFFFFF;
border:2px solid #cecece;
z-index:2;
padding:12px;
font-size:13px;
overflow:scroll;
}
#popupContact h1{
text-align:left;
color:#6FA5FD;
font-size:22px;
font-weight:700;
border-bottom:1px dotted #D3D3D3;
padding-bottom:2px;
margin-bottom:20px;
}
#popupContactClose{
font-size:14px;
line-height:14px;
right:6px;
top:4px;
position:absolute;
color:#6fa5fd;
font-weight:700;
display:block;
}

</style>

</body>
</html>

3

Re: Google search

Where is the code of google that I should copy/paste?