function yg_Browser(){
 d=document;
 this.agt=navigator.userAgent.toLowerCase();
 this.major=parseInt(navigator.appVersion);
 this.dom=(d.getElementById);
 this.ns=(d.layers);
 this.ns4up=(this.ns && this.major>=4);
 this.ns6=(this.dom&&navigator.appName=="Netscape");
 this.op=(window.opera);
 if(d.all)this.ie=1;else this.ie=0;
 this.ie4=(d.all&&!this.dom);
 this.ie4up=(this.ie&&this.major>=4);
 this.ie5=(d.all&&this.dom);
 this.ie6=(d.nodeType);
 this.sf=(this.agt.indexOf("safari")!=-1);
 this.win=((this.agt.indexOf("win")!=-1)||(this.agt.indexOf("16bit")!=-1));
 this.winme=(this.agt.indexOf("win 9x 4.90")!=-1);
 this.xpsp2=(this.agt.indexOf("sv1")!=-1);
 this.mac=(this.agt.indexOf("mac")!=-1);
}
var oBw=new yg_Browser();

function yg_getObj(id,d) {
  var i,x;  if(!d) d=document; 
  if(!(x=d[id])&&d.all) x=d.all[id]; 
  for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][id];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=yg_getObj(id,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(id); 
  return x;
}

function yg_getH(o) { return (oBw.ns)?((o.height)?o.height:o.clip.height):((oBw.op&&typeof o.style.pixelHeight!='undefined')?o.style.pixelHeight:o.offsetHeight); }
function yg_setH(o,h) { if(o.clip) o.clip.height=h; else if(oBw.op && typeof o.style.pixelHeight != 'undefined') o.style.pixelHeight=h; else o.style.height=h; }
function yg_getW(o) { return (oBw.ns)?((o.width)?o.width:o.clip.width):((oBw.op&&typeof o.style.pixelWidth!='undefined')?w=o.style.pixelWidth:o.offsetWidth); }
function yg_setW(o,w) { if(o.clip) o.clip.width=w; else if(oBw.op && typeof o.style.pixelWidth != 'undefined') o.style.pixelWidth=w; else o.style.width=w; }
function yg_getX(o) { return (oBw.ns)?o.left:((o.style.pixelLeft)?o.style.pixelLeft:o.offsetLeft); }
function ylib_setX(o,x) {
	if (oBw.ns) { 
		o.left=x;
	} else if (typeof o.style.pixelLeft != 'undefined') {
		o.style.pixelLeft=x;
	} else {
		thisPos = parseInt(x);
		thisPos += "px";
		o.style.left = thisPos;
	}
}

function yg_getY(o) { return (oBw.ns)?o.top:((o.style.pixelTop)?o.style.pixelTop:o.offsetTop); }
function ylib_setY(o,y) {
	if (oBw.ns) {
		o.top=y;
	} else if (typeof o.style.pixelTop != 'undefined') {
		o.style.pixelTop=y;
	} else {
		thisPos = parseInt(y);
		thisPos += "px";
		o.style.top = thisPos;
	}
}

function yg_getPageX(o) { var x=0; if(oBw.ns) x=o.pageX; else { while(eval(o)) { x+=o.offsetLeft; o=o.offsetParent; } } return x; }
function yg_getPageY(o) { var y=0; if(oBw.ns) y=o.pageY; else { while(eval(o)) { y+=o.offsetTop; o=o.offsetParent; } } return y; }
function yg_getZ(o) { return (oBw.ns)?o.zIndex:o.style.zIndex; }

function yg_moveTo(o,x,y) { yg_setX(o,x);yg_setY(o,y); }
function yg_moveBy(o,x,y) { yg_setX(o,yg_getPageX(o)+x);yg_setY(o,yg_getPageY(o)+y); }

function yg_setZ(o,z) { if(oBw.ns)o.zIndex=z;else o.style.zIndex=z; }

function yg_setClip(o) { }

function yg_show(o,disp) { 
 (oBw.ns)? '':(!disp)? o.style.display="inline":o.style.display=disp;
 (oBw.ns)? o.visibility='show':o.style.visibility='visible';  
}
function yg_hide(o,disp) { 
 (oBw.ns)? '':(arguments.length!=2)? o.style.display="none":o.style.display=disp;
 (oBw.ns)? o.visibility='hide':o.style.visibility='hidden';  
}

function yg_setStyle(o,s,v) { if(oBw.ie5||oBw.dom) eval("o.style."+s+" = '" + v +"'"); }
function yg_getStyle(o,s) { if(oBw.ie5||oBw.dom) return eval("o.style."+s); }

