/*For Live Page*/
$(document).ready(function() {

	/********************Add noindex,nofollow*********************************/	
	try{
	$(document).find('a').each(function(){
	  if($(this).attr('id').toString().indexOf('btn') != -1){
                $(this).attr('rel','noindex, nofollow');
            }
        });
	}catch(e){
		alert(e);
	}
	/********************Add noindex,nofollow*********************************/	
     	var pageurl =  $(document.location).attr('href').replace("http://","");
	
	if (pageurl.lastIndexOf("/") == pageurl.length -1)
	{
		pageurl = pageurl.toString().substr(0,pageurl.lastIndexOf("/")) ;
		if(pageurl.indexOf("/") == -1)
			pageurl = "home.aspx";
	}
	pageurl = "/" + pageurl.split("/")[pageurl.split("/").length - 1];
	var sitenavul = $('.sitenavul');
	 if( sitenavul != null){
           $(sitenavul).find("li").each(function(){
                var myurl = $(this).find("a").attr("href");
		if(myurl == pageurl)
                 {
			$(this).removeClass('sitenavli').addClass('sitenavactive');
                 }
            });
        }
	
    /*************************Hide the Current Indexer Link*************************/
    var currenturl = $(location).attr("href");
    $("span.IndexerPage").each(function() {
        if ($(this).find("a").attr("href").toLowerCase() == currenturl.toLowerCase()) {
            $(this).hide(); //hide current link
	   if ($(this).next().is("span"))
	      {
		
		if($(this).next().attr('class').toLowerCase() == 'indexerdescription' || $(this).netx().attr('class').toLowerCase() == 'indexerexcerpt'){
			$(this).next().hide(); //hide first span(this will be indexerdescription or excerpt)
		}
                else{
			$(this).next().hide(); //hide first span(this will be 'indexeritemdets')
			$(this).next().next().hide(); //hide second span(this will be indexerdescription or excerpt )
		}
                
            } else {
                $(this).next().hide(); //hide description or excerpt
            }

        }
    });
    /*************************Hide the Current Indexer Link*************************/
    /*************************Sign Up Email function*************************/
    $('#btnEmailMMMApp').click(function() {
        $('#spanmmmerror').html('');

        var pattern = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
        
        var errmessage = "* Please enter a valid email address";
        var Email = $('#txtEmailMMMApp').val();
      
        if (Email == "") {
            
            
            $('#spanmmmerror').html(errmessage);
            return false;
        }



        if (Email.match(pattern) == '' || Email.match(pattern) == null) {
            
            $('#spanmmmerror').html(errmessage);
            return false;
        }

        $.ajax({
            contentType: "text/html; charset=utf-8",
            data: "Email=" + Email + "&SiteID=6453" + "&action=mymoneyemail",
            url: "/FetchDetails.ashx",
            //url: "myrequesthandler.aspx",
            dataType: "html",
            async: false,
            success: function(data) {
                //alert(data);
                if (data == '1') {
                    $("#div1formmm").css("display", "none");
                    $("#div-overlapformmm").css("display", "");

                }
                else {
                    ret = false;
                    msg = data
                }
            }
        });
        return false;
    });

    $('#txtEmailMMMApp').bind('keypress', function(e) {
        var code = e.keyCode || e.which;
        if (code == 13) { //Enter keycode
            $("#btnEmailMMMApp").click();
        }
    });
    /*************************Sign Up Email function*************************/
});

