
dom = (document.getElementById) ? true : false;

function antispam(domain, user, display, linkclass) {
	if (!display) display = user + '@' + domain;
	if (!linkclass) linkclass = 'link';
	document.write('<a href="mailto:' + user + '@' + domain + '" class="' + linkclass + '">' + display + '</a>');
}

function download(link) {
	var today = new Date()
	var ms = Math.floor(today.valueOf() / 1000);
	link += '?ct=' + ms;
	window.open(link, 'download_window', 'toolbar=0,location=no,directories=0,status=0,scrollbars=0,resizeable=0,width=1,height=1,top=0,left=0');
	if (navigator.appVersion.indexOf('MSIE') != -1) {
		window.focus();
	}
}

function download_noplugin(link) {
	if (!hasplugin) {
		download(link);
	}
}

function disableSelect() {
	var element = document.getElementById('content_disable');
	element.onselectstart = function () { alert('Sorry, text highlighting is disabled for this report.'); return false; } // ie
	element.onmousedown = function () { return false; } // Mozilla
}

function showscan(){
	var m1 = MM_findObj('viewscan');
	var m2 = MM_findObj('hidescan');
	if (m1) {m1.style.display = 'none'; m2.style.display='inline';}
} 

function hidescan() {
	var m1 = MM_findObj('hidescan');
	var m2 = MM_findObj('viewscan');
	if (m1) {m1.style.display = 'none'; m2.style.display='inline';}
}

function setCookie(c_name,value,expiredays){
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name + '=' +escape(value) + ((expiredays==null) ? '' : ';expires=' + exdate.toGMTString());
}

function getCookie(c_name){
	if (document.cookie.length>0){
		c_start=document.cookie.indexOf(c_name + '=');
		if (c_start!=-1){
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(';',c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return '';
}

function toggleLayer( whichLayer )
{
	var elem, vis;
	if( document.getElementById ) // this is the way the standards work
		elem = document.getElementById( whichLayer );
	else if( document.all ) // this is the way old msie versions work
		elem = document.all[whichLayer];
	else if( document.layers ) // this is the way nn4 works, but who cares about Netscape Navigator 4?
		elem = document.layers[whichLayer];
	vis = elem.style;
	// if the style.display value is blank we try to figure it out here
	if( vis.display == '' && elem.offsetWidth != undefined && elem.offsetHeight != undefined ){
		if( elem.offsetWidth != 0 && elem.offsetHeight != 0 ){
			vis.display = 'block';
			showscan();
		}else{
			vis.display = 'none';
			hidescan();
		}
	}
	if( vis.display == '' || vis.display == 'block' ){
		vis.display = 'none';
		hidescan();
	}else{
		vis.display = 'block';
		showscan();
	}	
}

function showFeedback_b(){
  if (dom) {document.getElementById("classic_box").style.visibility='visible';}

} 
function hideFeedback_b() {
  if (dom) {document.getElementById("classic_box").style.visibility='hidden';}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function addLoadEvent(func) {
	var oldOnload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldOnload();
			func();
		}
	}
}

function _click(spanid) {
	var d, m, sel;

	current_tab.className = 'tab2 deselect';
	m = MM_findObj('detail' + current_tab.id);
	m.className = 'detail0';
	
	current_tab = MM_findObj(spanid);
	current_tab.className = 'tab2 selected';
	m = MM_findObj('detail' + spanid);
	m.className = 'detail1';
	return false;
}

function generateFlash() {
  	
  	if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) { 
  	    var plugin = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin; 

  	    if (plugin && parseInt(plugin.description.substring(plugin.description.indexOf(".")-1))>=3) 
 	        UseFlash = 1; 
  	} //&& (navigator.userAgent.indexOf("MSIE") != -1 )|| navigator.userAgent.indexOf("Firefox") != -1
 
  	if (UseFlash) { 
  	    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ' +
		'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" '+
		'width="140" height="80" id="driver_scroll" align="middle" class="flashobject">' + 
		' <param name="movie" value="/img/driver_scroll2.swf" />'+
		' <param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />'+
		' <embed src="/img/driver_scroll2.swf" quality="high" bgcolor="#EEF8E0" width="140" height="80" '+ 
		' name="driver_scroll" align="middle" allowScriptAccess="sameDomain" '+
		' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
		'</object>');
  	} 
}

function compare_version(current, desired) {
	var vc, vd;
	var c = current.split('.');
	var d = desired.split('.');
	for(var i = 0; i < c.length; i++) {
		vc = parseInt(c[i]);
		vd = parseInt(d[i]);
		if (vc != vd) {
			return (vc < vd) ? -1 : 1;
		}
	}
	return 0;		// versions are the same
}

function generateDriverAgent(path, version) {

	document.write('<object name="agent" id="agent" codebase="' + path + '/driveragent.cab#version=' + version + 
		'" classid="clsid:E8F628B5-259A-4734-97EE-BA914D7BE941" width="5" height="5" hspace="0" vspace="0" viewastext>' +
		'</object>.');
}

function locatetext(id) {
	for(var i = 0;i < data.length;i+=2) {
		if (id ==data[i]) return data[i + 1];
	}
	return '';
}

function toggle(id) {
	var h = MM_findObj('h' + id);
	var t = MM_findObj('t' + id);
	h.className = (h.className == 'support_faq_link') ? 'support_faq_link1' : 'support_faq_link';
	
	if (h.className == 'support_faq_link1') {
		t.style.display = 'block';
	} else {
		t.style.display = 'none';
	}
}

function toggle_r(sel){
	var choice = sel.options[sel.selectedIndex].value;
	
	if(choice != 0)
		document.getElementById(choice).style.display = "block";
	else{
		document.getElementById('man').style.display = "none";
		document.getElementById('cat').style.display = "none";
	}
	if(choice != 'cat')
		document.getElementById('cat').style.display = "none";
	if(choice != 'man')
		document.getElementById('man').style.display = "none";
}

function checkpost(formname){
	if(formname.display.checked==true){
		postval = true;
	}else{
		hideUpdate();
		postval = false;
	}
}

function showregister(){
	document.getElementById("notification_landing_pop").style.display='block';
	movediv();
}
var move_y = 5; //Starting Location - top
var dest_y = 235;  //Ending Location - top
var interval = 15;

function movediv() {
	//Keep on moving the image till the target is achieved
	if(move_y<dest_y) move_y += interval;
	document.getElementById("notification_landing_pop").style.top= move_y + 'px';
	if ((move_y + interval < dest_y)) {
		window.setTimeout('movediv()',80);
	}
}

function hidediv() {
	document.getElementById("notification_landing_pop").style.display='none';
}

function hideUpdate(){
  if (dom) {
	document.getElementById("notification_update_pop").style.display='none';
	document.getElementById("notification_landing_pop_back").style.display='none';
	document.body.style.overflow='scroll';
  }

} 

function noexitpop(){
	SHOULDPOP = false;
}

quotes = new Array();
UseFlash=0

if (navigator.plugins) {
	for(i=0;i<navigator.mimeTypes.length;i++){
		var name = navigator.mimeTypes[i].type;
		var n = name.indexOf(";"); 
		if (n > -1) {		// we have some version info
			var mimetype = name.substring(0, n);
			if (mimetype == 'application/x-driveragent') {
				hasplugin = 1;
				break;
			}
		}
	}
}
