// Add BookMark
function addbookmark(bTITLE)
{
	bURL = window.location;
	if (document.all)
		window.external.AddFavorite(bURL,bTITLE)
}
			
// Open Window
function open_window(sURL, sWINNAME)
{
	var myWin;
	myWin= window.open(sURL,"User"+sWINNAME,'left=200,top=200,toolbar=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=no,width=600,height=300');
} 	
function open_intro(sURL, sWINNAME)
{
	var myWin;
	myWin= window.open(sURL,"User"+sWINNAME,'left=100,top=100,toolbar=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=no,width=800,height=555');
} 	
//popup window 
//WIDTH  = Open page width
//HEIGHT= Open page height
//sWINNAME = open window name

function open_popup(sURL, sWINNAME , WIDTH ,HEIGHT)
{
	var left, top;	
	left=(window.screen.width-WIDTH)/2;
	top=(window.screen.height-HEIGHT)/2;
	window.open(sURL,sWINNAME,'left=' + left + ',top=' + top + ',toolbar=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,width=' + WIDTH +',height=' + HEIGHT);
	
}

/*
function LaunchCourse_window(sURL, inWindow, sWINNAME)
{
	var myWin;	
	if (inWindow == 1)
		myWin= window.open(sURL,"User"+sWINNAME,'left=10,top=20,toolbar=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=yes,width=990,height=650');
	else
		window.location = sURL;
} 	
*/

function preLaunchCourse_window(sURL,inWindow ,sWINNAME, LaunchInfo, IsAccess, IsMendatory, intHeight, intWidth)
{
	//alert("height : " + intHeight);
	//alert("width : " + intWidth);
	//alert('left=10,top=20,toolbar=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,width='+intWidth+',height='+intHeight);
	
	if(PLwin)
		PLwin.close();			

	if(LaunchInfo==2)
	{
		if (inWindow == 1)
		{	
			if(IsAccess == 1)
			{
				if(IsMendatory != 0)
				{
					
					//PLwin= window.open(sURL,"user"+sWINNAME,'left=10,top=20,toolbar=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,width='+intWidth+',height='+intHeight);
					open_popup(sURL,"user"+sWINNAME,intWidth,intHeight);
				}
				else
				{	
					//PLwin= window.open(sURL,"user"+sWINNAME,'left=10,top=20,toolbar=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,width='+intWidth+',height='+intHeight);
					open_popup(sURL,"user"+sWINNAME,intWidth,intHeight);
				}
			}
			else
			{
				//PLwin= window.open(sURL,"user"+sWINNAME,'left=10,top=20,toolbar=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,width='+intWidth+',height='+intHeight);
				open_popup(sURL,"user"+sWINNAME,intWidth,intHeight);
			}
		}
		else
		{
			window.location = sURL;
		}
	}
	else
	{
		if (inWindow == 1)
		{
	
			//PLwin= window.open(sURL,"user"+sWINNAME,'left=10,top=20,toolbar=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,width='+intWidth+',height='+intHeight);
			open_popup(sURL,"user"+sWINNAME,intWidth,intHeight);
		}
		else
		{
			window.location = sURL;
		}
	}
	
}	



/*
function preLaunchCourse_window(sURL, inWindow, sWINNAME)
{
	var myWin;	
	if (inWindow == 1)
		myWin= window.open(sURL,"User"+sWINNAME,'left=10,top=20,toolbar=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=yes,width=990,height=650');	
		//myWin= window.open(sURL,"User"+sWINNAME,'left=100,top=100,toolbar=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=no,width=750,height=197');
	else
		window.location = sURL;
} 
*/	

// Open Window
function openwin(sURL, sWINNAME)
{
	//alert("safsdfs");
	var myWin;
	myWin= window.open(sURL,"User"+sWINNAME,'left=200,top=200,toolbar=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=no,width=640,height=480');
} 	

//add by parimal for terms and condition
function openwintermscondition(sURL, sWINNAME)
{
	var myWin;
	myWin= window.open(sURL,sWINNAME,'left=200,top=200,toolbar=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,width=800,height=400');
} 	

//add by parimal for privacy
function openwinprivacy(sURL, sWINNAME)
{
	var myWin;
	myWin= window.open(sURL,sWINNAME,'left=200,top=200,toolbar=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,width=800,height=400');
} 	



// Open Flash    
function open_Flash(sURL, sWINNAME)
{
	var myWin;
	myWin = window.open(sURL,"User"+sWINNAME,'left=100,top=100,toolbar=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=no,width=780,height=550');
} 	

function funChange(strLangCode)
{
	document.frmLangMenu.LanguageName.value = strLangCode
	document.frmLangMenu.submit();
}

