function pageWidth() {
return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ?document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
}
function pageHeight() {
return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;
}
function exploitSpace() {
	var vheight = pageHeight();
	var hwidth = pageWidth();
	
//	if($("container")){
//	$("container").style.width = (hwidth-100)+"px";
//	}
	if($("inside")){
	$("inside").style.height = (vheight-110)+"px";
	}
}
function adjustHeaderMargin(){
	var hwidth = pageWidth();
	
	if($("ubitrack")){
	$("ubitrack").style.marginLeft = (hwidth - $("container").offsetWidth)/2 +"px";
	}
	if($("falcon")){
	$("falcon").style.marginRight = (hwidth - $("container").offsetWidth)/2 +"px";
	}
}
Preloader = function(){
var o = this;
o.img = []; o.r = []; o.g = [];
o.n = {}; o.total = o.loaded = 0;
};
Preloader.prototype.add = function(i, g){
var o = this, n = (o.g[o.total] = [g || "general"])[0];
(g = o.n)[n] >= 0 ? ++g[n] : g[n] = 1;
o.img[o.total++] = i;
};
Preloader.prototype.load = function(){
var o = this, p = o.img, l = p.length, a, g = o.g;
while(l--){
(g[l][1] = a = new Image()).src = p[a.i = l];
a.onload = function(){
if(o.r[this.i]) return;
!--o.n[g[this.i][(o.r[this.i] = 1) - 1]] && o.onGroupComplete && o.onGroupComplete(g[this.i][0]);
o.onImageComplete && o.onImageComplete(this);
(++o.loaded == o.total) && o.onComplete && o.onComplete();
};
(a.fileSize !== undefined ? a.fileSize > -1 : a.width) && a.onload();
a.onerror = function(){
o.onImageError && o.onImageError(this);
}
}
};
Preloader.prototype.getImagesByGroup = function(n){
var g = this.g, i = [], p = 0, n = n || "general";
for(var j = g.length; j; g[--j][0] == n && (i[p++] = g[j][1]));
return i;
};
var ximage = new Preloader();
ximage.add("http://www.aaaqatar.com/images/menu1.gif");
ximage.add("http://www.aaaqatar.com/images/menu1.gif");
ximage.add("http://www.aaaqatar.com/images/button1.gif");
ximage.add("http://www.aaaqatar.com/images/button2.gif");
ximage.load();

function toggleSearch(obj){
if(obj.value=='Search..'){
obj.value='';

}
else if(obj.value==''){
obj.value='Search..';
}
else return;

}
var welcomeText = new Array();

var welcomeIndex=0;

// now give back $ to the other framework
jQuery.noConflict();

var cache = [];
  // Arguments are image paths relative to the current page.
  jQuery.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  };
jQuery.preLoadImages("images/back_all.jpg","images/back_all2.gif","images/logo.jpg","images/menu1.gif", "images/menu2.gif","images/button1.gif","images/button2.gif");


function changeWelcomeText(){
//alert("hell");
if(welcomeIndex >= welcomeText.length){
welcomeIndex = 0;
}
//alert(welcomeText[welcomeIndex])
jQuery('#welcome').css({width:"", fontSize:"0px"});
jQuery('#welcome').text(welcomeText[welcomeIndex]);
jQuery('#welcome').animate({fontSize: '18px'}, 600,callback);
//jQuery('#welcome').show('scale',{from:{height:0,width:0},origin:['right','left']},2000, callback);
welcomeIndex++;
}
function callback(){
setTimeout("changeWelcomeText()",4000);
}
jQuery(document).ready(function(){
 
 changeWelcomeText();
  
 });

