﻿// JScript File

function checkInterestedIn(source, clients)
{
    var a=document.getElementById("ctl00_ContentPlaceHolder1_softwareDesignCheckBox").checked;
    var b=document.getElementById('ctl00_ContentPlaceHolder1_webFlashDesignCheckBox').checked;
    var c=document.getElementById('ctl00_ContentPlaceHolder1_fullFlashCheckBox').checked;
    var d=document.getElementById('ctl00_ContentPlaceHolder1_trainingCheckBox').checked;
    var e=document.getElementById('ctl00_ContentPlaceHolder1_hrServicesCheckBox').checked;
    var f=document.getElementById('ctl00_ContentPlaceHolder1_logoDesignCheckBox').checked;
    var g=document.getElementById('ctl00_ContentPlaceHolder1_webSiteDesignCheckBox').checked;
    if(a==false && b==false && c==false && d==false && e==false && f==false && g==false)
    {
        clients.IsValid=false;
    }
}


function swapPic()
{
     if(document.getElementById)
     {
        var thePicture=document.getElementById("header");
        var picPath="images/pic"+rnd(8)+".jpg";
        thePicture.style.background="url("+picPath+")";
    }
}
     
function rnd(n)
{
     return Math.floor(Math.random() * n) + 1;
}

////////////////////////////////////////////////spin-images//////////////////////////////////////////////////////////////









//////////////////////////////////////////////////gmap///////////////////////////////////////////////////////////////////
 
    function initialize() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(29.674783,-283.0166262), 15);
        map.setUIToDefault();
      }
    }


////////////////////////////////////////////scrollimages/////////////////////////////////////////////////////////////

var mqAry1=['../Images/mbu1.jpg','../Images/dvg1.jpg','../Images/dsc1.jpg','../Images/bs1.jpg','../Images/ga1.jpg','../Images/tdm1.jpg'];
var mqAry2=['../Images/mbu1.jpg','../Images/dsc1.jpg','../Images/tdm1.jpg','../Images/ga1.jpg','../Images/bs1.jpg','../Images/dvg1.jpg'];
var mqr = []; 
function start1() 
{
   new mq('scroll1',mqAry1,188);
   new mq('m2',mqAry2,188);
}

function mq(id1,ary,wid)
{
	this.mqo=document.getElementById(id1); 
	var heit = this.mqo.style.height; 
	var left1=this.mqo.style.left;
	this.mqo.onmouseout=function() {mqRotate(mqr);}; 
	this.mqo.onmouseover=function() {clearTimeout(mqr[0].TO);}; 
	this.mqo.ary=[]; 
	var maxw = ary.length; 
	for (var i=0;i<maxw;i++)
	{
		this.mqo.ary[i]=document.createElement('img'); 
		this.mqo.ary[i].src=ary[i]; 
		this.mqo.ary[i].style.position = 'absolute'; 
		this.mqo.ary[i].style.left =  (wid*i)+'px'; 
		this.mqo.ary[i].style.width = wid+'px'; 
		this.mqo.ary[i].style.height = heit; 
		this.mqo.appendChild(this.mqo.ary[i]);
	} 
	mqr.push(this.mqo);
	mqRotate(mqr);
}
function mqRotate(mqr)
{
	if (!mqr) 
		return; 
	for (var j=mqr.length - 1; j > -1; j--) 
	{
		maxa = mqr[j].ary.length; 
		for (var i=0;i<maxa;i++)
		{
			var x = mqr[j].ary[i].style;  
			x.left=(parseInt(x.left,10)-1)+'px';
		}
		var y = mqr[j].ary[0].style; 
		if (parseInt(y.left,10)+parseInt(y.width,10)<0) 
		{
			var z = mqr[j].ary.shift(); 
			z.style.left = (parseInt(z.style.left) + parseInt(z.style.width)*maxa) + 'px'; 
			mqr[j].ary.push(z);
		}
	}
	mqr[0].TO=setTimeout('mqRotate(mqr)',10);
}









