//abscpa
//Language Switch
//Screen Size
//Dreamweaver Function
//Currency Exchange
//Common Function
//CSS class Miodify
//Cookies Controal
//FAQ Menu On/Off

var xmlHttp,xmlHttp2;
var msgIAE = "";
var sorns = "";

function js_include()
{
	if( document.domain == "abscpa.com" )	location.href = document.URL.replace(document.domain,"www.abscpa.com");
}

function onPageLoadFinish()
{
	//welcomeMSG();
	//document.getElementById('onload_test').innerHTML = sorns;
	//alert("Welcome to abscpa.com !");
	
	if( site_notice_show() )	fullScreenBackground();

	if( document.URL.match("chinese") )
		import_enquiry_box_c();
	else
		import_enquiry_box();

	if( document.URL.match(/direct_mail/gi) )
		subject_check();
}

function onPageResize()
{
	if( site_notice_show() )	fullScreenBackground();
}

function pic_over(obj,str)
{
	obj.src = str;
}

function pic_out(obj,str)
{
	obj.src = str;
}

//---------------------------------------------------------------------------------------------------------------------------------------------
//Language Switch

function lang_change(nowIS,changeTO)
{
	var str_url=document.URL;

	if( str_url.match("/chinese_index.htm") )
		str_url=str_url.replace("/chinese_index.htm","/index.htm");
	else if( str_url.match("/index.htm") )
		str_url=str_url.replace("/index.htm","/chinese_index.htm");
	else if( str_url == "http://www.abscpa.com/" )
		str_url="http://www.abscpa.com/chinese_index.htm";
	else
	{
		while(str_url.match(nowIS))
			str_url=str_url.replace(nowIS,changeTO);
	}

	if( str_url.charAt(str_url.length-1) == "#" )
		str_url = str_url.replace("#","");
	
	location.href=str_url;
}

//---------------------------------------------------------------------------------------------------------------------------------------------
//Screen Size

var page_innerHeight;
var page_innerWidth;

function fullScreenBackground()
{
	var x,y;
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	page_innerWidth  = x;
	page_innerHeight = y;
	
	var tempSiteNotice = css_class_selector("#site_notice");
	var tempSiteNotice_Bg = css_class_selector("#site_notice_bg");
	var tempSiteNotice_Partition = css_class_selector("#site_notice_partition");
	//alert(tempPointer.style.display);
	//tempSiteNotice.style.display = "";
	
	if( navigator.userAgent.toLowerCase().indexOf('msie 6') > 0 || navigator.userAgent.toLowerCase().indexOf('msie 5.5') > 0 )
	{
		tempSiteNotice.style.height   = y+"px";
		tempSiteNotice.style.width    = x+"px";
		
		site_notice_message();

		tempSiteNotice.style.display  = "";
		
		//--------------------------------------------------------------------------------------
		
		if(false)
		{
			document.getElementById('site_notice').style.height   = y+"px";
			document.getElementById('site_notice').style.width    = x+"px";
			//document.getElementById('site_notice').style.position = "fixed";
			
			document.getElementById('site_notice_bg').style.height   = y+"px";
			document.getElementById('site_notice_bg').style.width    = x+"px";
			document.getElementById('site_notice_bg').style.backgroungImage = "none";
			document.getElementById('site_notice_bg').style.backgroungColor = "#FFFFFF";
			document.getElementById('site_notice_bg').className = "siteNotice";
			
			site_notice_message();
			
			document.getElementById('site_notice_partition').style.width      = (x/2)+"px";
			document.getElementById('site_notice_partition').style.left       = "50%";
			document.getElementById('site_notice_partition').style.marginLeft = "-"+(x/4)+"px";
			document.getElementById('site_notice_partition').style.top        = "50%";
	
			document.getElementById('site_notice').style.display  = "";
			document.getElementById('site_notice_partition').style.marginTop  = "-" + Math.abs(document.getElementById('site_notice_partition').offsetHeight)/2 + "px";
		}
	}
	else
	{
		site_notice_message();
		tempSiteNotice.style.display  = "";
		
		//--------------------------------------------------------------------------
		
		if(false)
		{
			document.getElementById('site_notice').style.height   = y+"px";
			document.getElementById('site_notice').style.width    = x+"px";
			document.getElementById('site_notice').style.position = "fixed";
			
			document.getElementById('site_notice_bg').style.height   = y+"px";
			document.getElementById('site_notice_bg').style.width    = x+"px";
			
			site_notice_message();
			
			document.getElementById('site_notice_partition').style.width      = (x/2)+"px";
			document.getElementById('site_notice_partition').style.left       = "50%";
			document.getElementById('site_notice_partition').style.marginLeft = "-" + (x/4) + "px";
			document.getElementById('site_notice_partition').style.top        = "50%";
			
			document.getElementById('site_notice').style.display  = "";
			document.getElementById('site_notice_partition').style.marginTop  = "-" + Math.abs(document.getElementById('site_notice_partition').offsetHeight)/2 + "px";
		}
	}
	
}

