﻿// JScript File
var max = 5;
var maxBrk = 5;
var maxCons = 5;
var maxResume = 5;
var maxRecruiter = 5;
var check = -1;
var checkBrk = -1;
var checkCons = -1;
var checkResume = -1;
var checkRecruiter = -1;
var onlyOnce = 0;

/* this fuctions is used to featured Job by rajkumar */
function ChangeByFeaturedJob()
{       
	if(document.getElementById("ctl00_ContentPlaceHolder1_FeaturedJobsNew1_hideNum") != null)
		max = parseInt(document.getElementById("ctl00_ContentPlaceHolder1_FeaturedJobsNew1_hideNum").value);	
	if(check == -1)
		setTimeout("forSetTimeFeaturedJob()",1);
	else
		setTimeout("forSetTimeFeaturedJob()",15000);
//	if (onlyOnce == 0)
//	{
//		ChangeByOneBrk();
//		onlyOnce = 1;
//	}
}
function forSetTimeFeaturedJob()
{    
	check++;
	if(check == max)
		check = 0;		
	HideShowFeaturedJob(check);
	ChangeByFeaturedJob();
}

function HideShowFeaturedJob(check)
{   
	if(document.getElementById("ctl00_ContentPlaceHolder1_FeaturedJobsNew1_onlyOneRow") != null)
	{	    
		if(document.getElementById("ctl00_ContentPlaceHolder1_FeaturedJobsNew1_hide"+check) != null)
		{	        
			document.getElementById("ctl00_ContentPlaceHolder1_FeaturedJobsNew1_onlyOneRow").innerHTML = document.getElementById("ctl00_ContentPlaceHolder1_FeaturedJobsNew1_hide"+check).value;
		}
	}
}

/* end Featured Job */

/* this fuctions is used to featured Company by rajkumar */
function ChangeByFeaturedCompany()
{
	if(document.getElementById("ctl00_ContentPlaceHolder1_FeaturedCompaniesNew1_hideNum") != null)
	{
		maxBrk = parseInt(document.getElementById("ctl00_ContentPlaceHolder1_FeaturedCompaniesNew1_hideNum").value);
	}
	
	if(checkBrk == -1)
		setTimeout("forSetTimeFeaturedCompany()",1);
	else
		setTimeout("forSetTimeFeaturedCompany()",15000);
}

function forSetTimeFeaturedCompany()
{
	checkBrk++;
	if(checkBrk == maxBrk)
		checkBrk = 0;
		
	HideShowFeaturedCompany(checkBrk);
	ChangeByFeaturedCompany();
}

function HideShowFeaturedCompany(checkBrk)
{
	if(document.getElementById("ctl00_ContentPlaceHolder1_FeaturedCompaniesNew1_onlyOneRow") != null)
	{
		if(document.getElementById("ctl00_ContentPlaceHolder1_FeaturedCompaniesNew1_hide" + checkBrk) != null)
		{
			document.getElementById("ctl00_ContentPlaceHolder1_FeaturedCompaniesNew1_onlyOneRow").innerHTML = document.getElementById("ctl00_ContentPlaceHolder1_FeaturedCompaniesNew1_hide"+checkBrk).value;
		}
	}
}

/* end Featured Company */

/* this fuctions is used to featured consultant by rajkumar */
function ChangeByFeaturedConsultant()
{
    if(document.getElementById("ctl00_ContentPlaceHolder1_FeaturedConsultantNew1_hideNum") != null)
	{
		maxCons = parseInt(document.getElementById("ctl00_ContentPlaceHolder1_FeaturedConsultantNew1_hideNum").value);		
	}
	
	if(checkCons == -1)
		setTimeout("forSetTimeFeaturedConsultant()",1);
	else
		setTimeout("forSetTimeFeaturedConsultant()",15000);
}

function forSetTimeFeaturedConsultant()
{
    checkCons++;
	if(checkCons == maxCons)
		checkCons = 0;
		
	HideShowFeaturedConsultant(checkCons);
	ChangeByFeaturedConsultant();
}

function HideShowFeaturedConsultant(checkCons)
{
	if(document.getElementById("ctl00_ContentPlaceHolder1_FeaturedConsultantNew1_onlyOneRow") != null)
	{
		if(document.getElementById("ctl00_ContentPlaceHolder1_FeaturedConsultantNew1_hide" + checkCons) != null)
		{
			document.getElementById("ctl00_ContentPlaceHolder1_FeaturedConsultantNew1_onlyOneRow").innerHTML = document.getElementById("ctl00_ContentPlaceHolder1_FeaturedConsultantNew1_hide"+checkCons).value;
		}
	}
}

