function Protect()
{
	sURLTOGO=replacestring(sURLTOGO,"&","--amp--"); // escape & for those URL containing & in it.
	sURLTOGO=replacestring(sURLTOGO,"?","--que--")
	var iActivityAlreadyStored=0  //LEAVE THIS ALWAYS AS FALSE NAND LET MEMBERONLY TAKE CARE OF ITS LAST STATUS... 
	
	
	
	document.write ("<body topmargin=0><iframe name=iframeProtect border=0 frameborder=0 width=" + sWidth + " height=" + sHeight + " src='http://www.islamicity.com/m/memberOnly.asp?Return="+sURLTOGO+"&PreviewTimeInMinutes=" + iPreviewTimeInMinutes + "&MemberOnlyProgramCaption="+sMemberOnlyProgramCaption+"&FrequencyInSeconds="+iFrequencyInSeconds+"&Activity2BStored=" + iActivity2BStored  + "&ActivityAlreadyStored=" + iActivityAlreadyStored + "&FrequencyInSecondsAfterLogin=" + iFrequencyInSecondsAfterLogin + "&ProtectType=" + sProtectType + "&ProtectPCount=" + sProtectPCount + "&TrackInGlobalASA=" + iTrackInGlobalASA + "'></iframe>")
	
}	

function rightOf(smstring,lrgstring) {
	//returns the rightmost characters of lrgstring back to smstring.
	//If user passes an empty string, change that to a space.
	if (smstring == ""){smstring = " "}
	strlen1 = smstring.length
	strlen2 = lrgstring.length
	foundat = 0
	for (i=strlen2;i>=0;i--) {
		comp=lrgstring.substring(i-1,strlen2)
		comp = comp.substring(0,strlen1)		
		if (comp == smstring) {
			foundat = i
			break
		}
	}
	return lrgstring.substring(foundat,255)
}


function leftOf(smstring,lrgstring) {
//returns leftmost characters of lrgstring up to smstring.
//If user passes an empty string, change that to a space.
if (smstring == ""){smstring = " "}
strlen1 = smstring.length
strlen2 = lrgstring.length
foundat = 0
for (i=0;i<=strlen2;i++) {
	comp=lrgstring.substring(i-1,strlen2)
	comp = comp.substring(0,strlen1)		
	if (comp == smstring) {
		foundat = i
		break
	}
}
return lrgstring.substring(0,(foundat-1))
}
function replacestring(sFull, sOld, sNew) 
{
	var sData = "";
	for (var i=0; i<sFull.length; i++) 
	{
		if (sFull.substring(i,i+sOld.length) == sOld) 
		{
			sData = sData + sNew;
			i = i + sOld.length - 1;
		} 
		else 
		{ 
			sData = sData + sFull.substring(i,i+1) 
		}
	}
	return sData;
}