function yg_getDocW() { }
function yg_getDocH() { }

function yg_addEvt(o,e,f,c){ if(o.addEventListener)o.addEventListener(e,f,c);else if(o.attachEvent)o.attachEvent("on"+e,f);else eval("o.on"+e+"="+f)}

function yg_writeHTML(o,h) { 
 if(oBw.ns){var doc=o.document;doc.write(h);doc.close();return false;}
 if(o.innerHTML)o.innerHTML=h; 
}

function yg_insertHTML(o,h,w) {
 if (oBw.op) return;
 if (o.insertAdjacentHTML) { 
  o.insertAdjacentHTML(w,h);
  return;
 }
 if (oBw.ns) {
  yg_writeHTML(o,h);
  return;
 }

 var r = o.ownerDocument.createRange();
	r.setStartBefore(o);
	var frag = r.createContextualFragment(h);
	yg_insertObj(o,w,frag)
}


function yg_insertObj(o,w,node) {
	switch (w){
	case 'beforeBegin':
		o.parentNode.insertBefore(node,o)
		break;
	case 'afterBegin':
		o.insertBefore(node,o.firstChild);
		break;
	case 'beforeEnd':
		o.appendChild(node);
		break;
	case 'afterEnd':
		if (o.nextSibling){
			o.parentNode.insertBefore(node,o.nextSibling);
		} else {
			o.parentNode.appendChild(node)
		}
		break;
	}
}

var ie4 = (document.all) ? true : false;
var ns4 = (document.layers) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;
function hidelayer(lay) {
if (ie4) {document.all[lay].style.visibility = "hidden";}
if (ns4) {document.layers[lay].visibility = "hide";}
if (ns6) {document.getElementById([lay]).style.display = "none";}
}
	
function showlayer(lay) {
if (ie4) {document.all[lay].style.visibility = "visible";}
if (ns4) {document.layers[lay].visibility = "show";}
if (ns6) {document.getElementById([lay]).style.display = "block";}
}

function closeiframe(){
parent.document.getElementById("masterdiv").style.display="none"
}


function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Please enter your correct email address.")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Please enter your correct email address.")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Please enter your correct email address.")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Please enter your correct email address.")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Please enter your correct email address.")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Please enter your correct email address.")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Please enter your correct email address.")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.contactForm.txtFrom
	var nameID=document.contactForm.txtSubject
	var mesID=document.contactForm.txtMessage
	var nr=document.contactForm.txtCode

		nameID.style.backgroundColor = "";
		emailID.style.backgroundColor = "";
		mesID.style.backgroundColor = "";

	if ((emailID.value==null)||(emailID.value=="")){
		emailID.style.backgroundColor = "#FF00FF";
		alert("Please enter your email address.")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.style.backgroundColor = "#FF00FF";
		emailID.focus()
		return false
	}
	if ((nameID.value==null)||(nameID.value=="")){
		nameID.style.backgroundColor = "#FF00FF";
		alert("Please enter a subject.")
		nameID.focus()
		return false
	}
	if ((mesID.value==null)||(mesID.value=="")){
		mesID.style.backgroundColor = "#FF00FF";
		alert("Please enter a message.")
		mesID.focus()
		return false
	}
	if ((parseInt(nr.value) != nr.value) || nr.value.length != 8) { 
		alert("Please enter the verification code.")
		nr.focus()
		return false; 
	}
	return true
 }


function showhide(id,id2){
if (document.getElementById){
obj = document.getElementById(id);
if (obj.style.display == "none"){
obj.style.display = "";
obj2 = document.getElementById(id2).src='img/hide.gif';
} else {
obj.style.display = "none";
obj2 = document.getElementById(id2).src='img/show.gif';
}
}
}



var uAgent = navigator.userAgent.toLowerCase(); 
var is_ie = (uAgent.indexOf("msie") != -1); 
var is_mac = (uAgent.indexOf("mac")!=-1);
var is_windows = (uAgent.indexOf("win")!=-1);

function setArticleTextSize(size)
{
var fontSz1, lineHt, spans;
switch(size){
case 1:
fontSz1 = 11;
fontSz2 = 10;
break;
case 2:
fontSz1 = 14;
fontSz2 = 13;
break;
case 3:
fontSz1 = 16;
fontSz2 = 15;
break;
}
spans = document.getElementsByTagName('span');
for(i=0;i<spans.length;i++)
if(spans[i].className=='headline')
{
spans[i].style.fontSize = fontSz1 + 'px';
}
else if(spans[i].className=='maintext')
{
spans[i].style.fontSize = fontSz2 + 'px';
}
}