/////////////////////////////////////////////////////rightmenu///////////////////////////////////////////////////////////////////////////////////
 menuItems = new Array();
 menuItemNum = 0;
 function addMenuItem(text, url, img){
  if(img) menuItems[menuItemNum] = new Array(text, url, img);
  else if(text) menuItems[menuItemNum] = new Array(text, url);
  else menuItems[menuItemNum] = new Array();
  menuItemNum++;
 }
 menuWidth = 215; //menu width
 menuHeight = 176; //menu height
 menuDelay = 50; //delay before menu appears
 menuSpeed = 8; //speed which menu appears (lower=faster)
 menuOffset = 2; //offset of menu from mouse pointer
 addMenuItem("<center>\"the brainhub | TECHNOLOGIES\"</center>","http://www.thebrainhub.com");
 addMenuItem();
 addMenuItem("Software Solutions","http://www.thebrainhub.com/Services/SoftwareDevelopment.aspx");
 addMenuItem("Web Solutions","http://www.thebrainhub.com/Services/WebDevelopment.aspx");
 addMenuItem("Trainings","http://www.thebrainhub.com/Services/Training.aspx");
 addMenuItem("HR Services","http://www.thebrainhub.com/Services/HRServices.aspx");
 addMenuItem();
 addMenuItem("Enquiry","http://www.thebrainhub.com/Company/Enquiry.aspx");
 addMenuItem("Request a Quote","http://www.thebrainhub.com/Company/RequestQuote.aspx");
 addMenuItem("Contact us","http://www.thebrainhub.com/Company/Contactus.aspx");

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 if(window.navigator.appName == "Microsoft Internet Explorer" && window.navigator.appVersion.substring(window.navigator.appVersion.indexOf("MSIE") + 5, window.navigator.appVersion.indexOf("MSIE") + 8) >= 5.5)
  isIe = 1;
 else
  isIe = 0;

 if(isIe){
  menuContent = '<table id="rightMenu" width="0" height="0" cellspacing="0" cellpadding="0" style="font:menu;color:menutext;"><tr height="1"><td style="background:threedlightshadow" colspan="4"></td><td style="background:threeddarkshadow"></td></tr><tr height="1"><td style="background:threedlightshadow"></td><td style="background:threedhighlight" colspan="2"></td><td style="background:threedshadow"></td><td style="background:threeddarkshadow"></td></tr><tr height="10"><td style="background:threedlightshadow"></td><td style="background:threedhighlight"></td><td style="background:threedface"><table cellspacing="0" cellpadding="0" nowrap style="font:menu;color:menutext;cursor:default;">';
  for(m=0;m<menuItems.length;m++){
   if(menuItems[m][0] && menuItems[m][2])
    menuContent += '<tr height="17" onMouseOver="this.style.background=\'highlight\';this.style.color=\'highlighttext\';" onMouseOut="this.style.background=\'threedface\';this.style.color=\'menutext\';" onClick="parent.window.location.href=\'' + menuItems[m][1] + '\'"><td style="background:threedface" width="1" nowrap></td><td width="21" nowrap><img src="' + menuItems[m][2] + '"></td><td nowrap>' + menuItems[m][0] + '</td><td width="21" nowrap></td><td style="background:threedface" width="1" nowrap></td></tr>';
   else if(menuItems[m][0])
    menuContent += '<tr height="17" onMouseOver="this.style.background=\'highlight\';this.style.color=\'highlighttext\';" onMouseOut="this.style.background=\'threedface\';this.style.color=\'menutext\';" onClick="parent.window.location.href=\'' + menuItems[m][1] + '\'"><td style="background:threedface" width="1" nowrap></td><td width="21" nowrap></td><td nowrap>' + menuItems[m][0] + '</td><td width="21" nowrap></td><td style="background:threedface" width="1" nowrap></td></tr>';
   else
    menuContent += '<tr><td colspan="5" height="4"></td></tr><tr><td colspan="5"><table cellspacing="0"><tr><td width="2" height="1"></td><td width="0" height="1" style="background:threedshadow"></td><td width="2" height="1"></td></tr><tr><td width="2" height="1"></td><td width="100%" height="1" style="background:threedhighlight"></td><td width="2" height="1"></td></tr></table></td></tr><tr><td colspan="5" height="3"></td></tr>';
  }
  menuContent += '</table></td><td style="background:threedshadow"></td><td style="background:threeddarkshadow"></td></tr><tr height="1"><td style="background:threedlightshadow"></td><td style="background:threedhighlight"></td><td style="background:threedface"></td><td style="background:threedshadow"></td><td style="background:threeddarkshadow"></td></tr><tr height="1"><td style="background:threedlightshadow"></td><td style="background:threedshadow" colspan="3"></td><td style="background:threeddarkshadow"></td></tr><tr height="1"><td style="background:threeddarkshadow" colspan="5"></td></tr></table>';

  menuPopup = window.createPopup();
  menuPopup.document.body.innerHTML = menuContent;
 }

 function showMenu(){
  menuXPos = event.clientX + menuOffset;
  menuYPos = event.clientY + menuOffset;

  menuXIncrement = menuWidth / menuSpeed;
  menuYIncrement = menuHeight / menuSpeed;

  menuTimer = setTimeout("openMenu(0,0)", menuDelay);

  return false;
 }


 function openMenu(height, width){
  iHeight = height;
  iWidth = width;

  menuPopup.show(menuXPos, menuYPos, iWidth, iHeight, document.body);

  if(iHeight < menuHeight)
   menuTimer = setTimeout("openMenu(iHeight + menuYIncrement, iWidth + menuXIncrement)", 1);
  else
   clearTimeout(menuTimer);
 }


 if(isIe) document.oncontextmenu = showMenu;


