//detect browser

	var detect = navigator.userAgent.toLowerCase();
	var OS,browser,version,total,thestring;
	if (checkIt('konqueror'))
	{
        	browser = "Konqueror";
       	 OS = "Linux";
	}
	else if (checkIt('safari')) browser = "Safari"
	else if (checkIt('omniweb')) browser = "OmniWeb"
	else if (checkIt('opera')) browser = "Opera"
	else if (checkIt('webtv')) browser = "WebTV";
	else if (checkIt('icab')) browser = "iCab"
	else if (checkIt('msie')) browser = "Internet Explorer"
	else if (!checkIt('compatible'))
	{
 	       browser = "Netscape Navigator"
  	      version = detect.charAt(8);
	}
	else browser = "An unknown browser";
	if (!version) version = detect.charAt(place + thestring.length);

	if (!OS)
	{if (checkIt('linux')) OS = "Linux";
 	       else if (checkIt('x11')) OS = "Unix";
 	       else if (checkIt('mac')) OS = "Mac"
 	       else if (checkIt('win')) OS = "Windows"
 	       else OS = "an unknown operating system";
	}

function checkIt(string)
{
        place = detect.indexOf(string) + 1;
        thestring = string;
        return place;
}

function preloadImg(pstrDirectory) {
	var imgs = new Array ();
	var strExt = ".gif"
	var imgState = new Array('_off','_on','_over');

	var imgFiles = new Array ("company","solutions","portfolio","products","webco","mediacenter","partners","contactus","government");

	for (var i = 0; i < imgState.length; i++)
	{
		for (var j = 0; j < imgFiles.length; j++)
		{
			imgs[j] = new Image;
			imgs[j].src = pstrDirectory + 'menu_' + imgFiles[j] + imgState[i] + strExt;
		}
	}
}

function bookmarkSite() {
      window.external.AddFavorite("http://www.3datelecom.com","3dA Telecom - 1.866.907.1239");
}

function swapImg (obj, imgName) {
	if (document.images) { obj.src = imgName };
}

function backToTop(){
	for (I=250;I>0;I=I-5){
	parent.scroll(1,I) }
	parent.scroll(1,0);
}

function ShowVideo(pstrLocation) {
        LeftPosition = (screen.width) ? (screen.width-320)/2 : 0;;
        TopPosition = (screen.height) ? (screen.height-370)/2 : 0;;
	  settings = 'height=370,width=320,top='+TopPosition+',left='+LeftPosition+',scrollbars=no,resizable=no,status=no';
        win = window.open(pstrLocation,'newsvideo',settings);
}

function openFeature(mypage,myname,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=no'
	win = window.open(mypage,myname,settings)
}

function launchSuzy() {
	winSuzy = window.open('/en/templates/default/popups/suzy.php','suzy','height=150,width=110,top=0,left=0,scrollbars=no,resizable=no,status=no');
}


function launchVBR(id) {

     window.open('../popups/suzy.php','suzy','height=150,width=110,top=0,left=0,scrollbars=no,resizable=no,status=no').close();
      //before opening the virtual boardroom, close the Agent window

	LeftPosition = (screen.width) ? (screen.width-700)/2 : 0;;
	TopPosition = (screen.height) ? (screen.height-368)/2 : 0;;

	if(document.layers)
		settings = 'height=368,width=700,top='+TopPosition+',left='+LeftPosition+',scrollbars=no,resizable=yes,status=no'
	else
		settings = 'height=368,width=700,top='+TopPosition+',left='+LeftPosition+',scrollbars=no,resizable=no,status=no';

      if(id == "demo") {
		win = window.open('http://www.3da.com/virtualboardroomdemo/enter.php?accountid=1','virtualboardroom',settings);
	} else {
		win = window.open('http://www.3da.com/virtualboardroom/enter.php?accountid='+id,'virtualboardroom',settings);
	}
}

function launchQHD(customerlang, pageReferrer) {
     window.open('../popups/suzy.php','suzy','height=150,width=110,top=0,left=0,scrollbars=no,resizable=no,status=no').close();
      //before opening the virtual boardroom, close the Agent window

    if((browser == "Safari") && (OS == "Mac")) {
       width=507;
       height=300;
    }
    else if((browser == "Internet Explorer") && (OS == "Mac")) {
       width=537;
       height=312;
    }
    else {
       width=550;
       height=327;
    }

    //Coordinate Work
    x = (640 - width)/2, y = (480 - height)/2;

    if (screen) {
        y = (screen.availHeight - height)/2;
        x = (screen.availWidth - width)/2;
    }
    //END OF Coordinate Work
    var newurl = "http://142.46.205.131/qhd/accounts/coreqhd/quickhelpdesk.phtml";
    newurl += "?clang=" + customerlang + "&fromQueue=0" + "&sourcepage=" + pageReferrer + "&custID=" + "7";
    var NewWinName = customerlang + "ChatWindow";
    window.open(newurl,NewWinName,'width='+width+',height='+height+',screenX='+x+',screenY='+y+',top='+y+',left='+x);
}