function getFullScreenSize()
{
	var x,y;
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	page_innerWidth  = x;
	page_innerHeight = y;
}

//---------------------------------------------------------------------------------------------------------------------------------------------
//Dreamweaver Function

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_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_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];}
}

//---------------------------------------------------------------------------------------------------------------------------------------------
//Currency Exchange

function currency_exchanger(self,rate,handling,target_1,target_2)
{
	self.alt=self.value.replace(/[,]/i,'');
	
	if( self.alt != '' && Math.abs(self.alt) > 0 )
	{
		if( document.getElementById(target_1) )
			document.getElementById(target_1).innerHTML = (Math.abs(self.alt)*(handling)).toFixed(1);
		if( document.getElementById(target_2) )
			document.getElementById(target_2).innerHTML = ((Math.abs(self.alt)*(handling)*Math.abs(rate)/100).toFixed(1));
	}
	else
	{
		if( document.getElementById(target_1) )
			document.getElementById(target_1).innerHTML = '';
		if( document.getElementById(target_2) )
			document.getElementById(target_2).innerHTML = '';
	}
}

//---------------------------------------------------------------------------------------------------------------------------------------------
//Common Function

function hide_sub_list(doc_obj)
{
	document.getElementById(doc_obj).style.display = 'none';
	//document.getElementById(doc_obj).style.position = 'relative';
}

function show_sub_list(doc_obj)
{
	document.getElementById(doc_obj).style.display = 'block';
	//alert(document.getElementById(doc_obj).offsetLeft);
	//document.getElementById(doc_obj).style.position = 'absolute';
}

function site_notice_show()
{
	show_or_not_show();
	get_notice_content();
	
	if( sorns == "Y" )
		return true;
	else
		return false;
}

function site_notice_message()
{
	document.getElementById('site_notice_content').innerHTML  = msgIAE;
}

function GetXmlHttpObject()
{ 
	var objXMLHttp=null;
	if (window.XMLHttpRequest) objXMLHttp=new XMLHttpRequest();
	else if (window.ActiveXObject)		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	return objXMLHttp;
}

function show_or_not_show()
{ 
	xmlHttp=GetXmlHttpObject();
	if( xmlHttp == null )
	{
		alert("Browser does not support HTTP Request");
		return;
	}
		
	var url="http://www.abscpa.com/IAE/check_show.php";
	
	if( navigator.userAgent.toLowerCase().match('msie') )
	{
		xmlHttp.onreadystatechange=show_YN;
		xmlHttp.open("GET",url,false);
		xmlHttp.send(null);
	}
	else
	{
		xmlHttp.onload = show_YN;
		xmlHttp.open("GET",url,false);
		xmlHttp.send(null);
	}
}

function show_YN() 
{ 
	if( xmlHttp.readyState == 4 || xmlHttp.readyState == "complete" )
	{
		var xmlDoc = xmlHttp.responseText;
		
		if( xmlDoc.match("Y") == "Y" )
			sorns = "Y";
		else
			sorns = "N";
	}
}

