function ExpMenu(){ 
 if(navigator.appVersion.indexOf("MSIE")==-1){return;}
 var i,k,g,lg,r=/\s*hvr/,nn='',c,cs='hvr',bv='menubar';
 for(i=0;i<10;i++){g=document.getElementById(bv+nn);if(g){
 lg=g.getElementsByTagName("LI");if(lg){for(k=0;k<lg.length;k++){
 lg[k].onmouseover=function(){c=this.className;cl=(c)?c+' '+cs:cs;
 this.className=cl;};lg[k].onmouseout=function(){c=this.className;
 this.className=(c)?c.replace(r,''):'';};}}}nn=i+1;}
}

function setVis(objectID,state) {
	document.getElementById(objectID).style.visibility =state;
}

function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

function getstr_xml_filename(maincat_id) {
	var xml_filename = 'xmlmerchant_health.xml';
	if (maincat_id == '1') {
		xml_filename = 'xmlmerchant_health.xml';
	} else if (maincat_id == '2') {
		xml_filename = 'xmlmerchant_shopping.xml';
	} else if (maincat_id == '3') {
		xml_filename = 'xmlmerchant_travel.xml';
	} else if (maincat_id == '4') {
		xml_filename = 'xmlmerchant_wine.xml';
	} else if (maincat_id == '5') {
		xml_filename = 'xmlmerchant_premier.xml';
	}
	return xml_filename;
}

function checkvalidStartEndDate(strstart_date, strend_date)
{

var dateobj = new Date();
var current_timestamp = dateobj.getTime();

	if (strstart_date.indexOf('-') < 0 || strend_date.indexOf('-') < 0) {
		return false;
	}

	artemp = strstart_date.split('-');
	start_dateobj = new Date();
	end_dateobj = new Date();
	tempmonth = artemp[1]; tempday = artemp[2];
	if (tempmonth.charAt(0) == '0') tempmonth = tempmonth.substr(1);
	if (tempday.charAt(0) == '0') tempday = tempday.substr(1);
	start_dateobj.setFullYear(artemp[0], parseInt(tempmonth)-1, tempday);
	start_timestamp = start_dateobj.getTime();
	//alert(start_timestamp +' ; '+ current_timestamp); return;  // debug
	artemp = strend_date.split('-');
	tempmonth = artemp[1]; tempday = artemp[2];
	if (tempmonth.charAt(0) == '0') tempmonth = tempmonth.substr(1);
	if (tempday.charAt(0) == '0') tempday = tempday.substr(1);
	end_dateobj.setFullYear(artemp[0], parseInt(tempmonth)-1, tempday);
	end_dateobj.setHours(23, 59, 59, 999);  // set to end of day
	end_timestamp = end_dateobj.getTime();
	
	if (current_timestamp >= start_timestamp && current_timestamp <= end_timestamp) {
		return true;
	}
	else {
		return false;
	}		
}

function convertdate(mydate) {
	armonth = new Array();
	armonth[1] = "January";
	armonth[2] = "Febuary";
	armonth[3] = "March";
	armonth[4] = "April";
	armonth[5] = "May";
	armonth[6] = "Jun";
	armonth[7] = "July";
	armonth[8] = "August";
	armonth[9] = "September";
	armonth[10] = "October";
	armonth[11] = "November";
	armonth[12] = "December";
	
	artemp = mydate.split('-');
	tempyear = artemp[0]; tempmonth = artemp[1]; tempday = artemp[2];
	if (tempmonth.charAt(0) == '0') tempmonth = tempmonth.substr(1);
	if (tempday.charAt(0) == '0') tempday = tempday.substr(1);
		
	return tempday + " " + armonth[tempmonth] + " " + tempyear;
	
}

function removeSpecialChars(strmerchant) {
	var merchant = "";
	
	merchant = strmerchant.replace("&", " ");
	merchant = merchant.replace("ô", "o");
	
	return merchant;	
}

function fntrim(str) {
	var	str = str.replace(/^\s\s*/, ''),
	ws = /\s/,
	i = str.length;
	while (ws.test(str.charAt(--i)));
	return str.slice(0, i + 1);
}