//-->

var tbhmenu={

effectduration: 300, //duration of animation, in milliseconds
outlinemenulabels: [],
outlinemenus: [], //array to contain each block menu instances
zIndexVal: 1000, //starting z-index value for drop down menu
$shimobj: null,

addshim:function()
{
	$(document.body).append('<IFRAME id="outlineiframeshim" src="'+(location.protocol=="https:"? 'blank.htm' : 'about:blank')+'" style="display:none; left:0; top:0; z-index:999; position:absolute; filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)" frameBorder="0" scrolling="no"></IFRAME>')
	this.$shimobj=$("#outlineiframeshim")
	//alert(this.$shimobj.attr("src"))
},

alignmenu:function(e, outlinemenu_pos)
{
	var outlinemenu=this.outlinemenus[outlinemenu_pos]
	var $anchor=outlinemenu.$anchorobj
	var $menu=outlinemenu.$menuobj
	var menuleft=($(window).width()-(outlinemenu.offsetx-$(document).scrollLeft())>outlinemenu.actualwidth)? outlinemenu.offsetx : outlinemenu.offsetx-outlinemenu.actualwidth+outlinemenu.anchorwidth //get x coord of menu
	var menutop=($(window).height()-(outlinemenu.offsety-$(document).scrollTop()+outlinemenu.anchorheight)>outlinemenu.actualheight)? outlinemenu.offsety+outlinemenu.anchorheight : outlinemenu.offsety-outlinemenu.actualheight //get y coord of menu
	$menu.css({left:menuleft+"px", top:menutop+"px"})
	this.$shimobj.css({width:outlinemenu.actualwidth+"px", height:outlinemenu.actualheight+"px", left:menuleft+"px", top:menutop+"px", display:"block"})
},

showmenu:function(e, outlinemenu_pos)
{
	var outlinemenu=this.outlinemenus[outlinemenu_pos]
	var $menu=outlinemenu.$menuobj
	var $menuinner=outlinemenu.$menuinner
	if ($menu.css("display")=="none"){
		this.alignmenu(e, outlinemenu_pos)
		$menu.css("z-index", ++this.zIndexVal)
		$menu.show(this.effectduration, function(){
			$menuinner.css('visibility', 'visible')
		})
	}
	else if ($menu.css("display")=="block" && e.type=="click"){ //if menu is hidden and this is a "click" event (versus "mouseout")
		this.hidemenu(e, outlinemenu_pos)
	}
	return false
},

hidemenu:function(e, outlinemenu_pos)
{
	var outlinemenu=this.outlinemenus[outlinemenu_pos]
	var $menu=outlinemenu.$menuobj
	var $menuinner=outlinemenu.$menuinner
	$menuinner.css('visibility', 'hidden')
	this.$shimobj.css({display:"none", left:0, top:0})
	$menu.hide(this.effectduration)
},

definemenu:function(anchorid, menuid, revealtype, optwidth, optheight)
{
	var $=jQuery
	this.outlinemenulabels.push([anchorid, menuid, revealtype, optwidth, optheight])
},

render:function($)
{
	for (var i=0, labels=this.outlinemenulabels[i]; i<this.outlinemenulabels.length; i++, labels=this.outlinemenulabels[i])
	{
		this.outlinemenus.push({$anchorobj:$("#"+labels[0]), $menuobj:$("#"+labels[1]), $menuinner:$("#"+labels[1]).children('ul:first-child'), revealtype:labels[2]})
		var outlinemenu=this.outlinemenus[i]	
		outlinemenu.$anchorobj.add(outlinemenu.$menuobj).attr("_outlinemenupos", i+"pos")
		outlinemenu.$menuobj.css(parseInt(labels[3])>10? {width:parseInt(labels[3])+"px"} : {})
		outlinemenu.$menuobj.css(parseInt(labels[4])<outlinemenu.$menuobj.height()? {height:parseInt(labels[4])+"px", overflow:"scroll", overflowX:"hidden"} : {})
		outlinemenu.actualwidth=outlinemenu.$menuobj.outerWidth()
		outlinemenu.actualheight=outlinemenu.$menuobj.outerHeight()
		outlinemenu.offsetx=outlinemenu.$anchorobj.offset().left
		outlinemenu.offsety=outlinemenu.$anchorobj.offset().top
		outlinemenu.anchorwidth=outlinemenu.$anchorobj.outerWidth()
		outlinemenu.anchorheight=outlinemenu.$anchorobj.outerHeight()
		outlinemenu.$menuobj.css("z-index", ++this.zIndexVal).hide()
		outlinemenu.$menuinner.css("visibility", "hidden")
		outlinemenu.$anchorobj.bind(outlinemenu.revealtype=="click"? "click" : "mouseenter", function(e){
				return tbhmenu.showmenu(e, parseInt(this.getAttribute("_outlinemenupos")))
		})
		outlinemenu.$anchorobj.bind("mouseleave", function(e){
				var $menu=tbhmenu.outlinemenus[parseInt(this.getAttribute("_outlinemenupos"))].$menuobj
				if (e.relatedTarget!=$menu.get(0) && $(e.relatedTarget).parents("#"+$menu.get(0).id).length==0){ //check that mouse hasn't moved into menu object
					tbhmenu.hidemenu(e, parseInt(this.getAttribute("_outlinemenupos")))
				}
		})
		outlinemenu.$menuobj.bind("click mouseleave", function(e){
			tbhmenu.hidemenu(e, parseInt(this.getAttribute("_outlinemenupos")))
		})
	} //end for loop
	$(document).bind("click", function(e){
		for (var i=0; i<tbhmenu.outlinemenus.length; i++){
			tbhmenu.hidemenu(e, i)
		}
	}) //end document.click
	$(window).bind("resize", function(){
		for (var i=0; i<tbhmenu.outlinemenus.length; i++){
			var outlinemenu=tbhmenu.outlinemenus[i]	
			outlinemenu.offsetx=outlinemenu.$anchorobj.offset().left
			outlinemenu.offsety=outlinemenu.$anchorobj.offset().top
		}
	})
	tbhmenu.addshim()
}

}

jQuery(document).ready(function($){
	tbhmenu.render($)
})
     