function get_notice_content()
{ 
	xmlHttp2 = GetXmlHttpObject();
	if( xmlHttp2 == null )
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	
	var url="http://www.abscpa.com/IAE/notification.php";
	
	if( navigator.userAgent.toLowerCase().match('msie') )
	{
		xmlHttp2.onreadystatechange = get_notice_content_exe;
		xmlHttp2.open("GET",url,false);
		xmlHttp2.send(null);
	}
	else
	{
		xmlHttp2.onload = get_notice_content_exe;
		xmlHttp2.open("GET",url,false);
		xmlHttp2.send(null);
	}
}

function get_notice_content_exe() 
{ 
	if( xmlHttp2.readyState == 4 || xmlHttp2.readyState == "complete" )
	{
		var xmlDoc = xmlHttp2.responseText;
		msgIAE = xmlDoc;
	}
}

//---------------------------------------------------------------------------------------------------------------------------------------------
//Refer Mail

function newWin(str)
{
	window.open(str);
}

function subWin(str1,str2,str3)
{
	window.open(str1,'test','width='+str2+',height='+str3+',scrollbars=no');
}

function isEmpty(str)
{
	return (str == null) || (str.length == 0);
}

function isEmail(str)
{
	if(isEmpty(str))
		return false;
	var re = /^[^\s()<>@,;:\/]+@\w[\w\.-]+\.[a-z]{2,}$/i;
	return re.test(str);
}

function enquiry_box_check()
{
	if( document.URL.match("english") )
	{
		switch(true)
		{
			case( document.getElementById('refer_to').value == "" ):
				alert("- Unknow Receiver -");
				break;
			case( document.getElementById('refer_sender_name').value == "" ):
				alert("- Please enter you name -");
				break;
			case( isEmail(document.getElementById('refer_sender_email').value) == false ):
				alert("- I'm sorry! You email is not correct. -");
				break;
			case( document.getElementById('refer_message').value == "" ):
				alert("- I'm sorry! Message Box is empty. -");
				break;
			default:
				refer_enquiry_send();
		}
	}
	else if( document.URL.match("chinese") )
	{
		switch(true)
		{
			case( document.getElementById('refer_to').value == "" ):
				alert("- 收件人错误 -");
				break;
			case( document.getElementById('refer_sender_name').value == "" ):
				alert("- 请输入您的名字 -");
				break;
			case( isEmail(document.getElementById('refer_sender_email').value) == false ):
				alert("- 对不起! 您输入的电邮地址是不正确的. -");
				break;
			case( document.getElementById('refer_message').value == "" ):
				alert("- 对不起! 讯息内容是空白的. -");
				break;
			default:
				refer_enquiry_send();
		}
	}
}

var xmlHttp_refer_enquiry;
function refer_enquiry_send()
{
	xmlHttp_refer_enquiry = GetXmlHttpObject();
	
	if( xmlHttp_refer_enquiry == null )
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	
	var url="http://www.abscpa.com/css/refer_mail_notice.php";
	var message_content = "";
	message_content = message_content +  "_a=" + encodeURIComponent(document.getElementById('refer_to').value);
	message_content = message_content + "&_b=" + encodeURIComponent(document.getElementById('refer_sender_name').value);
	message_content = message_content + "&_c=" + encodeURIComponent(document.getElementById('refer_sender_email').value);
	message_content = message_content + "&_d=" + encodeURIComponent(document.getElementById('refer_subject').value);
	message_content = message_content + "&_e=" + encodeURIComponent(document.getElementById('refer_message').value);
	
	if( document.URL.match("english") )
	{
		if( document.getElementById('refer_title_mr').checked == true )
			message_content = message_content + "&_f=Mr";
		else if( document.getElementById('refer_title_ms').checked == true )
			message_content = message_content + "&_f=Ms";
		else
			message_content = message_content + "&_f=";
	}
	else if( document.URL.match("chinese") )
	{
		if( document.getElementById('refer_title_mr').checked == true )
			message_content = message_content + "&_f=先生";
		else if( document.getElementById('refer_title_ms').checked == true )
			message_content = message_content + "&_f=女士";
		else
			message_content = message_content + "&_f=";
	}

	//if( document.getElementById('refer_cc2sender').checked == true )
		//message_content = message_content + "&_g=on";
	//else
		//message_content = message_content + "&_g=off";
	message_content = message_content + "&_g=off";
 
	xmlHttp_refer_enquiry.onreadystatechange = refer_enquiry_send_exe;
	xmlHttp_refer_enquiry.open("POST",url,true);
	xmlHttp_refer_enquiry.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp_refer_enquiry.setRequestHeader("Content-length", message_content.length);
	xmlHttp_refer_enquiry.setRequestHeader("Connection", "close");
	xmlHttp_refer_enquiry.send(message_content);
}

