
//var article_fontSize = parseInt(getCookie("article_fontSizePx")); 	

function getCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}

/*
function fontPlus() {		        
	if (article_fontSize < 7) {
		article_fontSize = article_fontSize + 1; 
		setFont(article_fontSize); 
	}
}
function fontMinus() {
	if (article_fontSize > 1) {
		article_fontSize = article_fontSize - 1; 
		setFont(article_fontSize); 
	}
} 
*/
function fontDefault() {
	setFont(4); 
}
function fontPlus() {
	setFont(5); 
}
function fontPlusPlus() {
	setFont(6); 
}


function setFont(article_fontSize) { 		
	
	document.getElementById("articleBody").className = "article0"+article_fontSize;
	//document.getElementById("articleBody").style.fontSize = article_fontSize+"pt";
	setFontCookie(article_fontSize);
}	

function setFontCookie(article_fontSize) {

	var expiry = new Date();
	var path = "/";
	var domain = ".midashelp.com";
	var secure = "";

	expiry.setTime(expiry.getTime() + 90 * (24 * 60 * 60 * 1000));

	setCookie("article_fontSizePx",article_fontSize,expiry,path,domain,secure);
}	

function setCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}


function initFont() { 
	if (isNaN(article_fontSize) == true) {
		article_fontSize = 4;	
	}
	
	setFont(article_fontSize);
}

// email check
function email_chk(tempf)
{
	var t = tempf
	var ValidFlag = false
	var atCount = 0
	var SpecialFlag
	var atLoop
	var atChr
	var BadFlag
	var tAry1
	var UserName
	var DomainName

	if ( t.length > 0 && t.indexOf("@") > 0 && t.indexOf(".") > 0 ) {
		atCount = 0
		SpecialFlag = false

		for( atLoop=1; atLoop<=t.length; atLoop++ ) {
			atChr = t.substring( atLoop, atLoop+1 )
			if ( atChr == "@" ) atCount = atCount + 1

			if ( (atChr >= 32) && (atChr <= 44) ) SpecialFlag = true 
			if ( (atChr == 47) || (atChr == 96) || (atChr >= 123) ) SpecialFlag = true 
			if ( (atChr >= 58) && (atChr <= 63) ) SpecialFlag = true 
			if ( (atChr >= 91) && (atChr <= 94) ) SpecialFlag = true 
		}

		if ( ( atCount == 1 ) && (SpecialFlag == false ) ) {
			BadFlag = false
			tAry1 = t.split("@")
			UserName = tAry1[0]
			DomainName = tAry1[1]
			if ( (UserName.length <= 0 ) || (DomainName.length <= 0 ) ) BadFlag = true
			if ( DomainName.substring( 1, 2 ) == "." ) BadFlag = true
			if ( DomainName.substring( DomainName.length-1, DomainName.length) == "." ) BadFlag = true
			ValidFlag = true
		}
	}
	if ( BadFlag == true ) ValidFlag = false
	return ValidFlag
}

// top search bar
function CkSearch()
{
	var f = document.topForm
	/*
	if (f.hSEARCH_TEXT.value=='')
	{
		alert("Input Text.");
		f.hSEARCH_TEXT.focus();
		return false;
	}
	*/
	return true;
}



function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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 MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//movie
function fGoPlayer(argFILE_NAME, argFILE_PATH)
{
	var win = window.open('/english/pr/adver_popup_movie.asp?hFILE_NAME='+argFILE_NAME+'&hFILE_PATH='+argFILE_PATH, 'business', 'width=823, height=640, scrollbars=no, menubar=no');
	win.focus();		
}

/* movie player*/
function fChange2(data)
{
	document.frmFORM.mediaPlayer2.FileName=data;
}

function fStop2()
{
	document.frmFORM.mediaPlayer2.Stop();
	//document.frmFORM.mediaPlayer.src = 'images/default_movie.gif';
}
function fPause2()
{
	document.frmFORM.mediaPlayer2.Pause();
}
function fPlay2()
{
	document.frmFORM.mediaPlayer2.Play();
}


function LayerOpen()
{
	//alert("Layer Open")
	//alert(document.all.TopLayer.style.visibility="visible")
	//alert(document.all.TopLayer.style.height)
	//	document.all.TopLayer.style.height = "10px"
	//alert(document.all.TopLayer.style.height)	//document.all.TopLayer.style.visibility="visible"
	document.all.main_top_flash.height = 210
}
function LayerClose()
{
	document.all.main_top_flash.height = 99
}

function fGoCommingsoon()
{
	alert("comming soon.")
	return;
}