function funSearchCatalogTp()
{
	
	if (document.frmSearchCatalogTP.txtsearchcourse.value=='')
		return;
	document.frmSearchCatalogTP.hdntxtSearchValue.value=document.frmSearchCatalogTP.txtsearchcourse.value;
	
	var strquery = document.frmSearchCatalogTP.hdntxtSearchValue.value;
	var varfulltext;
	varfulltext=-1;
	
	if (document.frmSearchCatalogTP.chkrankyesno)
	{
		if (document.frmSearchCatalogTP.chkrankyesno.checked==true)
		
			varfulltext = 1;
		
		else
			varfulltext = 0;

		document.frmSearchCatalogTP.hdnIsFullText.value=varfulltext
		
	}
	if (document.frmSearchCatalogTP.cmbCatalogTP)
	{
		
		   document.frmSearchCatalogTP.hdntxtSearchInto.value=document.frmSearchCatalogTP.cmbCatalogTP[document.frmSearchCatalogTP.cmbCatalogTP.selectedIndex].text;
		    if (document.frmSearchCatalogTP.cmbLanguage)
			    {
				document.frmSearchCatalogTP.hdntxtSearchContentLanguage.value=document.frmSearchCatalogTP.cmbLanguage[document.frmSearchCatalogTP.cmbLanguage.selectedIndex].text;
				document.frmSearchCatalogTP.action = '../search/search.asp?CourseSelection='+document.frmSearchCatalogTP.cmbCatalogTP.value +'&Lcode=' + document.frmSearchCatalogTP.cmbLanguage.value +'&SearchCriterion=' + strquery + '&SearchType=' + varfulltext + "&hdntxtSearchContentLanguage=" + document.frmSearchCatalogTP.cmbLanguage[document.frmSearchCatalogTP.cmbLanguage.selectedIndex].text + "&hdntxtSearchInto="  + document.frmSearchCatalogTP.cmbCatalogTP[document.frmSearchCatalogTP.cmbCatalogTP.selectedIndex].text + "&hdnIsFullText=" + document.frmSearchCatalogTP.hdnIsFullText.value + "&hdnTxtSearchValue=" + document.frmSearchCatalogTP.hdntxtSearchValue.value ;
			    }
		   else
			{
			document.frmSearchCatalogTP.action = '../search/search.asp?CourseSelection='+document.frmSearchCatalogTP.cmbCatalogTP.value +'&SearchCriterion=' + strquery + '&SearchType=' + varfulltext + "&hdntxtSearchInto="  + document.frmSearchCatalogTP.cmbCatalogTP[document.frmSearchCatalogTP.cmbCatalogTP.selectedIndex].text + "&hdnIsFullText=" + document.frmSearchCatalogTP.hdnIsFullText.value + "&hdnTxtSearchValue=" + document.frmSearchCatalogTP.hdntxtSearchValue.value ;
			}
	}
	else
	{
	    
	    if (document.frmSearchCatalogTP.cmbLanguage)
	    {
		 document.frmSearchCatalogTP.hdntxtSearchContentLanguage.value=document.frmSearchCatalogTP.cmbLanguage[document.frmSearchCatalogTP.cmbLanguage.selectedIndex].text;


			document.frmSearchCatalogTP.action = '../search/search.asp?CourseSelection=allcourses' + '&SearchCriterion=' + strquery +'&Lcode=' + document.frmSearchCatalogTP.cmbLanguage.value + '&SearchType=' + varfulltext + "&hdntxtSearchContentLanguage=" + document.frmSearchCatalogTP.cmbLanguage[document.frmSearchCatalogTP.cmbLanguage.selectedIndex].text + "&hdnIsFullText=" + document.frmSearchCatalogTP.hdnIsFullText.value + "&hdnTxtSearchValue=" + document.frmSearchCatalogTP.hdntxtSearchValue.value;
		}
		else
		{
			document.frmSearchCatalogTP.action = '../search/search.asp?CourseSelection=allcourses' + '&SearchCriterion=' + strquery + '&SearchType=' + varfulltext + "&hdnIsFullText=" + document.frmSearchCatalogTP.hdnIsFullText.value + "&hdnTxtSearchValue=" + document.frmSearchCatalogTP.hdntxtSearchValue.value;
		}
	}
	
	document.frmSearchCatalogTP.submit();
}

//Change By Chetan
function funLangChange()
{
	var sURL; 
	sURL = window.location;
	sURL = sURL.toString();
	if (sURL.toLowerCase().indexOf('whatsavailable.asp') > 0 || sURL.toLowerCase().indexOf('trainingplan.asp') > 0)
	{
		sURL = sURL.substring(0, sURL.indexOf('?'));
		document.frmLangMenu.action = sURL;
	}
	document.frmLangMenu.submit();
}

//added by ankit shah
function CertificatePopup(sURL,sWINNAME)
{
	
	var left,top;
	var WIDTH = 940;
	var HEIGHT = 760;
	left=(window.screen.width-WIDTH)/2;
	top=(window.screen.height-HEIGHT)/2;				
	window.open(sURL,sWINNAME,'left=' + left + ',top=' + top + ',toolbar=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,width=' + WIDTH +',height=' + HEIGHT);										
}
function CurriculumCertificatePopup(sURL,sWINNAME)
{
	
	var left,top;
	var WIDTH = 940;
	var HEIGHT = 760;
	left=(window.screen.width-WIDTH)/2;
	top=(window.screen.height-HEIGHT)/2;				
	window.open(sURL,sWINNAME,'left=' + left + ',top=' + top + ',toolbar=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,width=' + WIDTH +',height=' + HEIGHT);										
}