function refer_enquiry_send_exe()
{
	if( xmlHttp_refer_enquiry.readyState == 4 || xmlHttp_refer_enquiry.readyState == "complete" )
	{
		xmlDoc = xmlHttp_refer_enquiry.responseText;
		xmlHttp_refer_enquiry = null;
		
		if( xmlDoc.match("- Success -") )
		{
			if( document.URL.match("english") )
				alert("Enquiry send success. Thank You.");
			else if( document.URL.match("chinese") )
				alert("讯息成功发送.");
			
			document.getElementById('enquiry_box').style.display = "none";
			refer_box_partly_clear();
		}
		else
		{
			if( document.URL.match("english") )
				alert("Enquiry send failed. Please try again.");
			else if( document.URL.match("chinese") )
				alert("讯息发送失败. 请再试一次.");
		}
	}
}

function show_refer_mail(top,left,mail_to,receiver)
{//show_refer_mail(this.offsetParent.offsetTop + this.offsetTop,this.offsetParent.offsetLeft + this.offsetLeft,'Gary@AsiaBS.com')
	//alert(top + "," + left);
	
	var ie4 = document.all?1:0 ;
	
	getFullScreenSize();
	
	document.getElementById('refer_to').value = mail_to;
	document.getElementById('receiver_name').innerHTML = "<b>"+receiver+"</b>";
	document.getElementById('enquiry_box').style.display = "";
	
	if( (document.getElementById('enquiry_box').offsetWidth + left ) > page_innerWidth )
		left = page_innerWidth - document.getElementById('enquiry_box').offsetWidth;
	
	if( ie4 )
	{
		document.getElementById('enquiry_box').style.top = (Math.abs(top) + 30);
		document.getElementById('enquiry_box').style.left = (Math.abs(left) + 10);
	}
	else
	{
		document.getElementById('enquiry_box').style.top = (Math.abs(top) + 30)+"px";
		document.getElementById('enquiry_box').style.left = (Math.abs(left) + 10)+"px";
	}
}

function refer_box_reset()
{
		document.getElementById('refer_sender_name').value = "";
		document.getElementById('refer_sender_email').value = "";
		document.getElementById('refer_subject').value = "";
		document.getElementById('refer_message').value = "";
		document.getElementById('refer_cc2sender').checked = false;
		document.getElementById('refer_title_mr').checked = false;
		document.getElementById('refer_title_ms').checked = false;
}

function refer_box_partly_clear()
{
		document.getElementById('refer_subject').value = "";
		document.getElementById('refer_message').value = "";
}

