var msgWindow;
var iMyWidth = 0; 
var iMyHeight = (window.screen.height/8) - (96); 
var mmWin;
 

function submitForm(useraction){
  document.forms["FrmCustomer"].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 PagelogIn(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_Page_redir.aspx" ;
	url = url + "?UserName=" + frmUser.UserName.value;
	url = url + "&Password=" + frmUser.Password.value;
	url = url + "&wndURL=" + window.location;
	
	location.href = url;
}

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";
	//alert(url);
	parent.window.location=url;
}

function enrol(){
 parent.window.location.href="enrolnow.asp";
}

function viewRestrictedPage(url){
 parent.window.location.href=url;
}


function showSearch(imglocation){
 

Searchval = frmSearch.txtSearch.value;

Searchval = Searchval.replace(/\s+/g, '_');

 var url = imglocation + "add_ons/Search/results.aspx?SearchResultsForm=1&txtSearch=" + Searchval;
 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 showPrivacy(ImageLocation){
//parent.window.location.href = "Display.aspx?ArticleID=" + param + "&PageID=" + param1 + "&ModuleName=" + param2;
//parent.window.location.href = ImageLocation + "/Privacy/";

var url = ImageLocation + "Privacy/";
//parent.window.location.href = url; 
var func = "status,height=500,width=500,resizable=0,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=1,menubar=0,toolbar=0,directories=0,status=1";
if (msgWindow) msgWindow.close();
msgWindow=window.open(url,"msgWindow", func);
}

function showDisclaimer(ImageLocation){
//parent.window.location.href = "Display.aspx?ArticleID=" + param + "&PageID=" + param1 + "&ModuleName=" + param2;
var url = ImageLocation + "Disclaimer/";

var func = "status,height=500,width=500,resizable=0,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=1,menubar=0,toolbar=0,directories=0,status=1";
if (msgWindow) msgWindow.close();
msgWindow=window.open(url,"msgWindow", func);

}


function showarticle(ModuleArticleID,FolderName,ImageLocation){
//parent.window.location.href = "Display.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 checkDoc(ThisWebSite, DocID){
	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 = ThisWebSite + "admin/library/Doc_download.aspx?DocID=" + DocID;
	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=700,width=1000,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 internalLink(url)
{
	location.href =url;

}

function externalLink(url)
{
	nw = window.open(url);
}


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 + "styles/UserStyle.css"
	myDoc.write("<html><link rel='stylesheet' href='" + xlinkstyle + "'><body>" + strOutput + "</body></html>");
	myDoc.close();
	myDoc.title = document.title;
	//window.print();
}


function chkData(param, param1) 
	{	
	txtbox1 = eval("document.FrmCustomer.txt_" + param); 
	var eVal = txtbox1.value;
	//alert(eVal);
	
	// check for alpha numeric only
	if (eVal != "")
	{
	if (param1 == 1)
	{
		x = isAlphanumeric(eVal);
 		if (x)
 		{
 		}
 		else
 		{
 			alert("The Special characters are not allowed.");
    		txtbox1.focus();
    		txtbox1.value = "";
 		}
	
	
	}
	
	// check for Number Only
	
	if (param1 == 3)
	{
		x = isPositiveInteger(eVal);
 		if (x)
 		{
 		}
 		else
 		{
			alert("Please enter Numbers only from 0-9.");
    		txtbox1.focus();
    		txtbox1.value = "";
		}
	}
	
	// check for email Only
	
	if (param1 == 4)
	{
		x = isEmail(eVal);
 		
 		if (x)
 		{
 		}
 		else
 		{
 			alert("Please enter the correct Email address.");
 			txtbox1.focus();
 			txtbox1.value = "";
    	}
		
	}
	}
	}
	
	function chkForm()
	{		
				
    	return (true);
	}
	
	
	function setCourseID(param)
	{
		var cbo = eval("document.FrmCustomer." + param)
		var paramCourseID =cbo.options[cbo.selectedIndex].value;
		document.FrmCustomer.CourseID.value = paramCourseID;
		//alert(document.FrmCustomer.CourseID.value);
	}
	
	
	function submitForm()
	{		
		if 	(document.FrmCustomer.Form_ModuleId.value == 1)	
		{
			if (document.FrmCustomer.CourseID.value  == 0)
			{
				alert("Please Select a Course.");
			}
			else
			{
				document.FrmCustomer.submit();
			}
			
		}
		
		if (document.FrmCustomer.Form_ModuleId.value == 0)
		{
    		document.FrmCustomer.submit();
    	}
    	
    	
	}
	
	function PageRegister(param)
	{
 		var func = "status,height=600,width=790,resizable=1,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=1,menubar=0,toolbar=0,directories=0,status=1";
		var url =  "../f_register/Screen_Main_Category_Select.aspx?wndURL=" + window.location;
		
		msgWindow=window.open(url,"msgWindow", func);
		msgWindow.resizeTo(780, 580);
	}
	
	function forgotPwd(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/forgot_password.aspx?wndURL=" + window.location;
	
	if (msgWindow) msgWindow.close();
	msgWindow=window.open(url,"msgWindow", func);
}


function showQuickLinks()
		{
		 var NewURL = document.frmQuickLinks.cboQuicklink.options[document.frmQuickLinks.cboQuicklink.selectedIndex].value;
 		 //alert(NewURL);
 		 window.location = NewURL;
		}