/*function sValidateMailAddress()
{
	//var smRegExp = new RegExp('^[^.@][^@]\*@[^.@][^@]\*[.][^.@]\*[^@]\*[^.@]\+$');
	var smRegExp = new RegExp('^[^@. ][^@ ]\*@[^@. ][^@ ]\*[.][^.@ ]\*[^@ ]\*[^@. ]$');
	if (arguments.length != 1) 
		return -1;
	if (smRegExp.test(arguments[0]))
		return 1;
	else
		return -2;
}

function TrimSpace(str)
{
	str = str.toString();
	var i;
	var len = str.length;

	for (i=0; i<len; i++)

	if (str.charAt(i) != " ")
		break;
	str = str.substring(i,str.length);
		len = str.length;
	for (i=str.length-1; i>=0; i--)

	if (str.charAt(i) != " ")
	break;

	str = str.substring(0, i+1);
	return str;
}



function dateCompare()
{
	var strDate1 = arguments[0];
	var strDate2 = arguments[1];
	//alert(strDate1+'()'+strDate2);
	// alert("Ankur");
	var strSeparator = '-';

	var aryDate1 = strDate1.split(strSeparator);
	var aryDate2 = strDate2.split(strSeparator);
	var intDay1, intMonth1, intYear1;
	var intDay2, intMonth2, intYear2;		

	//alert(aryDate1[0]);	
	//alert(parseInt(aryDate1[0]));
	//alert(Number(aryDate1[0]));
	

	intDay1 = parseInt(Number(aryDate1[0]));
	intMonth1 = parseInt(getIntMonth(aryDate1[1]));				
	intYear1 = parseInt(aryDate1[2]);

	//alert(parseInt(Number(aryDate1[0])));
	//alert(parseInt(Number(aryDate2[0])));	
	

	intDay2 = parseInt(Number(aryDate2[0]));
	intMonth2 = parseInt(getIntMonth(aryDate2[1]));
	intYear2 = parseInt(aryDate2[2]);

	//alert(intDay1 + '%' + intMonth1 + '%' +  intYear1  + '%' + intDay2 + '%' +  intMonth2  + '%' + intYear2 );
		
	//alert(intYear1);
	//alert(intYear2);
		
	if ( intYear1 > intYear2)
		return false;		
		//return -1;
	if( intYear1 < intYear2)
		return true;		 	

	else if(intYear1 == intYear2)
	{

		//alert(intMonth1);
		//alert(intMonth2);


		if(intMonth1 < intMonth2)
			return true;
			//return -1;
		else if (intMonth1 > intMonth2)
			return false;

		else if(intMonth1 == intMonth2)
		{
			//alert(intDay1 + '--' + intDay2);
			
			if(intDay1 < intDay2)			
				return 1;
			else if(intDay1 == intDay2)
				return 1;
			else if(intDay1 > intDay2)
				{
				//alert("baba")
				return false;					
				//return -1;
				}
		}
		else if(intMonth1 > intMonth2)
			return 1;
	}
	else if(intYear1 > intYear2)
		return 1;
		
}

function getIntMonth(strMonth)
{
	strMonth = strMonth.toLowerCase();
	if ( strMonth == 'jan')
	return 1;
	if ( strMonth == 'feb')
	return 2;
	if ( strMonth == 'mar')
	return 3;
	if ( strMonth == 'apr')
	return 4;
	if ( strMonth == 'may')
	return 5;
	if ( strMonth == 'jun')
	return 6;
	if ( strMonth == 'jul')
	return 7;
	if ( strMonth == 'aug')
	return 8;
	if ( strMonth == 'sep')
	return 9;
	if ( strMonth == 'oct')
	return 10;
	if ( strMonth == 'nov')
	return 11;
	if ( strMonth == 'dec')
	return 12;
	return 0;
}

function isValidDate()
{
	var strDate, strSeparator;
	var intDay, intMonth, intYear
				
	strDate = arguments[0];
	strSeparator = '-';

	var aryDate = strDate.split(strSeparator);

	if ( aryDate.length != 3 )
	return false;

	intDay = aryDate[0];
	intMonth = getIntMonth(aryDate[1]);

	if ( intMonth <= 0 )
	return false;
	intYear = aryDate[2];

	if ( !isValidInteger(intDay) )
	return false;

	if ( !isValidInteger(intMonth) )
	return false;

	if ( !isValidInteger(intYear) )
	return false;
	
	if ( Number(intYear) <1899 || Number(intYear) > 2099 )
	return false;

	var strTempDate = new Date( intMonth + '-' + intDay + '-' + intYear);

	if ((strTempDate.getDate() != parseInt(intDay,10)) || ((strTempDate.getMonth()+1) != parseInt(intMonth,10)) || 	(strTempDate.getFullYear() != (parseInt(intYear,10))))
	
	return false;

	return true;
}

function isValidInteger()
{
	
	if (arguments.length != 1)
		return false;
	if (TrimSpace(arguments[0])== "")
		return false;
	return parseInt(Number(arguments[0])) == arguments[0];
}

*/