var msgWindow;
var iMyWidth = 0; 
var iMyHeight = (window.screen.height/8) - (96); 
var mmWin;
 

function submitForm(useraction){
  document.forms["HeaderMainForm"].submit();
}

function login(imglocation)
{
	//alert(window.location);
	var func = "status,height=225,width=450,resizable=0,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=0,menubar=0,toolbar=0,directories=0,status=0";
	var url = imglocation + "login/member_login.aspx?wndURL=" + window.location;
	
	if (msgWindow) msgWindow.close();
	msgWindow=window.open(url,"msgWindow", func);
}

function register(imglocation)
{
	//alert(window.location);
	var func = "status,height=600,width=790,resizable=0,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=1,menubar=0,toolbar=0,directories=0,status=1";
	var url = imglocation + "f_register/Screen_Main_Category_Select.aspx?wndURL=" + window.location;
	if (msgWindow) msgWindow.close();
	msgWindow=window.open(url,"msgWindow", func);
}

function logout(imglocation)
{
	var url = imglocation + "login/member_login_redir.aspx?wndURL=" + window.location;
	parent.window.location=url;
}

function enrol(){
 parent.window.location.href="enrolnow.asp";
}

function viewRestrictedPage(url){
 parent.window.location.href=url;
}

function subscribe(imglocation, MemberTypeID){
var url = imglocation + "F_Subscribe_MembershipType/Select_All_Member_Type.aspx?MemberTypeID=" + MemberTypeID;

 parent.window.location.href=url;
}


function showarticle(ModuleArticleID,FolderName,ImageLocation){
//parent.window.location.href = "showPage.aspx?ArticleID=" + param + "&PageID=" + param1 + "&ModuleName=" + param2;
parent.window.location.href = ImageLocation + FolderName + "/" + ModuleArticleID + "/";
}

function showPopUparticle(param,param1,param2, param4){
	var func = "status,height=400,width=530,resizable=1,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=0,menubar=0,toolbar=0,directories=0,status=0";
	var url = param4 + "admin/modules/show_article.aspx?ArticleID=" + param + "&PageID=" + param1 + "&ModuleName=" + param2;
	if (msgWindow) msgWindow.close();
	msgWindow=window.open(url,"showArticle", func);

}

function openNewWindow(winURL,winWidth,winHeight,winConfig){
     mmConfig=""
     mmConfig="width="+winWidth+","
     mmConfig+="height="+winHeight+","
     mmConfig+="resizable=1,"
     mmConfig+="scrollbars=1,"
     mmConfig+="location=1,"
     mmConfig+="menubar=1,"
     mmConfig+="toolbar=1,"
     mmConfig+="directories=1,"
     mmConfig+="status=1,"

     mmConfig+=winConfig
     if (mmWin) mmWin.close();
	 mmWin =open(winURL,"mmWin",mmConfig);
     mmWin.focus();
}

function openSecuredNewWindow(winURL,winWidth,winHeight,winConfig){
     mmConfig=""
     mmConfig="width="+winWidth+","
     mmConfig+="height="+winHeight+","
     mmConfig+="resizable=1,"
     mmConfig+="scrollbars=1,"
     mmConfig+="location=1,"
     mmConfig+="menubar=1,"
     mmConfig+="toolbar=1,"
     mmConfig+="directories=1,"
     mmConfig+="status=1,"

     mmConfig+=winConfig
     if (mmWin) mmWin.close();
     //winURL = "securedwebsite/website_redirect.aspx?URL=" + winURL;
	 mmWin =open(winURL,"mmWin",mmConfig);
	 //mmWin.resizeTo();
     mmWin.focus();
}


function showExternalPopUp(winURL){
	var func = "status,height=400,width=600,resizable=1,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=1,menubar=1,toolbar=1,directories=1,status=1,location=1";
	if (mmWin) mmWin.close();
	mmWin =open(winURL,"mmWin",func);
    mmWin.focus();
}

function showExternalSecuredPopUp(winURL){
	var func = "status,height=400,width=600,resizable=1,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=1,menubar=1,toolbar=1,directories=1,status=1,location=1";
	if (mmWin) mmWin.close();
	mmWin =open(winURL,"mmWin",func);
    mmWin.focus();
}

function printWnd(strOutput, Website){
//Create Popup Window
	

	var mywin = window.open("about:blank", "source", "width=740,height=500,left=0,top=0,toolbar=no,location=no,menubar=yes,status=yes,scrollbars=yes,resizable=no");
	
	while (mywin == null) {
		mywin = window.open("about:blank", "source", "width=740,height=500,left=0,top=0,toolbar=no,location=no,menubar=yes,status=yes,scrollbars=yes,resizable=no");
	}
	
	//reference popup's document object
	var myDoc = mywin.document;
	
	//write into popup
	myDoc.open("text/html");
	var xlinkstyle = Website + "css/asia1024.css"
	myDoc.write("<html><link rel='stylesheet' href='" + xlinkstyle + "'><body>" + strOutput + "</body></html>");
	myDoc.close();
	myDoc.title = document.title;
	//window.print();
}