/* end Featured consultant */

/* this fuctions is used to featured resume by rajkumar */
function ChangeByFeaturedResume()
{
    if(document.getElementById("ctl00_ContentPlaceHolder1_FeaturedResumeNew1_hideNum") != null)
	{
		maxResume = parseInt(document.getElementById("ctl00_ContentPlaceHolder1_FeaturedResumeNew1_hideNum").value);		
	}
	
	if(checkResume == -1)
		setTimeout("forSetTimeFeaturedResume()",1);
	else
		setTimeout("forSetTimeFeaturedResume()",15000);
}

function forSetTimeFeaturedResume()
{
    checkResume++;
	if(checkResume == maxResume)
		checkResume = 0;
		
	HideShowFeaturedResume(checkResume);
	ChangeByFeaturedResume();
}

function HideShowFeaturedResume(checkResume)
{    
	if(document.getElementById("ctl00_ContentPlaceHolder1_FeaturedResumeNew1_onlyOneRow") != null)
	{
		if(document.getElementById("ctl00_ContentPlaceHolder1_FeaturedResumeNew1_hide" + checkResume) != null)
		{
			document.getElementById("ctl00_ContentPlaceHolder1_FeaturedResumeNew1_onlyOneRow").innerHTML = document.getElementById("ctl00_ContentPlaceHolder1_FeaturedResumeNew1_hide"+checkResume).value;
		}
	}
}

/* end Featured resume */

/* featured recruiters */
function ChangeByFeaturedRecruiter()
{
    if(document.getElementById("ctl00_ContentPlaceHolder1_FeaturedRecruitersNew1_hideNum") != null)
	{
		maxRecruiter = parseInt(document.getElementById("ctl00_ContentPlaceHolder1_FeaturedRecruitersNew1_hideNum").value);		
	}
	
	if(checkRecruiter == -1)
		setTimeout("forSetTimeFeaturedRecruiter()",1);
	else
		setTimeout("forSetTimeFeaturedRecruiter()",15000);
}

function forSetTimeFeaturedRecruiter()
{
    checkRecruiter++;
	if(checkRecruiter == maxRecruiter)
		checkRecruiter = 0;
		
	HideShowFeaturedRecruiter(checkRecruiter);
	ChangeByFeaturedRecruiter();
}

function HideShowFeaturedRecruiter(checkRecruiter)
{    
	if(document.getElementById("ctl00_ContentPlaceHolder1_FeaturedRecruitersNew1_onlyOneRow") != null)
	{
		if(document.getElementById("ctl00_ContentPlaceHolder1_FeaturedRecruitersNew1_hide" + checkRecruiter) != null)
		{
			document.getElementById("ctl00_ContentPlaceHolder1_FeaturedRecruitersNew1_onlyOneRow").innerHTML = document.getElementById("ctl00_ContentPlaceHolder1_FeaturedRecruitersNew1_hide"+checkRecruiter).value;
		}
	}
}



// Change Method name by yogesh 11 july 2006 (i.e remove prefix fun)

	/*This fuction is used to get a print version of an article */
	function GetNewsLetterContent()
	{
		if (document.getElementById != null)
		{
			var html = '<HTML>\n<HEAD>\n';
			if (document.getElementsByTagName != null)
			{
				var headTags = document.getElementsByTagName("head");
				if (headTags.length > 0)
					html += headTags[0].innerHTML;
			}
			html += '\n</HEAD>\n<BODY>\n<form name = frmform>\n';
			var printReadyElement1 = document.getElementById("div1");
			if (printReadyElement1 != null)
			{
				html += printReadyElement1.innerHTML;
			}
			html += '\n</div>\n</form>\n</BODY>\n</HTML>';
			var sReturnString = document.getElementById("txtNewsLetterContent");
			sReturnString.value = html;
//			var printWin = window.open();
//			printWin.document.open();
//			printWin.document.write(html);
			//return true;
		}
		else
		{
			//return false;
		}
	}

