//Inline HTML Tooltip script: By JavaScript Kit: http://www.javascriptkit.com
//Created: July 10th, 08'

i = 0
var speed = 1

var htmltooltip={
    tipclass: 'htmltooltip',
    fadeeffect: [true, 500],
    anchors: [],
    tooltips: [], //array to contain references to all tooltip DIVs on the page

    positiontip:function($, tipindex, e){
        var anchor=this.anchors[tipindex]
        var tooltip=this.tooltips[tipindex]
        var scrollLeft=window.pageXOffset? window.pageXOffset : this.iebody.scrollLeft
        var scrollTop=window.pageYOffset? window.pageYOffset : this.iebody.scrollTop
        var docwidth=(window.innerWidth)? window.innerWidth-15 : htmltooltip.iebody.clientWidth-15
        var docheight=(window.innerHeight)? window.innerHeight-18 : htmltooltip.iebody.clientHeight-15
        var tipx=anchor.dimensions.offsetx
        var tipy=anchor.dimensions.offsety+anchor.dimensions.h
        tipx=(tipx+tooltip.dimensions.w-scrollLeft>docwidth)? tipx-tooltip.dimensions.w : tipx //account for right edge
        tipy=(tipy+tooltip.dimensions.h-scrollTop>docheight)? tipy-tooltip.dimensions.h-anchor.dimensions.h : tipy //account for bottom edge
        $(tooltip).css({left: tipx, top: tipy})
    },

    showtip:function($, tipindex, e){
        var tooltip=this.tooltips[tipindex]
        if (this.fadeeffect[0])
            $(tooltip).hide().fadeIn(this.fadeeffect[1])
        else
            $(tooltip).show()
    },

    hidetip:function($, tipindex, e){
        var tooltip=this.tooltips[tipindex]
        if (this.fadeeffect[0])
            $(tooltip).fadeOut(this.fadeeffect[1])
        else
            $(tooltip).hide()    
    },

    updateanchordimensions:function($){
        var $anchors=$('*[@rel="'+htmltooltip.tipclass+'"]')
        $anchors.each(function(index){
            this.dimensions={w:this.offsetWidth, h:this.offsetHeight, offsetx:$(this).offset().left, offsety:$(this).offset().top}
        })
    },

    render:function(){
        jQuery(document).ready(function($){
            htmltooltip.iebody=(document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
            var $anchors=$('*[@rel="'+htmltooltip.tipclass+'"]')
            var $tooltips=$('div[@class="'+htmltooltip.tipclass+'"]')
            $anchors.each(function(index){ //find all links with "title=htmltooltip" declaration
                this.dimensions={w:this.offsetWidth, h:this.offsetHeight, offsetx:$(this).offset().left, offsety:$(this).offset().top} //store anchor dimensions
                this.tippos=index+' pos' //store index of corresponding tooltip
                var tooltip=$tooltips.eq(index).get(0) //ref corresponding tooltip
                if (tooltip==null) //if no corresponding tooltip found
                    return //exist
                tooltip.dimensions={w:tooltip.offsetWidth, h:tooltip.offsetHeight}
                $(tooltip).remove().appendTo('body') //add tooltip to end of BODY for easier positioning
                htmltooltip.tooltips.push(tooltip) //store reference to each tooltip
                htmltooltip.anchors.push(this) //store reference to each anchor
                var $anchor=$(this)
                $anchor.hover(
                    function(e){ //onMouseover element
                        htmltooltip.positiontip($, parseInt(this.tippos), e)
                        htmltooltip.showtip($, parseInt(this.tippos), e)
                    },
                    function(e){ //onMouseout element
                        htmltooltip.hidetip($, parseInt(this.tippos), e)
                    }
                )
                $(window).bind("resize", function(){htmltooltip.updateanchordimensions($)})
            })
        })
    }
}

htmltooltip.render()

function goto(url, id){
	setCursorByID(id,"wait");
	document.location=url;
}		
function setCursorByID(id,cursorStyle) {
	var elem;
	if (document.getElementById && (elem=document.getElementById(id)) ) {
	    if (elem.style) elem.style.cursor=cursorStyle;
	}
}
	
var indexed = new Array();
var awards = new Array();
var images= new Image();
var TimeToFade = 1000.0;  
	
function LoadImage(idx){
        images.src=this.awards[idx][0];
}

function setAwards(){
	this.awards[0]=["http://www.bestsoftware4download.com/images/BS4D_award5.png", "http://www.bestsoftware4download.com/software/t-free-pr-builder-download-scjvxefi.html", "", "Best Software 4 Download"];
	this.awards[1]=["http://www.bestvistadownloads.com/templates/BVD/images/award_5.gif", "http://www.bestvistadownloads.com/software/t-free-pr-builder-download-eggjgfir.html", "_new", "Best Vista Download"];
	this.awards[2]=["http://www.kingdownloads.com/images/kdown_5star1.gif", "http://www.kingdownloads.com/WebDeveloper/Website_Promotion/Pr_Builder_127170.htm", "_new","Pr Builder 5 Star Award at kingdownloads.com"];
	this.awards[3]=["images/softwarej_award_88x88.gif", "http://www.SoftWareJ.com/", "_new", "Free download software"];
	this.awards[4]=["http://www.bluesoftcenter.com/shareaward.gif", "http://www.bluesoftcenter.com/Pr_Builder-165151.html", "_new", "Blue Software Center"];
	this.awards[5]=["http://www.top4download.com/templates/T4D/images/award_120x60_5.gif", "http://www.top4download.com/pr-builder/ttktrjbp.html", "_new", "Top 4 Download"];
	this.awards[6]=["http://www.windows7download.com/templates/w7d/images/awards/award_120x60_5.png", "http://www.windows7download.com/win7-pr-builder/ogjdlksj.html", "_new", "Windows 7 Download"];
	this.awards[7]=["http://download2pc.com/images/download2pc_award.png", "http://download2pc.com", "_new", "Awards From Download2PC - One of the best software download website."];
	this.awards[8]=["http://www.download25.com/media/awards/5stars.jpg", "http://www.download25.com/pr-builder-download.html", "_new", "5 stars award from www.download25.com"];
	this.awards[9]=["http://www.downloadroute.com/images/download-buttons/Pr-Builder-InetCellPhone-com.png", "http://www.downloadroute.com/Pr-Builder-InetCellPhone-com.html", "_new", "Pr Builder download"];
	this.awards[10]=["http://www.softtester.com/gfx/softtester5stars.gif", "http://www.softtester.com/programs/pr-builder-141609.shtml", "_new", "SoftTester download software"];
	this.awards[11]=["images/5stars_geardownload.png", "http://www.geardownload.com/webdevelopment/pr-builder.html", "_new", "and rated 5 stars on GearDownload.com"];
	this.awards[12]=["http://www.sharewareplaza.com/images/logos/star-5-2.gif", "http://www.sharewareplaza.com/pr-builder-download_81562.html", "_new", "Shareware Plaza"];
	this.awards[13]=["http://www.eurodownload.com/images/rating5.png", "http://www.eurodownload.com/download-software/159868/Pr-Builder.html/", "_new", "Pr Builder download Golden Award from euroDownload"];
	this.awards[14]=["http://www.downloadmost.com/images/5star.gif", "http://www.downloadmost.com/shareware/software/?Pr%20Builder-36270.html", "_new", "Download Most"];
	this.awards[15]=["images/gtdownload.png", "http://www.gtdownload.com/free-download/Web-Development-category/Website-Promotion-category/Pr-Builder-view-details.html", "_new", "GT Download"];
	this.awards[16]=["images/sharewareconnection.gif", "http://www.sharewareconnection.com/pr-builder.htm", "_new", "Shareware Connection"];
	this.awards[17]=["images/downloadplex.png", "http://www.downloadplex.com/Windows/Web-Development/Site-Administration/pr-builder_243978.html", "_new", "Free Software Downloads, Over 120000 free to try software downloads on the Web"];
	this.awards[18]=["http://www.resourcefill.com/resourcefill5star.png", "http://www.resourcefill.com/39474/details-pr-builder.html", "_new", "Rated 5 stars on ResourceFill"];
	this.awards[19]=["http://www.redsofts.com/images/5starsaward.gif", "http://www.redsofts.com/soft/954/99049/Pr_Builder.html", "_new", "Rated 5 stars on redsofts.com"];
	this.awards[20]=["http://www.redsofts.com/images/5starsaward.gif", "http://www.redsofts.com/soft/954/99049/Pr_Builder.html", "_new", " 2.0 : 5 Stars Award at cleansofts.com !"];
	this.awards[21]=["http://www.cleansofts.com/images/5starsaward.gif", "http://www.cleansofts.com/get/39/120090/Pr_Builder.html", "_new", "2.0 : 5 Stars Award at dailysofts.com !"];
	this.awards[22]=["images/dailysoft.gif", "http://www.dailysofts.com/program/221/128546/Pr_Builder.html", "_new", "Awards 5 stars from CoreDownload"];
	this.awards[23]=["images/coredownload.png", "http://www.coredownload.com/download-Pr-Builder-92264.html", "_new", "Free download software"];
	this.awards[24]=["images/bestdownloadcenter.png", "http://www.bestdownloadscenter.com/windows/Web-Authoring/Site-Management/InetCellPhonecom-Pr-Builder.html", "_new", "Awards 5 stars from best download center"];
	this.awards[25]=["images/sharewareisland.jpg", "http://www.sharewareisland.com/application.aspx?FileID=1340801", "_new", "Awards 5 stars from best Shareware Island"];
	this.awards[26]=["images/123freedownloads.gif", "http://www.123-free-download.com/download/site-promotion/pr-builder/112663.html", "_new", "Awards 5 stars from best 123 free downloads"];
	this.awards[27]=["images/1st_5_stars.gif", "http://www.1st-download.com/download/free/site-promotion/pr-builder/63894.html", "_new", "Awards 5 stars from 1 Download Center"];
	this.awards[28]=["http://www.downloadready.com/images/dr-5.png", "http://www.downloadready.com/dl/download_77296.htm", "_new", "Rated by 5 points award on download ready"];
	this.awards[29]=["http://www.yankeedownload.com/images/ratingbest.png", "http://www.yankeedownload.com/software/Pr-Builder-kjabj.html", "_new", "Download Pr Builder free"];
	this.awards[30]=["http://www.softarea51.com/images/softarea51_award_1b.gif", "http://www.downloadpipe.com", "_new", "Pr Builder rated 5 stars on www.softarea51.com"];
	this.awards[31]=["http://www.downloadpipe.com/images/5star.gif", "http://www.softarea51.com/windows/Web_Development/Other_Web_Development/Review-Pr_Builder.html", "_new", "Pr Builder rated 5 stars on www.downloadpipe.com"];
	this.awards[32]=["http://www.downloadtyphoon.com/templates/downty/images/award_120x60_5.gif", "http://www.downloadtyphoon.com/pr-builder/infofhbmaxao", "_new", "Download Typhoon"];
}
function resetShowed(){
        if(this.awards.length==this.indexed.length){
            this.indexed.length=0;
        }
}
function fade(eid)
{

  var element = document.getElementById(eid);
  if(element == null)
    return;
   
  if(element.FadeState == null)
  {
    if(element.style.opacity == null
        || element.style.opacity == ''
        || element.style.opacity == '1')
    {
      element.FadeState = 2;
    }
    else
    {
      element.FadeState = -2;
    }
  }
   
  if(element.FadeState == 1 || element.FadeState == -1)
  {
    element.FadeState = element.FadeState == 1 ? -1 : 1;
    element.FadeTimeLeft = TimeToFade - element.FadeTimeLeft;
  }
  else
  {
    element.FadeState = element.FadeState == 2 ? -1 : 1;
    element.FadeTimeLeft = TimeToFade;
    setTimeout("animateFade(" + new Date().getTime() + ",'" + eid + "')", 33);
  }  
}
function animateFade(lastTick, eid)
{  
  var curTick = new Date().getTime();
  var elapsedTicks = curTick - lastTick;
 
  var element = document.getElementById(eid);
 
  if(element.FadeTimeLeft <= elapsedTicks)
  {
    element.style.opacity = element.FadeState == 1 ? '1' : '0';
    element.style.filter = 'alpha(opacity = '
        + (element.FadeState == 1 ? '100' : '0') + ')';
    element.FadeState = element.FadeState == 1 ? 2 : -2;
    return;
  }
 
  element.FadeTimeLeft -= elapsedTicks;
  var newOpVal = element.FadeTimeLeft/TimeToFade;
  if(element.FadeState == 1)
    newOpVal = 1 - newOpVal;

  element.style.opacity = newOpVal;
  element.style.filter = 'alpha(opacity = ' + (newOpVal*100) + ')';
 
  setTimeout("animateFade(" + curTick + ",'" + eid + "')", 33);
}
function ifshowed(num){
        found=false; 
        for(n=0; n<this.indexed.length;n++){
            if(num==this.indexed[n]){
                found=true;
                break;
            }
            else{
                found = false;
            }
        }
        return found;
}
function getNextAward(){
        randomnumber=Math.floor(Math.random()*32)

	frame=document.getElementById("fadeshow1");
	lnk=document.getElementById("awardUrl");
	img=document.getElementById("awardImage");
	
        if(!ifshowed(randomnumber)){
            	src=this.awards[randomnumber][0];
            	url=this.awards[randomnumber][1];
            	target=this.awards[randomnumber][2];
            	alt=this.awards[randomnumber][3];
		
		LoadImage(randomnumber);
		fade("awardImage");
        	//img.width=this.images.width;
       		//img.height=this.images.height;
        	img.src=this.images.src;
        	lnk.href=url;
        	lnk.title=alt;
        	lnk.target=target;
        	img.alt=alt;
		fade("awardImage");

            	this.indexed[this.indexed.length]=randomnumber;
        }

	if (this.indexed.length < this.awards.length){
            resetShowed();
	    setTimeout("getNextAward()", 2000);
	}
	//fade("awardImage");
}

function getAwards() {
	setAwards();
	setTimeout("getNextAward()", 1000);
}