//function ShowORHideExcerpt(div2hide,div2show)
//	{
//		var div1 = document.getElementById(div2hide);
//		var div2 = document.getElementById(div2show);
//		div1.style.display = 'none';
//		div2.style.display = '';
//	}
//function TrimFunction(str)
//	{
//		return str.replace(/^\s*|\s*$/,'');
//	}
//function ValidateEmailForm(frmlc)
//{
//var pattern = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
//var emailto = frmlc.EmailTo;
//if(emailto != null && emailto != 'undefined')
//{
//	if (emailto.value == "")
//	{alert('Email To cannot be Empty.It is a required field.');
//	return false;
//	}
//	if(emailto.value.match(pattern) == '' || emailto.value.match(pattern) == null)
//	{alert('Email Address is not Valid in Email To Field');
//	return false;}
//}
//var emailfrom = frmlc.EmailFrom;
//if(emailfrom != null && emailfrom != 'undefined')
//{
//	if (emailfrom.value == "")
//	{alert('Email From cannot be Empty.It is a required field.');
//	return false;
//	}
//	if(emailfrom.value.match(pattern) == '' || emailfrom.value.match(pattern) == null)
//	{alert('Email Address is not Valid in Email From Field');
//	return false;}
//}
//return true;
//}
//function ValidateFormElement(frm)
//{
//var hid = document.getElementById("hidRequired");
//var ctlArr = hid.value.split(";"), i;
//var ctlName, ctlType, ctlDesc;
//var ErrSpan = document.getElementById("spnError");
//ErrSpan.innerHTML="";
//var ctlObj;
//for(i=0; i<ctlArr.length; i++)
//{
//ctlName = ctlArr[i].split(":")[0];
//ctlType = ctlArr[i].split(":")[1];
//ctlDesc = ctlArr[i].split(":")[2];
//ctlObj = eval("frm." + ctlName)
//if(ctlType == "textfield" || ctlType == "textarea" || ctlType == "htmlarea" || ctlType == "image" || ctlType == "file")
//{
//if(Trim(ctlObj.value).length==0)
//{
//ErrSpan.innerHTML = "<br>" + ctlDesc + " is a required field.";
//return false;
//}
//}
//else if (ctlType == "link")
//{
//if(Trim(ctlObj.value).length==0)
//{
//ErrSpan.innerHTML = "<br>" + ctlDesc + " is a required field.";
//return false;
//}
//else
//{
//var regex=/^(http|https|ftp):\/\/((?:[a-zA-Z0-9_-]+\.?)+):?(\d*)/;
//if(!(ctlObj.value.match(regex)))
//{
//ErrSpan.innerHTML = "<br>" + ctlDesc + " is invalid URL.";
//return false;
//}
//}
//}
//} 
//if(!(ValidateLinks(frm)))
//return false;
//return true;
//}
//function Trim(str)
//{
//return str.replace(/^\s*|\s*$/,"");
//}
///*For Staged Page*/
//function redirecttoElementEdit(URL){ parent.parentOpenEditElement(URL); return false; }
//function ShowORHideExcerpt(div2hide,div2show)
//	{
//		var div1 = document.getElementById(div2hide);
//		var div2 = document.getElementById(div2show);
//		div1.style.display = 'none';
//		div2.style.display = '';
//	}
// function OpenMenuEdit(URL)
//{ var hostName = window.parent.location.hostname; var appName = window.parent.location.pathname; if(appName.toLowerCase() != '/page.aspx' && appName.toLowerCase().indexOf('/staged/') == -1){appName = appName.substring(1,appName.lastIndexOf('/')); window.parent.open('/' + appName + '/' + URL, null, 'height=610,width=935,top=60,left=10,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no,status=no');} else {window.parent.open('http://' + hostName + '/' + URL, null, 'height=610,width=935,top=60,left=10,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no,status=no'); } }
// function OnHelp()
//{ alert('Help not available for Loud Click POC'); }
// function OnClick(URL)
//{ self.parent.document.getElementById('MainFrame').style.scroll='no'; self.parent.document.getElementById('MainFrame').style.overflow='hidden'; /*self.parent.document.getElementById('MainFrame').style.width='101.8%';*/ var hostName = window.parent.location.hostname; var appName = window.parent.location.pathname; if(appName.toLowerCase() != '/spage.aspx' && appName.toLowerCase().indexOf('/staged/') == -1){appName = appName.substring(1,appName.lastIndexOf('/')); self.location.href='/' + appName + '/' + URL;} else {self.location.href='http://' + hostName + '/' + URL;} }
// function OpenEdit(URL)
//{ window.parent.location.href= '/' + URL; }
// function OpenMenuEdit(URL)
//{ window.parent.location.href= '/' + URL; }
// function OnMouseOver(Element)
//{
// var divElement = document.getElementById(Element);
// divElement.style.backgroundColor = 'EFEFEF'; 
// divElement.style.border = '4pt #848684 dashed'; 
// }
// function OnMouseOut(Element)
//{
// var divElement = document.getElementById(Element);
// divElement.style.backgroundColor = ''; 
// divElement.style.border = '0px'; 
// }
// function OpenHideElement(URL)
//{ window.top.location.href = URL; return false; }
// function OpenDeleteElement(URL)
//{ parent.parentOpenDeleteElement(URL); return false; }
// function OpenSettingsElement(URL)
//{ parent.parentOpenSettingsElement(URL); return false; }
// function OpenMoveUp()
//{ alert('You Clicked on MoveUp Element Button'); }
// function OpenMoveDown()
//{ alert('You Clicked on MoveDown Element Button'); }
// function AddElement(URL)
//{ window.top.location.href = URL; return false; }
//function ValidateEmailForm(frmlc)
//{
//	alert('You can send Email on Live Page.');
//	return false;
//}function ShowUpgradeWin(url)
//{ var oMgr=window.top.GetRadWindowManager();
// if(oMgr!=null) 
// { oMgr.Open(url,"UpgradeWindow") }
//return false }
//function ValidateFormElement(frmpage)
//{
//	alert('You can Submit on Live Page.');
//	return false;
//}