function import_enquiry_box()
{
	var temp = "";
	
	temp += "<div id=\"enquiry_box\" style=\"position:absolute;border:4px solid #666666;padding:2px;background-color:#FFFFFF;display:none;z-index:100\">";
	temp += "	<div style=\"border:2px solid #666666;padding:10px\">";
	temp += "		<table>";
	temp += "			<tr>";
	temp += "				<td colspan=\"2\" style=\"padding-bottom:2px\">";
	temp += "					<span style=\"font-family:Verdana;font-size:10pt;cursor:pointer;float:right\" onClick=\"document.getElementById('enquiry_box').style.display='none'\"><img alt=\"Close\" src=\"http://www.abacushkcpa.com/images/gif/close.gif\"></span>";
	temp += "					<b>Enquiry To</b> : <span id=\"receiver_name\"></span>";
	temp += "				</td>";
	temp += "			</tr>";
	temp += "			<tr>";
	temp += "				<td colspan=\"2\" style=\"padding-bottom:10px\">";
	temp += "					<b>Email</b> : <input id=\"refer_to\" size=\"30\" type=\"text\" style=\"border:0px;font-weight:bold\" readonly=\"\">";
	temp += "				</td>";
	temp += "			</tr>";
	temp += "			<tr>";
	temp += "				<td align=\"right\" style=\"padding-right:6px\">Title :</td>";
	temp += "				<td><input type=\"radio\" id=\"refer_title_mr\" name=\"refer_title\">Mr. <input type=\"radio\" id=\"refer_title_ms\" name=\"refer_title\">Ms.</td>";
	temp += "			</tr>";
	temp += "			<tr>";
	temp += "				<td align=\"right\" style=\"padding-right:6px\">Name :</td>";
	temp += "				<td><input type=\"text\" name=\"refer_sender_name\" style=\"width:250px\"></td>";
	temp += "			</tr>";
	temp += "			<tr>";
	temp += "				<td align=\"right\" style=\"padding-right:6px\">E-mail :</td>";
	temp += "				<td><input type=\"text\" name=\"refer_sender_email\" style=\"width:250px\"></td>";
	temp += "			</tr>";
	temp += "			<tr>";
	temp += "				<td align=\"right\" style=\"padding-right:6px\">Subject :</td>";
	temp += "				<td><input type=\"text\" name=\"refer_subject\" style=\"width:250px\"></td>";
	temp += "			</tr>";
	temp += "			<tr>";
	temp += "				<td align=\"right\" valign=\"top\" style=\"padding-right:6px\">Message :</td>";
	temp += "				<td><textarea rows=\"5\" name=\"refer_message\" style=\"width:250px\"></textarea></td>";
	temp += "			</tr>";
	temp += "			<tr>";
	temp += "				<td><input type=\"button\" value=\"Clear\" onClick=\"refer_box_reset()\"></td>";
	temp += "				<td align=\"right\"><input type=\"button\" value=\"Send Now\" onClick=\"enquiry_box_check();return false;\" style=\"font-family:Arial\"></td>";
	temp += "			</tr>";
	temp += "		</table>";
	temp += "	</div>";
	temp += "</div>";
	document.body.innerHTML = document.body.innerHTML + temp;
}

function import_enquiry_box_c()
{
	var temp = "";
	
	temp += "<div id=\"enquiry_box\" style=\"position:absolute;border:4px solid #666666;padding:2px;background-color:#FFFFFF;display:none;z-index:100\">";
	temp += "	<div style=\"border:2px solid #666666;padding:10px\">";
	temp += "		<table>";
	temp += "			<tr>";
	temp += "				<td colspan=\"2\" style=\"padding-bottom:2px\">";
	temp += "					<span style=\"font-family:Verdana;font-size:10pt;cursor:pointer;float:right\" onClick=\"document.getElementById('enquiry_box').style.display='none'\"><img alt=\"Close\" src=\"http://www.asiabs.com/english/online_form/close.gif\"></span>";
	temp += "					<b>发送至</b> : <span id=\"receiver_name\"></span>";
	temp += "				</td>";
	temp += "			</tr>";
	temp += "			<tr>";
	temp += "				<td colspan=\"2\" style=\"padding-bottom:10px\">";
	temp += "					<b>电邮</b> : <input id=\"refer_to\" size=\"30\" type=\"text\" style=\"border:0px;font-weight:bold\" readonly=\"\">";
	temp += "				</td>";
	temp += "			</tr>";
	temp += "			<tr>";
	temp += "				<td align=\"right\" style=\"padding-right:6px\">姓名 :</td>";
	temp += "				<td><input type=\"text\" name=\"refer_sender_name\" style=\"width:250px\"></td>";
	temp += "			</tr>";
	temp += "			<tr>";
	temp += "				<td align=\"right\" style=\"padding-right:6px\">电邮 :</td>";
	temp += "				<td><input type=\"text\" name=\"refer_sender_email\" style=\"width:250px\"></td>";
	temp += "			</tr>";
	temp += "			<tr>";
	temp += "				<td align=\"right\" style=\"padding-right:6px\">标题 :</td>";
	temp += "				<td><input type=\"text\" name=\"refer_subject\" style=\"width:250px\"></td>";
	temp += "			</tr>";
	temp += "			<tr>";
	temp += "				<td align=\"right\" valign=\"top\" style=\"padding-right:6px\">讯息 :</td>";
	temp += "				<td><textarea rows=\"5\" name=\"refer_message\" style=\"width:250px\"></textarea></td>";
	temp += "			</tr>";
	temp += "			<tr>";
	temp += "				<td><input type=\"button\" value=\"重设\" onClick=\"refer_box_reset()\"></td>";
	temp += "				<td align=\"right\"><input type=\"button\" value=\"发送\" onClick=\"enquiry_box_check();return false;\" style=\"font-family:Arial\"></td>";
	temp += "			</tr>";
	temp += "		</table>";
	temp += "	</div>";
	temp += "</div>";
	document.body.innerHTML = document.body.innerHTML + temp;
}
//--------------------------------------------------------------------------------------------------------------------------------------------
//CSS class Miodify

