function license(id) {
                if (top.frames[1]) {
                        top.frames[1].location.replace('/bin/Cklb?atct=' + id + '&fmt=index&pi=1');

                }
}
function checkIt(string)
{
        place = detect.indexOf(string) + 1;
        thestring = string;
        return place;
}

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('firefox')) browser = "Firefox"
else if (checkIt('opera')) browser = "Opera"
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";
}


var agt=navigator.userAgent
var yourOS="PC"
if (agt.indexOf("Mac")!=-1)
   {yourOS='Mac'}
var yourBrowse="IE"
if (navigator.appName == 'Netscape')
   {yourBrowse="NS"}
if (navigator.appVersion.substr(22,1) >= "5")
{ver5="Yes"}

if((yourOS=="Mac" && yourBrowse=="NS")||(yourOS=="Mac" && yourBrowse=="IE" && ver5 != "Yes")){
        document.write('<LINK rel="stylesheet" href="/css/mainMAC.css" type="text/css">')
}
else{
        document.write('<LINK rel="stylesheet" href="/css/main.css" type="text/css">')
}

function toplightboxrefresh() {
	if (parent == top){
		parent.frames[1].location = "/bin/Cklb?ref=/bin/Search?n~1^fmt~table";
	} else {
		 parent.location = "/bin/Cklb?ref=/bin/Search?n~1^fmt~table";
	}
}

function topcartrefresh() {
	if (parent == top){
		parent.frames[1].location = "/bin/Cklb?ref=/bin/Cart?op~view";
	} else {
		 parent.location = "/bin/Cklb?ref=/bin/Cart?op~view";
	}
}

function topsearchrefresh() {
	if (parent == top){
		parent.frames[1].location = "/bin/Cklb?ref=/user/search.shtml";
	} else { 
		parent.location = "/bin/Cklb?ref=/user/search.shtml";
	}
}

function topsearchrefreshpower() {
	if (parent == top){
		parent.frames[1].location = "/bin/Cklb?ref=/user/search_advanced.shtml";
	} else { 
		parent.location = "/bin/Cklb?ref=/user/search_advanced.shtml";
	}
}

function topsearchconcept() {
	if (parent == top){
		parent.frames[1].location = "/bin/Cklb?ref=/search_concept.shtml";
	} else { 
		parent.location = "/bin/Cklb?ref=/search_concept.shtml";
	}
}

function tload(dref)
{
	if(parent.thetop.href != dref){
		parent.thetop.location=dref;
	}
}

function siderefresh()
{
parent.left.location.replace('/bin/Search?n=1');

}

function csiderefresh(id)
{
	xcurrentdate = new Date();
  xcore = xcurrentdate.getSeconds();
  if (id){
  parent.left.location.replace('/bin/Cart?op=view&lc='+ id + '&random=' + xcore);
  }
  else {
  parent.left.location.replace('/bin/Cart?op=view' + '&random=' + xcore);
  }
}

function lccsiderefresh(id)
{
parent.left.location.replace('/bin/Cart?op=view&lc=1');
}


function VersionNavigateur(Netscape, Explorer) {
  if ((navigator.appVersion.substring(0,3) >= Netscape && navigator.appName == 'Netscape') ||      
      (navigator.appVersion.substring(0,3) >= Explorer && navigator.appName.substring(0,9) == 'Microsoft'))
    return true;
else return false;
}
function netie(net, ie) {
  if ((navigator.appVersion.substring(0,3) >= net && navigator.appName == 'Netscape' && net != -1) || (navigator.appVersion.substring(0,3) >= ie && navigator.appName.substring(0,9) == 'Microsoft' && ie != -1))
    return true;
else return false;
}

function cceditWindow()
{
  ccedit_window =
    window.open("https://argus.auroraquanta.com/bin/Profile?cc=1","ccedit","width=500,height=320,status=1");
}





// all new functions
function addlb(id) {
		if (parent.lb) {
			var theurl= '/bin/ExLbAdd?id=' + id ;
			parent.lb.location=theurl;
		} else {
			var theurl= '/bin/Cklb?atlb=' + id;
			self.location=theurl;
		}
}
function exaddlb(id) {
		if (parent.lb) {
			var theurl= '/bin/ExLbAdd?id=' + id;
			parent.lb.location=theurl;
		} else {
			var theurl= '/bin/Cklb?atlb=' + id;
			self.location=theurl;
		}
}
function addcart2(id) {
		if (parent.lb) {	
			parent.lb.location.replace('/bin/Cart?op=add&id=' + id + '&fmt=index');
			parent.com.location.replace('/user/cart_menu.shtml');

		} else {
			var theurl= '/bin/Cklb?atct=' + id;
			self.location=theurl;
		}
}

function orderproc() {
	var foo = new Date;
	var unixtime_ms = foo.getTime();
	var unixtime = parseInt(unixtime_ms / 1000);
	var minsecs = 60;
	var instamp = ggetCookie('OStamp');
	if (instamp){
		var diff = unixtime - instamp;
		if (diff <= minsecs){
			 var left = minsecs - diff;
			 return left;
		}
		else{
			gsetCookie('OStamp',unixtime);
			return;
		}
	}
	gsetCookie('OStamp',unixtime);
}

function setFMT(fmt){
	if ((fmt == "table") || (fmt == "list")){
		gsetCookie('fmt', fmt, 1000);
	}
return;
}

function getFMT(){
	var fmt = ggetCookie('fmt');
	alert(fmt);
}

function gsetCookie(name, value, expiredays, path, domain, secure) {
  var ExpireDate = new Date ();	
  ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
  var curCookie = name + "=" + escape(value) +
 		((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString()); 
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}


function ggetCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}


function gdeleteCookie(name, path, domain) {
  if (ggetCookie(name)) {
    document.cookie = name + "=" + 
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"
function gfixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}

function gGetQV(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("="); 
    if (pair[0] == variable) {    
      return pair[1];         
    }                
  }  
  return false;
}
 
function checkRef() {
 var portal = getQV('portal');
 if (portal){
 var portalcookie = getCookie('portal');
  if (portalcookie != portal){
    setCookie('portal',portal,'','/');
  }
 } 
}



function gsetCookie2(name2,value2) {
	gsetCookie(name2, value2, '', '/', gGetCookieDom());
}

function gGetCookieDom(){
var thisdomain = document.domain;
var domainparts = thisdomain.split(".");
var end = domainparts.length - 1;
var start = domainparts.length - 2;
var domainend = domainparts[end];
var domainstart = domainparts[start];
var setdom = "." + domainstart + "." + domainend;
return setdom;
}

function gSetBackpage() {   
var thispage = location.href;
gsetCookie('backpage', thispage, '', '/', gGetCookieDom());
}








function editReject(edit,id) {
var edname = "Advertising";
if (edit == 'ne'){ edname = "All Sites"; conf = 'Remove ' + id + ' from ' + edname + '? This change is permanent.'; }
if (edit == 'ed'){ edname = "Editorial"; }
var conf = 'Remove ' + id + ' from ' + edname + '?';


if (edit == 'ne'){ conf = 'Remove ' + id + ' from ' + edname + '? This change is permanent.'; }
	if (confirm(conf)){
	var loadurl = '/bin/ShareControl?rem=' + id + '&edit=' + edit;

	window.open(loadurl,'Win','resizable=no,scrollbars=no,menubar=no,status=no,width=200,height=100');
	}
}
function relatedkeywords (qq){
        self.location.href='/bin/Search2?frmloc=detailjs&Keywords=' + qq;
}