/* To chech weather user is logged in or not
This event is called when we are adding Attributes.Add of a control*/
	function CheckSession(sCheck)
	{
		if(sCheck == "")
		{
			var str = window.location.toString().toLowerCase();
			str = str.substring(str.indexOf('/c-sharpcorner/')+14);
			window.location.href('../User Registration/LoginCheck.aspx?ReturnURL=..'+str);
			
			return false;
		}
		else
			return true;	
	}	
	
	function CheckSessionArticle(sCheck)
	{
		if(sCheck == "")
		{
			var str = window.location.toString().toLowerCase();			
			window.location.href('../../../User Registration/LoginCheck.aspx?ReturnURL='+str);
			return false; 
		}
		else
			return true;	
	}
	function CheckSessionArticleNewURL(sCheck)
	{
		if(sCheck == "")
		{
			var str = window.location.toString().toLowerCase();			
			window.location.href('../../../User Registration/LoginCheck.aspx?ReturnURL='+str);
			return false; 
		}
		else
			return true;
	}	
	
/* to check login, valid author and for comfirmation message to perform an author action*/ 	
	function CheckSessionAndMsgAuthor(sUserID, sAuthor, sCommand)
	{
		if(sUserID == "")
		{
			window.location.href('../../../User Registration/LoginCheck.aspx');
			return false;
		}
		else if(sUserID != sAuthor)
		{
			alert("You are not the author of the Message! So you are not permitted "+sCommand+" the Message");
			return false;
		}
		else
			return confirm(sCommand+" the Message!");			
	}

	/*This fuction is used to get a print version of an article */
	
	function GetPrintVersion()
	{
		if (document.getElementById != null)
		{
			var html = '<HTML>\n<HEAD>\n';
			if (document.getElementsByTagName != null)
			{
				var headTags = document.getElementsByTagName("head");
				if (headTags.length > 0)
					html += headTags[0].innerHTML;
			}
			html += '\n<script language = "javascript">';
			html += '\n function printWindow()\n{';
			html += '\nwindow.parent.close(); var printReadyEle = document.getElementById("printContent");\nvar shtml = \'<HTML>\\n<HEAD>\\n\';\nif (document.getElementsByTagName != null)\n{\nvar sheadTags = document.getElementsByTagName("head");\nif (sheadTags.length > 0)\nshtml += sheadTags[0].innerHTML;\n}\nshtml += \'</HEAD>\\n<BODY>\\n\';\nif (printReadyEle != null)\n{\n';
			html += 'shtml += \'<form name = frmform1>\';\nshtml += printReadyEle.innerHTML;\n}\nshtml += \'\\n</form>\\n</BODY>\\n</HTML>\';\nvar printWin1 = window.open();\nprintWin1.document.open();\nprintWin1.document.write(shtml);\nprintWin1.document.close();\nprintWin1.print();';
			html += '\n}\n</script>\n</HEAD>\n<BODY>\n';

			var printReadyElement1 = document.getElementById("div1");
			var printReadyElement2 = document.getElementById("div2");
			if (printReadyElement1 != null)
			{
				html += '<form name = frmform>';
				html += '\n<div id = printContent>\n<table cellspacing = 0 cellpadding = 0 width = 100% class=grayBG>\n<tr>\n<td >Source : Mindcracker Network (<a href = "http://www.c-Sharpcorner.com" class = specific>www.c-Sharpcorner.com</a>)</td><td align=right><input type = button value = Print class = CommonTextBoxStyle  onclick = "printWindow();"> </td>\n</tr>\n</table>\n';
				html += '<TABLE cellSpacing=0 cellPadding=10 width=100% border=0>\n<TR>\n<TD class=tblArticleHeadingBG>\n';
				html += printReadyElement1.innerHTML;
				html += '\n</td>\n</tr>\n</table>';
				html += '\n<table cellspacing = 0 cellpadding = 0 width = 100%>\n<tr class=grayBG>\n<td>&nbsp;</td>\n</td>\n</tr>\n</table>\n';
				if(printReadyElement2 != null)
				{
					html += '<TABLE cellSpacing=0 cellPadding=10 width=100% border=0 class=ArticlePublisherBackgroundWhite align = center>\n<TR>\n<TD>\n';
					html += printReadyElement2.innerHTML;
					html += '\n</td>\n</tr>\n</table>\n\n';
					html += '\n<table cellspacing = 0 cellpadding = 0 width = 100%>\n<tr>\n<td class=grayBG>Thank you for using Mindcracker Network</td>\n</tr>\n</table>\n';
				}
				else
				{
					alert("This article doesn't contains any content! Sorry for inconvenience");
					return;
				}
			}
			else
			{
				alert("Could not find the header of the article");
				return;
			}

			html += '\n</div>\n</form>\n</BODY>\n</HTML>';
                
			var printWin = window.open();
			printWin.document.open();
			printWin.document.write(html);
			
		}
		else
		{
			alert("The print ready feature is only available if you are using an browser. Please update your browswer.");
		}
	}