function css_class_selector(target)
{
	if (!document.styleSheets) return;
	var css_style = document.styleSheets;
	
	for( var x=0 ; css_style.length > x ; x++ )
	{
		if( document.styleSheets[x].cssRules )	var css_style_class = document.styleSheets[x].cssRules;
		else	var css_style_class = document.styleSheets[x].rules;
		
		for( var y=0 ; css_style_class.length > y ; y++ )
		{
			if( css_style_class[y].selectorText.toLowerCase() == target.toLowerCase() )
				return css_style_class[y];
		}
	}
	return null;
}

//--------------------------------------------------------------------------------------------------------------------------------------------
//Cookies Controal

function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure )
{
	var cookie_string = name + "=" + escape ( value );

	if( exp_y )
	{
		var expires = new Date ( exp_y, exp_m, exp_d );
		cookie_string += "; expires=" + expires.toGMTString();
	}
	
	if( path )
		cookie_string += "; path=" + escape ( path );
	
	if( domain )
		cookie_string += "; domain=" + escape ( domain );
  
	if( secure )
		cookie_string += "; secure";
	
	document.cookie = cookie_string;
}

function delete_cookie ( cookie_name )
{
	var cookie_date = new Date ( );  // current date & time
	cookie_date.setTime ( cookie_date.getTime() - 1 );
	document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}
//--------------------------------------------------------------------------------------------------------------------------------------------
//FAQ Menu On/Off

function menuAllOff()
{
	var allDIVtags = document.getElementsByTagName('div');
	
	for( var x=0 ; allDIVtags.length > x ; x++ )
	{
		if( allDIVtags[x].id.match(/faq_topic_[\d]+/) )
			allDIVtags[x].style.display = "none";
	}
	return;
}

function menuOnFirst()
{
	var allDIVtags = document.getElementsByTagName('div');
	
	for( var x=0 ; allDIVtags.length > x ; x++ )
	{
		if( allDIVtags[x].id.match(/faq_topic_[\d]+/) )
		{
			allDIVtags[x].style.display = "";
			return;
		}
	}
	return;
}

function menuOnSelect(str)
{
	if( document.getElementById('faq_topic_'+str) )
		document.getElementById('faq_topic_'+str).style.display = "";

	return;
}

function menuControl()
{
	var docURL = document.URL;
	var ftNum;
	
	menuAllOff();

	if( docURL.match(/ft=[\d]+/) )
	{
		ftNum = docURL.replace(/^[\s\S]*?\?[\s\S]*?ft=([\d]+)[\s\S]*?$/,"$1");
		menuOnSelect(ftNum);
	}
	else
		menuOnFirst();

	return;
}
//--------------------------------------------------------------------------------------------------------------------------------------------

function welcomeMSG()
{
	alert("Welcome to Abscpa.com");
}

//FAQ Menu On/Off

//window.onload = welcomeMSG;

