﻿/*Function for the jcarousel scroll*/
function jscroll()
{
    jQuery(document).ready(function() {
	  jQuery('#search-carousel').jcarousel({
	    horizontal: true,
        scroll:5
    });
    });
    
      jQuery(document).ready(function() {
	  jQuery('#invite-carousel').jcarousel({
	    horizontal: true,
        scroll:5
    });
    });
     jQuery(document).ready(function() {
	  jQuery('#search-carousel-down').jcarousel({
	    horizontal: true,
        scroll:5
    });
    });
    jQuery(document).ready(function() {
	  jQuery('#sponsored-carousel').jcarousel({
	    horizontal: true,
        scroll:5
    });
    });
    jQuery(document).ready(function(){
        jQuery('#charitable-carousel').jcarousel({
        horizontal: true,
        scroll:5
    });
    });
    jQuery(document).ready(function(){
        jQuery('#invite-carousel1').jcarousel({
        horizontal: true,
        scroll:5
    });
    });
    jQuery(document).ready(function(){
        jQuery('#invite-carousel11').jcarousel({
        horizontal: true,
        scroll:5
    });
    });
    
    jQuery(document).ready(function(){
        jQuery('#chat-carousel11').jcarousel({
        horizontal: true,
        scroll:5
    });
    });
    
     jQuery(document).ready(function(){
        jQuery('#chat-carousel5').jcarousel({
        horizontal: true,
        scroll:5
    });
    });
    jQuery(document).ready(function(){
        jQuery('#friends-carousel').jcarousel({
        horizontal: true,
        scroll:5
    });
    });
     jQuery(document).ready(function(){
        jQuery('#invite-carousel3').jcarousel({
        horizontal: true,
        scroll:5
    });
    });
    
    jQuery(document).ready(function(){
        jQuery('#invite-carousel21').jcarousel({
        horizontal: true,
        scroll:5
    });
    });
    
    jQuery(document).ready(function(){
        jQuery('#suser-carousel').jcarousel({
        horizontal: true,
        scroll:5
    });
    });
    
    jQuery(document).ready(function(){
        jQuery('#suser-carousel-down').jcarousel({
        horizontal: true,
        scroll:5
    });
    });
}
/*ends here*/

/*Base64 Encoding starts here*/
var Base64 = {

    // private property
    _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",

    // public method for encoding
    encode : function (input) {
        var output = "";
        var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
        var i = 0;
        

        input = Base64._utf8_encode(input);

        while (i < input.length) {
            
            chr1 = input.charCodeAt(i++);
            chr2 = input.charCodeAt(i++);
            chr3 = input.charCodeAt(i++);

            enc1 = chr1 >> 2;
            enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
            enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
            enc4 = chr3 & 63;

            if (isNaN(chr2)) {
                enc3 = enc4 = 64;
            } else if (isNaN(chr3)) {
                enc4 = 64;
            }

            output = output +
            this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
            this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);

        }

        return output;
    },

    // public method for decoding
    decode : function (input) {
        var output = "";
        var chr1, chr2, chr3;
        var enc1, enc2, enc3, enc4;
        var i = 0;

        input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

        while (i < input.length) {

            enc1 = this._keyStr.indexOf(input.charAt(i++));
            enc2 = this._keyStr.indexOf(input.charAt(i++));
            enc3 = this._keyStr.indexOf(input.charAt(i++));
            enc4 = this._keyStr.indexOf(input.charAt(i++));

            chr1 = (enc1 << 2) | (enc2 >> 4);
            chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
            chr3 = ((enc3 & 3) << 6) | enc4;

            output = output + String.fromCharCode(chr1);

            if (enc3 != 64) {
                output = output + String.fromCharCode(chr2);
            }
            if (enc4 != 64) {
                output = output + String.fromCharCode(chr3);
            }

        }

        output = Base64._utf8_decode(output);

        return output;

    },

    // private method for UTF-8 encoding
    _utf8_encode : function (string) {
        string = string.replace(/\r\n/g,"\n");
        var utftext = "";

        for (var n = 0; n < string.length; n++) {

            var c = string.charCodeAt(n);

            if (c < 128) {
                utftext += String.fromCharCode(c);
            }
            else if((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            }
            else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }

        }

        return utftext;
    },

    // private method for UTF-8 decoding
    _utf8_decode : function (utftext) {
        var string = "";
        var i = 0;
        var c = c1 = c2 = 0;

        while ( i < utftext.length ) {

            c = utftext.charCodeAt(i);

            if (c < 128) {
                string += String.fromCharCode(c);
                i++;
            }
            else if((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i+1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            }
            else {
                c2 = utftext.charCodeAt(i+1);
                c3 = utftext.charCodeAt(i+2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }

        }

        return string;
    }

}
/*encoding ends here*/

var content = "ctl00_ContentPlaceHolder1_";
 //var siteURL = "http://localhost/mysomeday/";
//var siteURL = "http://www.mysomedaytest.com/";
var siteURL = "http://www.mysomeday.com/";


/*Check the Gender*/
function checkGender(flag)
{
    var chkMale = document.getElementById(content + "chkMale");
    var chkFemale = document.getElementById(content + "chkFemale");
    if(flag == 0)
    {
        if (chkFemale.checked == true)
        chkFemale.checked = false;
    }
    else 
    {
        if(chkMale.checked == true)    
        chkMale.checked = false;
    }   
    return true;
}
/*End Check the Gender*/

/*Login Layer*/
function getPageSize(i){

	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	

	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}


    // for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}

    var paghg;
    paghg =  windowHeight + yScroll;
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
    if(navigator.userAgent.indexOf("Firefox")!=-1)
    {
        pageWidth = pageWidth - 17;   
    }
    if(i!=''){
    document.getElementById('fade').style.width = (pageWidth + 'px');
    document.getElementById('fade').style.height =  (pageHeight + 'px');
    }
   
    if(i == 2)
    {
        document.getElementById('fade_long_img').style.width = (pageWidth + 'px');
        document.getElementById('fade_long_img').style.height =  (pageHeight + 'px');
    }
}

function getWindowSize(){
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	

	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

    // for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}

    var paghg;
    paghg =  windowHeight + yScroll;
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
    if(navigator.userAgent.indexOf("Firefox")!=-1)
    {
        pageWidth = pageWidth - 17;   
    }
    
        document.getElementById(content + "width_window").value = (pageWidth + 'px');       
        document.getElementById(content + "ht_window").value=  (pageHeight + 'px');
}
/*ends here*/


/*Login Validation*/
var specialchar = "#";
function loginValidate()
{
    document.getElementById("subbutton").style.visibility="hidden"; 
    document.getElementById("imgpreloader").style.visibility="visible";
    
    for (var i = 0; i < document.getElementById("ctl00_rigth_uname").value.length; i++) {
    if (specialchar.indexOf(document.getElementById("ctl00_rigth_uname").value.charAt(i)) != -1)
    {
        alert(geterrmsg('e512'));
        document.getElementById("ctl00_rigth_uname").focus();
        document.getElementById("subbutton").style.visibility="visible"; 
        document.getElementById("imgpreloader").style.visibility="hidden";
        return false;     
    }    
    }
    if(removeSpaces(document.getElementById("ctl00_rigth_uname").value)=="")
    {
        alert(geterrmsg('e46'));
        document.getElementById("ctl00_rigth_uname").focus();
        document.getElementById("subbutton").style.visibility="visible"; 
        document.getElementById("imgpreloader").style.visibility="hidden";
        return false;
    }
    if(removeSpaces(document.getElementById("ctl00_rigth_pword").value)=="")
    {
        alert(geterrmsg('e43'));
        document.getElementById("ctl00_rigth_pword").focus();
        document.getElementById("subbutton").style.visibility="visible"; 
        document.getElementById("imgpreloader").style.visibility="hidden";
        return false;
    }
    loginCheck("1",document.getElementById("ctl00_rigth_uname").value,document.getElementById("ctl00_rigth_pword").value,document.getElementById("ctl00_chk_remember").checked,'nonmember');
}
/*ends here*/

function loginValidateWelcome()
{
    document.getElementById("welcombtn").style.visibility="hidden"; 
    document.getElementById("welcomepl").style.visibility="visible";
    
    for (var i = 0; i < document.getElementById("ctl00_rigth_uname1").value.length; i++) {
    if (specialchar.indexOf(document.getElementById("ctl00_rigth_uname1").value.charAt(i)) != -1)
    {
        alert(geterrmsg('e512'));
        document.getElementById("ctl00_rigth_uname1").focus();
        document.getElementById("welcombtn").style.visibility="visible"; 
        document.getElementById("welcomepl").style.visibility="hidden";
        return;     
    }    
    }
    if(removeSpaces(document.getElementById("ctl00_rigth_uname1").value)=="")
    {
        alert(geterrmsg('e46'));
        document.getElementById("ctl00_rigth_uname1").focus();
        document.getElementById("welcombtn").style.visibility="visible"; 
        document.getElementById("welcomepl").style.visibility="hidden";
        return;
    }
    if(removeSpaces(document.getElementById("ctl00_rigth_pword1").value)=="")
    {
        alert(geterrmsg('e43'));
        document.getElementById("ctl00_rigth_pword1").focus();
        document.getElementById("welcombtn").style.visibility="visible"; 
        document.getElementById("welcomepl").style.visibility="hidden";
        return;
    }
    loginCheck("1",document.getElementById("ctl00_rigth_uname1").value,document.getElementById("ctl00_rigth_pword1").value,document.getElementById("ctl00_chk_remember1").checked,'welcome');
}



//login validation for members
function loginValidateMembers(btnid,preloadid)
{
    document.getElementById(btnid).style.visibility="hidden"; 
    document.getElementById(preloadid).style.visibility="visible";

    for (var i = 0; i < document.getElementById(content + "rigth_uname").value.length; i++) {
    if (specialchar.indexOf(document.getElementById(content + "rigth_uname").value.charAt(i)) != -1)
    {
        alert(geterrmsg('e512'));
        document.getElementById(content + "rigth_uname").focus();
        document.getElementById(btnid).style.visibility="visible"; 
        document.getElementById(preloadid).style.visibility="hidden";
        return;     
    }    
    }
    if(removeSpaces(document.getElementById(content + "rigth_uname").value)=="")
    {
        alert("Please enter a Username to login");
        document.getElementById(content + "rigth_uname").focus();
        document.getElementById(btnid).style.visibility="visible"; 
        document.getElementById(preloadid).style.visibility="hidden";
        return;

    }
    if(removeSpaces(document.getElementById(content + "rigth_pword").value)=="")
    {
        alert("Please enter a Password to login");
        document.getElementById(content + "rigth_pword").focus();
        document.getElementById(btnid).style.visibility="visible"; 
        document.getElementById(preloadid).style.visibility="hidden";
        return;
    }
    
    
    if(document.getElementById(content + "chk_remember")== null)
    {
        checkrem = false;
    }
    else
    {
        checkrem = false;
        if(document.getElementById(content + "chk_remember").checked == true) checkrem = true;
    }
  if(btnid="sbtnid") loginCheck("2",document.getElementById(content + "rigth_uname").value,document.getElementById(content + "rigth_pword").value,checkrem,'member');
  if (btnid = "buttonid") loginCheck("1", document.getElementById(content + "rigth_uname").value, document.getElementById(content + "rigth_pword").value, checkrem, 'member');
  
}

//login validation for members
function loginValidateMembersSomeday(btnid, preloadid) {
    document.getElementById(btnid).style.visibility = "hidden";
    document.getElementById(preloadid).style.visibility = "visible";

    for (var i = 0; i < document.getElementById(content + "rigth_uname").value.length; i++) {
        if (specialchar.indexOf(document.getElementById(content + "rigth_uname").value.charAt(i)) != -1) {
            alert(geterrmsg('e512'));
            document.getElementById(content + "rigth_uname").focus();
            document.getElementById(btnid).style.visibility = "visible";
            document.getElementById(preloadid).style.visibility = "hidden";
            return;
        }
    }
    if (removeSpaces(document.getElementById(content + "rigth_uname").value) == "") {
        alert("Please enter a Username to login");
        document.getElementById(content + "rigth_uname").focus();
        document.getElementById(btnid).style.visibility = "visible";
        document.getElementById(preloadid).style.visibility = "hidden";
        return;

    }
    if (removeSpaces(document.getElementById(content + "rigth_pword").value) == "") {
        alert("Please enter a Password to login");
        document.getElementById(content + "rigth_pword").focus();
        document.getElementById(btnid).style.visibility = "visible";
        document.getElementById(preloadid).style.visibility = "hidden";
        return;
    }


    if (document.getElementById(content + "chk_remember") == null) {
        checkrem = false;
    }
    else {
        checkrem = false;
        if (document.getElementById(content + "chk_remember").checked == true) checkrem = true;
    }
    
    if (btnid = "buttonidSomeday") loginCheck("3", document.getElementById(content + "rigth_uname").value, document.getElementById(content + "rigth_pword").value, checkrem, 'member');
}

function loginCheck(strpagecheck,struname,strpword,chk_checked,memberst)
{ 
    xmlHttp=getXmlHttpObject();
    if (xmlHttp==null)
    {
        alert(geterrmsg('e51'));
        return;
    } 
    var url="/login_layer.aspx";
    url = url + "?usernam=" + struname + "&password=" + Base64.encode(strpword) + "&checked=" + chk_checked + "&pgchk=" + strpagecheck + "&memst=" + memberst;    
    makePOSTRequest(url,"",'163');

}

function callClear()
{
    document.getElementById('ctl00_rigth_uname').value = "";
    document.getElementById('rigth_pword').value = "";
    document.getElementById('ctl00_chk_remember').checked=false;
}

function loginStateChanged() 
{ 
    if (http_request.readyState==4)
	{ 		
	  if (http_request.status == 200)
	  {
	    result = http_request.responseText.split("^^^^");
	        if (result[0] == "1")
		    {
		       window.location.reload(true); 
		    }
		    else if(result[0] == "2")
		    {
		        document.location ="/UserProfile.aspx";
		    }
		    else if (result[0] == "3") {
		        document.location = "/Addasomeday.aspx";
		    }
		     else if(result[0] == "4")
		    {
		        callConfirmMessage();
		    }
		    else
		    {
		        alert(geterrmsg('e48'));
		       if (result[1] == "nonmember")
		       {
		        document.getElementById("subbutton").style.visibility="visible";
                document.getElementById("imgpreloader").style.visibility="hidden";
                document.getElementById("ctl00_rigth_uname").focus();
                }
                else if (result[1] == "member")
                {
                document.getElementById("buttonid").style.visibility="visible"; 
                document.getElementById("imgpreload").style.visibility="hidden";
                document.getElementById("ctl00_ContentPlaceHolder1_rigth_uname").focus();
                }
                else if (result[1] == "welcome")
                {
                    document.getElementById("welcombtn").style.visibility="visible"; 
                    document.getElementById("welcomepl").style.visibility="hidden";
                    document.getElementById("ctl00_rigth_uname1").focus();
                }
                else if (result[1] == "copysomeday") {
//                    document.getElementById("welcombtn").style.visibility = "visible";
//                    document.getElementById("welcomepl").style.visibility = "hidden";
                document.getElementById(content + "rigth_uname2").focus();
                }
            } 
       }
	}
}
/*ends here*/

/*Log Out Section*/
function loggedOut()
{
    xmlHttp=getXmlHttpObject();
    if (xmlHttp==null)
    {
        alert(geterrmsg('e51'));
        return;
    } 
    var url="/logout.aspx";
    makePOSTRequest(url,"",'164');

}

function loginOutStateChanged()
{
    if (http_request.readyState==4)
	{ 		
	  if (http_request.status == 200)
	  {
	        result = http_request.responseText;
	        if (result == "1")
		    {
		        window.location= "/Default_home.aspx"
		    }
       }
	}
}

/*ends here*/

function getXmlHttpObject()
{
	var xmlHttp=null;
	try
	  {
		  // Firefox, Opera 8.0+, Safari
		  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
		  // Internet Explorer
		  try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
		  catch (e)
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
	  }
	return xmlHttp;
}



/* Forget Password Layer */
function forgetPassEmail()
{   
    document.getElementById("forgetmail").style.display ="none";
    document.getElementById("preload").style.display ="block";

    if(document.getElementById("ctl00_rigth_email").value=="")
    {
        alert(geterrmsg('e9'));
        document.getElementById("ctl00_rigth_email").focus();
        document.getElementById("forgetmail").style.display ="block";
        document.getElementById("preload").style.display ="none";
        return false;
    }
    
    if (validateEmail(document.getElementById("ctl00_rigth_email").value) == false)
    {
        alert(geterrmsg('e23'));
        document.getElementById("forgetmail").style.display ="block";
        document.getElementById("preload").style.display ="none";
        return false;
    }
    
    sendEmail(document.getElementById("ctl00_rigth_email").value);
}

function sendEmail(stremailId)
{ 
    xmlHttp=getXmlHttpObject();
    if (xmlHttp==null)
      {
          alert (geterrmsg('e51'));
          return;
      } 
    var url="/ForgetPassword-Layer.aspx";
    url=url+"?email="+stremailId;
    makePOSTRequest(url,'','165');

}

function emailStateChanged() 
{ 
    if (http_request.readyState==4)
	{ 		
	  if (http_request.status == 200)
	  {
	        result = http_request.responseText;
		   		    
	        if (result == "1")
		    {
		        alert(geterrmsg('e164')); //alert(geterrmsg('e49'));
		        document.getElementById("ctl00_rigth_email").value="";
		        window.location.reload(); 
		    }
		    else
		    {
		        alert(geterrmsg('e49')); //alert(geterrmsg('e164'));
		        document.getElementById("ctl00_rigth_email").value="";
		        document.getElementById("ctl00_rigth_email").focus();
		        document.getElementById("forgetmail").style.display ="block";
                document.getElementById("preload").style.display ="none";
		    }
       }
	}
}
/* End of Forgot Pass */


/*Call Copy this Plan layer - Someday owner */


function copyPlanToSomeday(pPlanId,puser) {   
    var pSomedayId =  document.getElementById('ctl00_ContentPlaceHolder1_inphid').value;
    var ownerCopiedFromID = document.getElementById('ctl00_ContentPlaceHolder1_hdnSDOwnerId').value;
    var Somedaycopiedfor = document.getElementById('ctl00_ContentPlaceHolder1_pksdcopiedfor').value;
    var planforid = document.getElementById('ctl00_ContentPlaceHolder1_pkplancopiedfor').value;   
        xmlHttp=getXmlHttpObject();
        if (xmlHttp==null)
          {
              alert (geterrmsg('e51'));
              return;
          }         
          var url = "/ajax-copyPlan.aspx";
          url = url + "?someday=" + pSomedayId + "&plan=" + pPlanId + "&user=" + puser + "&ownercopiedfrom=" + ownerCopiedFromID + "&somedaycopiedto=" + Somedaycopiedfor + "&plancopiedto=" + planforid;         
        makePOSTRequest(url,'','166');
}

function copyPlanStateChanged() 
{ 
   if (http_request.readyState==4)
    { 	
	  if (http_request.status == 200)
	  { 
	        var encoderesult=http_request.responseText;
	        result= encoderesult.split('=')[1];
	        encoderesult=Base64.encode(http_request.responseText)
	        if (result != "")
	        {
	            if (result == "1")
	            {
		         alert(geterrmsg('e64'));
		         window.location.reload();
		        }
		        else{
		        alert('Plan Copied');
		        //window.location="/SomedayOwner.aspx?plan="+encoderesult;
		        window.location = result;
		        }
		        
		    }
		    else
		    {
		        alert(geterrmsg('e67'));  
		        document.getElementById('div_copyplan').focus;     
		        
		    }
       }
	}
}


/* Copy this Plan layer ends here*/

/*Call Contact Me layer - Someday owner */
function callContactMeLayer()
{
    document.getElementById('id_forgotpass').style.display='none';
    document.getElementById('id_contactMe').style.display='block';
    document.getElementById('fade').style.display='block';
    alertSize();
    document.getElementById('id_contactMe').style.left=(parseInt(myWidth/2) - 213) + "px";
    window.scrollTo(0,0);
}

function closeContactMeLayer()
{
    document.getElementById('txt_contactmessage').value="";
    document.getElementById('id_forgotpass').style.display='none';
    document.getElementById('id_contactMe').style.display='none';
    document.getElementById('fade').style.display='none';
}

function contactMessage(pToOwnerEmail,pfromEmail)
{
    document.getElementById("submitcontact").style.display="none"; 
    document.getElementById("preloadcontact").style.display="block";
    
    var valid=true;    
    
    var errorstr="The following fields are incomplete:" +  '\r\n' ;

    if (wsTrim(document.getElementById("ctl00_ContentPlaceHolder1_txt_subject").value) == "")
    {
        errorstr=errorstr +'\r\n' + geterrmsg('e516');
        valid=false;
    }
    
    
    if(wsTrim(document.getElementById("txt_contactmessage").value) == "")
    {
        errorstr=errorstr +'\r\n' + geterrmsg('e56');
        valid=false;   
    }
   
    if(valid==false)
    {
        errorstr=errorstr +  '\r\n';
        alert(errorstr);
        document.getElementById("submitcontact").style.display="block"; 
        document.getElementById("preloadcontact").style.display="none";
    }
    else
    {
         var docsubject = document.getElementById('ctl00_ContentPlaceHolder1_txt_subject').value;
         var docmessage = document.getElementById('txt_contactmessage').value;
         docmessage = docmessage.replace(new RegExp("\\n", "g"), "*****");
         var somedayid=document.getElementById('ctl00_ContentPlaceHolder1_hdnSomedayId').value;
         sendMsgContact(docsubject,docmessage,somedayid,pfromEmail,pToOwnerEmail);
         document.getElementById('ctl00_ContentPlaceHolder1_txt_subject').value = '';
         document.getElementById('txt_contactmessage').value = '';
    }
   return valid;
}


function sendMsgContact(strsubject,strmessage,strsomedayid,strFrom,strTo)
{ 
    xmlHttp9=getXmlHttpObject();
    if (xmlHttp9==null)
      {
          alert (geterrmsg('e51'));
          return;
      } 
    var url="/SendContactMessage.aspx";
    var param='subject='+strsubject+'&message='+strmessage+'&strsomedayid='+strsomedayid+'&strFrom='+strFrom+'&strTo='+strTo;
    makePOSTRequest(url,param,'167');
}

function sendContactStateChanged() 
{ 
    if (http_request.readyState==4)
	{ 		
	  if (http_request.status == 200)
	  {
	        result = http_request.responseText;
	        if (result == "1")
		    {
		        alert(geterrmsg('e57'));
		        window.location.reload(); 
		    }
		    else
		    {
		        alert(geterrmsg('e50'));
		        document.getElementById("txt_contactmessage").value="";
		    }
       }
	}
}

function selectChkBox(controlid) /*CHANGED ON 30DEC 2008*/
{
    var content1=controlid.split("_chk")[0]
    for (i = 0; i < 10; i++)
    {
        var chkSelect = content + "dtlImageLib_ctl0"+i+"_chkSelection";
        
      
        if (controlid==chkSelect)
        {
        
           if(document.getElementById(controlid).checked == true)
           {
                document.getElementById(controlid).checked = true;
           }
           else
           {
                document.getElementById(controlid).checked = false;
           }
        }
        else
        {
            if(document.getElementById(chkSelect) != null)
            {
                document.getElementById(chkSelect).checked = false;
            }
        }
    }
    document.getElementById("ctl00_ContentPlaceHolder1_Flag").value="1";  
    document.getElementById("ctl00_ContentPlaceHolder1_SelectedImage").value = document.getElementById(controlid).value;    
    document.getElementById(content + "img_input").value=""; 
    document.getElementById("ctl00_ContentPlaceHolder1_span_thumbnail").style.display = 'none';
    document.getElementById("ctl00_ContentPlaceHolder1_Img_thumb").src="";
}

function callAlert()
{
    for (i = 0; i < 10; i++)
    {
       var chkSelect = content + "dtlImageLib_ctl0" + i + "_chkSelection";
       document.getElementById(chkSelect).checked = false;
    }
}


function selecionatudo(check,n) 
{
    for (i=0;i<5;i++) {
        if (check) {
            document.form1.chbx[i].checked=false;
        }
    }
   document.form1.chbx[n-1].checked=true;
}


/* End AddSomeday - Datalist  */

/* Plan Your Someday - toggle */
function updateStepStatus(varmode,stepid,paramStep)
{
    xmlHttp=getXmlHttpObject();  
    if (xmlHttp==null)
      {
          alert (geterrmsg('e51'));
          return;
      } 
  
    var poststr="/update-steps.aspx";
    poststr=poststr + "?mode=" + varmode + "";
    poststr=poststr + "&param="+paramStep;    
    poststr=poststr + "&status="+document.getElementById('hdnstepstatus_'+stepid).value;
    makePOSTRequest(poststr,'',168);

}

function displayPlanSteps()
{ 
    
  if (http_request.readyState == 4) 
  {  
	 if (http_request.status == 200) 
	 {
	    result = http_request.responseText;	     
		rec_count=result.split("^^^^");
		var hostname= "http://"+window.location.host;  
		if(document.getElementById('img_'+ rec_count[0] ).src == hostname+"/images/green.gif")
		{
		    document.getElementById('img_'+ rec_count[0] ).src = siteURL + "images/red.gif";
		    document.getElementById('hdnstepstatus_'+rec_count[0]).value="1";	
		}		
		else if(document.getElementById('img_'+ rec_count[0] ).src == hostname+"/images/red.gif")
		{
		    document.getElementById('img_' + rec_count[0]).src = siteURL + "images/green.gif";
		    document.getElementById('hdnstepstatus_'+rec_count[0]).value="0";	
		}
		if (document.getElementById('bindprog-meter') != null)
		{
		    document.getElementById('bindprog-meter').innerHTML = rec_count[1];
		}
		document.forms[0].reset();
		if (rec_count[2] != null && parseInt(rec_count[2]) == 100) {		    
		    getPageSize(1);
		    callSomedayCongratsLayer();
		}
		
	 } else 
	 {
		alert(geterrmsg('e52'));
	 }
  }
}
/* End Plan Your Someday - toggle */

/*Upload Photo video */

function addFileUploads()
{  
        var load;
        var ni = document.getElementById("selectTargetCenter");
        var numi = document.getElementById(content+"tot_count");
        
        num = eval(document.getElementById(content+"tot_count").value)+ 1;
        
        numi.value = num;
        var divIdName = "my"+num+"Div";
        var controlId = "control"+num;
        
        var newdiv = document.createElement('span');
        newdiv.setAttribute("id",divIdName);
        newdiv.innerHTML = "<table><tr><td><input type=\"file\" name=\"file_" + num + "\" id=\"file_" + num + "\" title=\"Upload\" onchange=\"javascript:return validateFileExtension(this)\" /></td><td><a id=\"a_add" + num + "\" title=\"Add Another File\" href=\"javascript:addFileUploads()\"  ><span  class=\"font-type1 fontcolor4 font1 marg-left-8\">Add Another File<span/></a><span  class=\"font-type1 fontcolor4 font1 marg-left-8\"><a id=\"a_remove" + num + "\" href=\"javascript:removeFileUploads('"+divIdName+"','"+num+"')\" title=\"Remove\">Remove</a></span></td></tr></table>";
        ni.appendChild(newdiv);
}

function addFileUploadsOnload()
{
        document.getElementById(content+"tot_count").value=0;
        document.getElementById(content+"hdn_uploads").value = "";
        
        var load;
        var ni = document.getElementById("selectTargetCenter");
        var numi = document.getElementById(content+"tot_count");
        
        num = eval(document.getElementById(content+"tot_count").value)+ 1;
        numi.value = num;
                
        var divIdName = "my"+num+"Div";
        var controlId = "control"+num;
        
        var newdiv = document.createElement('span');
        newdiv.setAttribute("id",divIdName);
        newdiv.innerHTML = "<table><tr><td><input type=\"file\" name=\"file_" + num + "\" id=\"file_" + num + "\" title=\"Upload\" onchange=\"javascript:return validateFileExtension(this)\"  /></td><td><a id=\"a_add" + num + "\" href=\"javascript:addFileUploads()\" title=\"Add Another File\"><span class=\"font-type1 fontcolor4 font1 marg-left-8\">Add Another File</span></a></td></tr></table>";
        ni.appendChild(newdiv);
}

function removeFileUploads(delDiv,num)
{
        var ni = document.getElementById("selectTargetCenter");
        ni.removeChild(document.getElementById(delDiv));
        document.getElementById(content+"tot_count").value = num-1;
}

function getFileNames()
{
        var cnt= document.getElementById(content+"tot_count").value;
             
        for(var i = 1; i<=cnt; i++)
        {
            document.getElementById(content+"hdn_uploads").value += document.getElementById("file_"+i).value + ',';
        }
       document.forms[0].submit();
}


/*End of Upload PV*/

/* validation File Upload - new 21Aug */
function validateFileExtension(fld) 
{
    if(!/(\.gif|\.jpg|\.jpeg|\.wmv|\.flv|\.avi|\.mpeg|\.mpg|\.3gp)$/i.test(fld.value)) 
    {
	    alert(geterrmsg('e53'));
	    fld.form.reset();
	    fld.focus();
	    return false;
    }
    return true;
}

function validateImageExtension(fld) 
{
    if(!/(\.gif|\.jpg|\.jpeg)$/i.test(fld.value)) 
    {
	    fld.form.reset();
	    fld.focus();
	    return false;
    }
    return true;
}
function validateVideoExtension(fld) 
{
    if(!/(\.mov|\.mpg|\.asf|\.amr-nb|\.avi|\.mp4|\.mp3|\.movieclip|\.flv|\.3gp|\.wav|\.mod|\.mpeg|\.dv|\.wma|\.3g2|\.wmv|\.qt|\.gcelp)$/i.test(fld.value)) 
    {
	    fld.form.reset();
	    fld.focus();
	    return false;
    }
    return true;
}
function validateVideoFileExtension(fld) 
{
   
    if(!/(\.avi|\.flv|\.mpeg|\.mov|\.mpg|\.3gp|\.3g2|\.3g3)$/i.test(fld.value)) 
    {
	    fld.form.reset();
	    fld.focus();
	    return false;
    }
    return true;
}
/* End validation File Upload  */

/*Paging in profile page*/

/*for paging of Somedays in a user profile*/
function pageDataProfile(flag,somedaytype,pgno,userid,pgcount,recordsperpage,frompage)
{
        var recordsper = recordsperpage;
     
        var url_arg;
        url_arg = "userid=" + userid + "&pgcount=" + pgcount + "&perpage=" + recordsper + "&currentpg=" + pgno + "&somedaytype=" + somedaytype + "&frompg=" + frompage + "";
        makePOSTRequest('/AjaxSomeday-profile.aspx?enc=' + Base64.encode(url_arg), '', '1');     
}

/*New function for paging of Somedays in a user profile*/
function pageDataProfileNew(flag, somedaytype, pgno, userid, pgInprogressCount, pgneedplanCount, pgachievedCount, pgviewallCount, recordsperpage, frompage) {
    var recordsper = recordsperpage;

    var url_arg;
    url_arg = "userid=" + userid + "&pgInprogressCount=" + pgInprogressCount + "&pgneedplanCount=" + pgneedplanCount + "&pgachievedCount=" + pgachievedCount + "&pgviewallCount=" + pgviewallCount + "&perpage=" + recordsper + "&currentpg=" + pgno + "&somedaytype=" + somedaytype + "&frompg=" + frompage + "";
    makePOSTRequest('/AjaxSomeday-profile.aspx?enc=' + Base64.encode(url_arg), '', '1');
}

/*for paging of Open invitations in a user profile*/
function pageDataOpenInvite(flag,pgno,userid,pgcount,recordsperpage,chkmiles)
{
        var recordsper = recordsperpage;
        var miles = chkmiles;
        
        var url_arg;
        url_arg = "userid=" + userid + "&pgcount=" + pgcount + "&perpage=" + recordsper + "&currentpg=" + pgno + "&chkmiles=" + miles + "";
        makePOSTRequest('/AjaxInvitation-profile.aspx?enc=' + Base64.encode(url_arg), '', '2');            
}
/*ends here*/


/*paging for Charitable somedays in user profile/other's user profile*/
function pageDataCharitablesd(pgno,userid,pgcount,recordsperpage)
{
        var recordsper = recordsperpage;
        var url_arg;
        url_arg = "userid=" + userid + "&pgcount=" + pgcount + "&perpage=" + recordsper + "&currentpg=" + pgno + "";
        makePOSTRequest('/AjaxCharitable-profile.aspx?enc=' + Base64.encode(url_arg), '', '6');            
}
/*ends here*/

/*Paging Homepage*/

/*for paging of featured somedays in home page*/
function pageDataHome(flag,somedaytype,pgno,pgcount,recordsperpage)
{
        var recordsper = recordsperpage;
        var url_arg;
        url_arg = "pgcount=" + pgcount + "&perpage=" + recordsper + "&currentpg=" + pgno + "&somedaytype=" + somedaytype + "";        
        makePOSTRequest('/ajaxHome-featuredsomedays.aspx?enc=' + Base64.encode(url_arg), '', '4');
    }


    /*for paging of featured somedays in home page new function*/
    function pageDataHomeNew(flag, somedaytype,pgno,pgInprogressCount,pgneedplanCount,pgachievedCount,pgViewallCount, recordsperpage) {
        var recordsper = recordsperpage;
        var url_arg;
        url_arg = "pgInprogressCount=" + pgInprogressCount + "&pgneedplanCount=" + pgneedplanCount + "&pgachievedCount=" + pgachievedCount + "&pgViewallCount=" + pgViewallCount + "&perpage=" + recordsper + "&currentpg=" + pgno + "&somedaytype=" + somedaytype + "";
        makePOSTRequest('/ajaxHome-featuredsomedays.aspx?enc=' + Base64.encode(url_arg), '', '4');
    }

/*for paging of sponsored somedays in home page*/
function pageDataHomeSponsored(flag,pgno,pgcount,recordsperpage)
{
        var recordsper = recordsperpage;
        var url_arg;
        
        url_arg = "pgcount=" + pgcount + "&perpage=" + recordsper + "&currentpg=" + pgno + "";
        makePOSTRequest('/ajax-sponsoredsomday-home.aspx?enc=' + Base64.encode(url_arg), '', '5');          
}

/*ends here*/

/*Plan Your Someday -Rel Sponsored Rel Commu Paging*/
function pageDataRelSpon(pgno,pgcount,recordsperpage,searchtxt,type,somedayid)
{
        var recordsper = recordsperpage;
        var url_arg;
        searchtxt = searchtxt.replace('&','ampersand');
        url_arg = "pgcount=" + pgcount + "&perpage=" + recordsper + "&currentpg=" + pgno + "&searchtxt=" + searchtxt +   "&type=" + type  + "&Somedayid=" + somedayid + "";
        makePOSTRequest('/Ajax-relSpon.aspx?enc=' + Base64.encode(url_arg), '', '13'); 
}

function showrelSpoChariPaging()
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
          
           rec_count=result.split("^^^^");
           var searchTxt = rec_count[0];
           var pagerecord = rec_count[1];
           var datapagerecord = rec_count[2];
           var new1 = rec_count[3];
           var pgcount = rec_count[4];
           var newwh = rec_count[5];
           var type = rec_count[6];
           
            var newstart;
            newstart =1;
            if (new1 > 5)
            {
              if (newwh == 0)
              {
                  newstart = ((new1 - 5) + 1);
              }
              else
              {
                  newstart = ((new1 - newwh) + 1);
              }
            }
            if (type == 1)
            {
                document.getElementById("cc_RelSpopaging").innerHTML = pagerecord;
            }
            if (type == 2)
            {
                document.getElementById("cc_CommuPaging").innerHTML = pagerecord;
            }
            if (type == 3)
            {
              document.getElementById("div_Char_paging").innerHTML = pagerecord;
            }
            
            if (type == 1)
            {
            jQuery(document).ready
            (function() 
               {
	             jQuery('#invite-carousel').jcarousel
	             ({
	                horizontal: true,
                    scroll:5,
                    start:newstart
                  });
                }
            );
            }
            if (type == 2)
            {
            jQuery(document).ready
            (function() 
               {
	             jQuery('#invite-carousel1').jcarousel
	             ({
	                horizontal: true,
                    scroll:5,
                    start:newstart
                  });
                }
            );
            }
            
            if (type == 3)
            {
            jQuery(document).ready
            (function() 
               {
	             jQuery('#invite-carousel3').jcarousel
	             ({
	                horizontal: true,
                    scroll:5,
                    start:newstart
                  });
                }
            );
            }
            
            if (type == 1) 
            {  
                document.getElementById("div_RelSpoData").innerHTML = datapagerecord;
            }
            if (type == 2)
            {
                document.getElementById("div_community").innerHTML = datapagerecord;
            }
            if (type == 3)
            {
                document.getElementById("div_RelCharSD").innerHTML = datapagerecord;
            }
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}
/*End - Plan Your Someday -Rel Sponsored Rel Commu Paging*/

/*for paging of community somedays in search page*/
function pageDataSearch(flag,somedaytype,pgno,pgcount,recordsperpage,stxt,catid)
{
        var recordsper = recordsperpage;
        var url_arg;
        
        url_arg = "pgcount=" + pgcount + "&perpage=" + recordsper + "&currentpg=" + pgno + "&somedaytype=" + somedaytype + "&sertxt="+stxt+"&catid="+catid;
        makePOSTRequest('/Ajax-Search-CommunitySomedays.aspx?enc=' + Base64.encode(url_arg), '', '20');
    }

    /* new function for paging of community somedays in search page*/
    function pageDataSearchNew(flag, somedaytype, pgno, pgInprogressCount, pgneedplanCount, pgachievedCount, pgViewallCount, recordsperpage, stxt, catid) {
        var recordsper = recordsperpage;
        var url_arg;
        url_arg = "pgInprogressCount=" + pgInprogressCount + "&pgneedplanCount=" + pgneedplanCount + "&pgachievedCount=" + pgachievedCount + "&pgViewallCount=" + pgViewallCount + "&perpage=" + recordsper + "&currentpg=" + pgno + "&somedaytype=" + somedaytype + "&sertxt=" + stxt + "&catid=" + catid;
        makePOSTRequest('/Ajax-Search-CommunitySomedays.aspx?enc=' + Base64.encode(url_arg), '', '20');
    }

/*for paging of community somedays in search page*/
/*for paging of sponsored somedays in Search page*/
function pageDataHomeSponsoredSearch(flag,pgno,pgcount,recordsperpage,stxt,catid)
{
        var recordsper = recordsperpage;
        var url_arg;
        
        url_arg = "pgcount=" + pgcount + "&perpage=" + recordsper + "&currentpg=" + pgno + "&sertxt="+stxt+"&catid="+catid;
        makePOSTRequest('/Ajax-Search-SponSomedays.aspx?enc=' + Base64.encode(url_arg), '', '21');          
}

/*ends here*/

/*for paging of Chitchat in Search page*/
function pageDataChatSearch(flag,pgno,pgcount,recordsperpage,stxt,catid)
{
        var recordsper = recordsperpage;
        var url_arg;
        
        url_arg = "pgcount=" + pgcount + "&perpage=" + recordsper + "&currentpg=" + pgno + "&sertxt="+stxt+"&catid="+catid;
        makePOSTRequest('/Ajax-Search-ChitChat.aspx?enc=' + Base64.encode(url_arg), '', '22');          
}

/*ends here*/

/* SpotlightOn - Recent SpotlightOn paging*/

function pageDataRecSpotlight(pgno,pgcount,recordsperpage)
{
        var recordsper = recordsperpage;
        var preId = document.getElementById("ctl00_ContentPlaceHolder1_hdpreID").value;
        var url_arg;
        url_arg = "pgcount=" + pgcount + "&perpage=" + recordsper + "&currentpg=" + pgno+"&presentID="+preId ;
        makePOSTRequest('/Ajax-RecentSpotlights.aspx?enc=' + Base64.encode(url_arg), '', '19'); 
}

function showRecentSpotPaging()
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
          
           rec_count=result.split("^^^^");
         
           var pagerecord = rec_count[0];
           var datapagerecord = rec_count[1];
           var new1 = rec_count[2];
           var pgcount = rec_count[3];
           var newwh = rec_count[4];
                
            var newstart;
            newstart =1;
            if (new1 > 5)
            {
              if (newwh == 0)
              {
                  newstart = ((new1 - 5) + 1);
              }
              else
              {
                  newstart = ((new1 - newwh) + 1);
              }
            }
        
            document.getElementById("cc_SpotPaging").innerHTML = pagerecord;
           
           jQuery(document).ready(function() {
	         jQuery('#invite-carousel11').jcarousel({
	            horizontal: true,
                scroll:5,
                start:newstart
            });
            });
          
            document.getElementById("div_RecSpot").innerHTML = datapagerecord; 
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}

/*End - SpotlightOn - Recent SpotlightOn paging */


/* for searching Friends in Message Compose */

function searchName(e)
{
    
    if(e.keyCode == 13)
    {
        var sertxt = document.getElementById("ctl00_ContentPlaceHolder1_txtsearch").value;
        if (sertxt == "")
        {
            alert(geterrmsg('e60'));
            return;
        }
        else
        {
            var url = "search="+sertxt;
            makePOSTRequest('/searchfriends.aspx?enc=' + Base64.encode(url), '', '10');    
        }
    }
}


/* ends*/


function makePOSTRequest(url, parameters, type) {   
    http_request = false;
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {
            // set type accordingly to anticipated content type
            http_request.overrideMimeType('text/html');
        }
    } else if (window.ActiveXObject) { // IE
    try {
        http_request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
    try {
        http_request = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {}
    }
}

    if (!http_request) {
        alert(geterrmsg('e54'));
        return false;
    }
    if(type=="1") http_request.onreadystatechange = showSomedays; //paging of somedays in profile
    if(type=="2") http_request.onreadystatechange = showInvitations;//paging of open invitations in profile
    if(type=="3") http_request.onreadystatechange = showChitChats;//paging of chit chats
    if(type=="4") http_request.onreadystatechange = showFeaturedSomedays; //paging of featured someday in homepage
    if(type=="5") http_request.onreadystatechange = showSponsoredSom; //paging of sponsored someday in homepage
    if(type=="6") http_request.onreadystatechange = showCharitablesd; //paging of charitable someday
    if(type=="7") http_request.onreadystatechange = showinvitecontact; //Invite Contact Data

    if(type=="8") http_request.onreadystatechange = showMedia; //Show Photo Video Paging Data
    if(type=="9") http_request.onreadystatechange = showUsingPlan; //Show UsingPlan Paging Data 

    if(type=="10") http_request.onreadystatechange = showSearchFriends;// Search Friends
    if(type=="11") http_request.onreadystatechange = showcontactus;
    if(type=="12") http_request.onreadystatechange = showsortfriends;
    if(type=="13") http_request.onreadystatechange = showrelSpoChariPaging;
    if(type=="14") http_request.onreadystatechange = showsocialcontact;
    
    if(type=="19") http_request.onreadystatechange = showRecentSpotPaging;//pageing - recent spotlights
    if(type=="20") http_request.onreadystatechange = showCommunitySomedays;
    if(type=="21") http_request.onreadystatechange = showExpertSom; //paging of sponsored someday in searchpage
    if(type=="22") http_request.onreadystatechange = showChatPaging; //paging of ChitChat in searchpage
    if(type=="23") http_request.onreadystatechange = showInbox; //Deleting messages from Message Inbox
    if(type=="24") http_request.onreadystatechange = showInbox; //Blocking the sender
    if(type=="25") http_request.onreadystatechange = showSentMessages; //Blocking the sender
    
    if(type=="26") http_request.onreadystatechange = showbindactivefriends;
    if(type=="27") http_request.onreadystatechange = bindstep;

    if(type=="30") http_request.onreadystatechange = showRegispage;
    if(type=="35") http_request.onreadystatechange = showOwnerpage;
    
    if(type=="50") http_request.onreadystatechange = showcharitablepage_1;
    if(type=="55") http_request.onreadystatechange = showOwnerPageRel;
    if(type=="56") http_request.onreadystatechange = replyStateChanged;
    if(type=="57") http_request.onreadystatechange = displayImageDetails;
    if(type=="58") http_request.onreadystatechange = showPhotos;
    if(type=="88") http_request.onreadystatechange = showMedia_charitable;
    if(type=="89") http_request.onreadystatechange = onCommentUpdate;
    if(type=="150") http_request.onreadystatechange = addFriend;
    if(type=="151") http_request.onreadystatechange = stopReply;
    if(type=="160") http_request.onreadystatechange = CommentsSpotlight;
    if(type=="161") http_request.onreadystatechange = videoDisplay;
    if(type=="162") http_request.onreadystatechange = showPhotosImgs;
    if(type=="163") http_request.onreadystatechange = loginStateChanged;
    if(type=="164") http_request.onreadystatechange = loginOutStateChanged;
    if(type=="165") http_request.onreadystatechange = emailStateChanged;
    if (type == "166") http_request.onreadystatechange = copyPlanStateChanged;
    if(type=="167") http_request.onreadystatechange = sendContactStateChanged;
    if(type=="168") http_request.onreadystatechange = displayPlanSteps;
    if(type=="169") http_request.onreadystatechange = sendMessageStateChanged;
    if(type=="170") http_request.onreadystatechange = invitationStateChanged;
    if(type=="171") http_request.onreadystatechange = planStepStateChanged;
    if(type=="172") http_request.onreadystatechange = flagStateChanged;
    if(type=="173") http_request.onreadystatechange = emailFlag_stateChanged;
    if(type=="174") http_request.onreadystatechange = layer_image_stateChanged;
    if(type=="175") http_request.onreadystatechange = addsomedayDatalistStateChanged;
    if(type=="176") http_request.onreadystatechange = sendMsgStateChanged;
    if(type=="180") http_request.onreadystatechange = showUsers;
    if(type=="201") http_request.onreadystatechange = ResultClickTracking;
    if(type=="190") http_request.onreadystatechange = showCookie;
    if(type=="210") http_request.onreadystatechange = showExpertOnRefresh;
    if (type == "211") http_request.onreadystatechange = videoECDisplay;
    if (type == "212") http_request.onreadystatechange = activityFeedDisplay;
    
    //url = "http://localhost/mysomeday" + url;
    //url = "http://www.mysomedaytest.com" + url;
    //url = "http://www.mysomeday.com" + url;
    http_request.open('POST', url, true);
    http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    http_request.setRequestHeader("Content-length", parameters.length);
    http_request.setRequestHeader("Connection", "close");
    http_request.send(parameters);
}


/*Paging for the chit chat landing page*/
function pageDataChitchat(flag,pgno,pgcount,recordsperpage,cat,searchtxt)
{
        var recordsper = recordsperpage;
        var url_arg;
      
        url_arg = "flag=" + flag + "&pgcount=" + pgcount + "&perpage=" + recordsper + "&currentpg=" + pgno + "&cat=" + cat + "&searchtxt=" + searchtxt + "";
       
        makePOSTRequest('/Ajax-chitchat.aspx?enc=' + Base64.encode(url_arg), '', '3');            
}

function categoryChitchat(flag,pgno,pgcount,recordsper,catId,searchtxt)
{
        var cat = catId;
        var url_arg;
        url_arg = "flag=" + flag + "&pgcount=" + pgcount + "&perpage=" + recordsper + "&currentpg=" + pgno + "&cat=" + catId + "&searchtxt=''";
       
        makePOSTRequest('/Ajax-chitchat.aspx?enc=' + Base64.encode(url_arg), '', '3');            
}
/*ends here*/

/*Paging for the Media - Sponsored landing page*/
function pageDataMedia(pgno,pgcount,recordsperpage,sdId,type)
{
        var recordsper = recordsperpage;
        var url_arg;
        url_arg = "pgcount=" + pgcount + "&perpage=" + recordsper + "&currentpg=" + pgno + "&someday=" + sdId + "&type=" + type;
        
        makePOSTRequest('/Ajax-Media.aspx?enc=' + Base64.encode(url_arg), '', '8');            
}

function pageDataMediaCharitable(pgno,pgcount,recordsperpage,sdId,type)
{
        var recordsper = recordsperpage;
        var url_arg;
        url_arg = "pgcount=" + pgcount + "&perpage=" + recordsper + "&currentpg=" + pgno + "&someday=" + sdId + "&type=" + type;
        
        makePOSTRequest('/Ajax-Media-Charitable.aspx?enc=' + Base64.encode(url_arg), '', '88');            
}

/*ends here*/



/*Delete records using checkbox*/
function confirmDeleteList(cate,ObjID,errMsg,errMsg1) 
{
    var flag=0;
    var i;
    for (i=0; i < document.forms[0].elements.length; i++) 
    {
        if ((document.forms[0].elements[i].type == 'checkbox') && 
           (document.forms[0].elements[i].name.indexOf(ObjID) > -1)) 
        {
            if (document.forms[0].elements[i].checked == true)
            {
                flag=1;
            }
        }
    }
    if (flag == 0)
    {
        alert(errMsg1);
        return false;
    }
    else
    {
        answer = confirm(errMsg); 
        if (answer == true) 
        { 
            return true; 
        } 
        else 
        { 
            return false; 
        } 
    }                   
}
/* End  -Select checkbox to Delete*/

function showSomedays() 
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;

           rec_count = result.split("^^^^");
           var somedaytypes = rec_count[0];
           var pagerecord = rec_count[1];
           var datapagerecord = rec_count[2];
           var new1 = rec_count[3];
           var pgcount = rec_count[4];
           var newwh = rec_count[5];
           
            var newstart;
            newstart =1;
            if (new1 > 5)
            {
              if (newwh == 0)
              {
                  newstart = ((new1 - 5) + 1);
              }
              else
              {
                  newstart = ((new1 - newwh) + 1);
              }
            }
          document.getElementById("pgrecordsdis").innerHTML = pagerecord;
         
           jQuery(document).ready(function() {
	         jQuery('#search-carousel').jcarousel({
	            horizontal: true,
                scroll:5,
                start:newstart
            });
            });
            document.getElementById("pgsometype").innerHTML = somedaytypes;
            if(document.getElementById("userbindsomeday")!=null)
            document.getElementById("userbindsomeday").innerHTML = datapagerecord;
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}

function showFeaturedSomedays()
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
          
           rec_count=result.split("^^^^");
           var somedaytypes = rec_count[0];
           var pagerecord = rec_count[1];
           var datapagerecord = rec_count[2];
           var new1 = rec_count[3];
           var pgcount = rec_count[4];
           var newwh = rec_count[5];
           var pagingdown = rec_count[6];
           
          
            var newstart =1;
            if (new1 > 5)
            {
              if (newwh == 0)
              {
                  newstart = ((new1 - 5) + 1);
              }
              else
              {
                  newstart = ((new1 - newwh) + 1);
              }
            }
          document.getElementById("id_featured_paging").innerHTML = pagerecord;
         
           jQuery(document).ready(function() {
	         jQuery('#search-carousel').jcarousel({
	            horizontal: true,
                scroll:5,
                start:newstart
            });
            });
         
          document.getElementById("id_featured_paging_down").innerHTML = pagingdown;
         
          jQuery(document).ready(function() {
	        jQuery('#search-carousel-down').jcarousel({
	            horizontal: true,
                scroll:5,
                start:newstart
            
            });
            });
            document.getElementById("bindsomedaytypes").innerHTML = somedaytypes;
            document.getElementById("bindsomedaytypes_down").innerHTML = somedaytypes;
            if(document.getElementById("id_featured")!=null)
            document.getElementById("id_featured").innerHTML = datapagerecord;
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}  

function showCommunitySomedays()
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
          
           rec_count=result.split("^^^^");
           var somedaytypes = rec_count[0];
           var pagerecord = rec_count[1];
           var datapagerecord = rec_count[2];
           var new1 = rec_count[3];
           var pgcount = rec_count[4];
           var newwh = rec_count[5];
           var pagingdown = rec_count[6];
           
          
            var newstart =1;
            if (new1 > 5)
            {
              if (newwh == 0)
              {
                  newstart = ((new1 - 5) + 1);
              }
              else
              {
                  newstart = ((new1 - newwh) + 1);
              }
            }
          document.getElementById("id_featured_paging").innerHTML = pagerecord;
         
           jQuery(document).ready(function() {
	         jQuery('#search-carousel').jcarousel({
	            horizontal: true,
                scroll:5,
                start:newstart
            });
            });
         
          document.getElementById("id_featured_paging_down").innerHTML = pagingdown;
         
          jQuery(document).ready(function() {
	        jQuery('#search-carousel-down').jcarousel({
	            horizontal: true,
                scroll:5,
                start:newstart
            
            });
            });
            document.getElementById("bindsomedaytypes").innerHTML = somedaytypes;
            document.getElementById("bindsomedaytypes_down").innerHTML = somedaytypes;
            document.getElementById("id_featured").innerHTML = datapagerecord;
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}

function showSponsoredSom()
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
          
           rec_count=result.split("^^^^");
           var pagerecord = rec_count[0];
           var datapagerecord = rec_count[1];
           var new1 = rec_count[2];
           var pgcount = rec_count[3];
           var newwh = rec_count[4];
         
            var newstart =1;
            if (new1 > 5)
            {
              if (newwh == 0)
              {
                  newstart = ((new1 - 5) + 1);
              }
              else
              {
                  newstart = ((new1 - newwh) + 1);
              }
            }
           document.getElementById("sponsored_pag").innerHTML = pagerecord;
         
           jQuery(document).ready(function() {
	         jQuery('#sponsored-carousel').jcarousel({
	            horizontal: true,
                scroll:5,
                start:newstart
            });
            });
            document.getElementById("sponsored_content").innerHTML = datapagerecord;
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}


function showExpertSom()
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
          
           rec_count=result.split("^^^^");
           var pagerecord = rec_count[0];
           var datapagerecord = rec_count[1];
           var new1 = rec_count[2];
           var pgcount = rec_count[3];
           var newwh = rec_count[4];
         
            var newstart =1;
            if (new1 > 5)
            {
              if (newwh == 0)
              {
                  newstart = ((new1 - 5) + 1);
              }
              else
              {
                  newstart = ((new1 - newwh) + 1);
              }
            }
           document.getElementById("sponsored_pag").innerHTML = pagerecord;
         
           jQuery(document).ready(function() {
	         jQuery('#sponsored-carousel').jcarousel({
	            horizontal: true,
                scroll:5,
                start:newstart
            });
            });
            document.getElementById("sponsored_content").innerHTML = datapagerecord;
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}


function showChatPaging()
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
          
           rec_count=result.split("^^^^");
           var pagerecord = rec_count[0];
           var datapagerecord = rec_count[1];
           var new1 = rec_count[2];
           var pgcount = rec_count[3];
           var newwh = rec_count[4];
         
            var newstart =1;
            if (new1 > 5)
            {
              if (newwh == 0)
              {
                  newstart = ((new1 - 5) + 1);
              }
              else
              {
                  newstart = ((new1 - newwh) + 1);
              }
            }
           document.getElementById("chat_pag").innerHTML = pagerecord;
         
           jQuery(document).ready(function() {
	         jQuery('#chat-carousel5').jcarousel({
	            horizontal: true,
                scroll:5,
                start:newstart
            });
            });
            document.getElementById("chat_content").innerHTML = datapagerecord;
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}



function showCharitablesd()
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
           rec_count=result.split("^^^^");
           var pagerecord = rec_count[0];
           var datapagerecord = rec_count[1];
           var new1 = rec_count[2];
           var pgcount = rec_count[3];
           var newwh = rec_count[4];
         
            var newstart =1;
            if (new1 > 5)
            {
              if (newwh == 0)
              {
                newstart = ((new1 - 5) + 1);
              }
              else
              {
                newstart = ((new1 - newwh) + 1);
              }
            }
           document.getElementById("charitable_bind_paging").innerHTML = pagerecord;
         
           jQuery(document).ready(function() {
	         jQuery('#charitable-carousel').jcarousel({
	            horizontal: true,
                scroll:5,
                start:newstart
            });
            });
            document.getElementById("charitable_bind").innerHTML = datapagerecord;
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}

function showSearchFriends()
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
           if (result == "1")
           {
             alert(geterrmsg('e61'));
             return;
           }
           else
           {
             document.getElementById("searchid").innerHTML = result;
           }
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }

}
/*Call chit chat layer*/
function callChitChatLayer()
{
    document.getElementById('start_chitchat').style.display='block';
    document.getElementById('fade').style.display='block';
    alertSize();
    document.getElementById('start_chitchat').style.left=(parseInt(myWidth/2) - 213) + "px";
    window.scrollTo(0,0);
}

function closeChitchatLayer()
{
    document.getElementById('ctl00_drp_cat').value="0";
    document.getElementById('ctl00_txt_title_chat').value="";
    document.getElementById('ctl00_txt_msg_chat').value="";
    document.getElementById('start_chitchat').style.display='none';
    document.getElementById('fade').style.display='none';
}
/*ends here*/


function showInvitations() 
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
          
           rec_count=result.split("^^^^");
           var pagerecord = rec_count[0];
           var datapagerecord = rec_count[1];
           var new1 = rec_count[2];
           var pgcount = rec_count[3];
           var newwh = rec_count[4];
           
          
            var newstart =1;
            if (new1 > 5)
            {
              if (newwh == 0)
              {
                  newstart = ((new1 - 5) + 1);
              }
              else
              {
                  newstart = ((new1 - newwh) + 1);
              }
            }
           document.getElementById("invitationpaging").innerHTML = pagerecord;
           jQuery(document).ready(function() {
	         jQuery('#invite-carousel').jcarousel({
	            horizontal: true,
                scroll:5,
                start:newstart
            });
            });
            document.getElementById("allinvitations").innerHTML = datapagerecord;
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}

function showChitChats() 
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
          
           rec_count=result.split("^^^^");
           var chitcat = rec_count[0];
           var pagerecord = rec_count[1];
           var datapagerecord = rec_count[2];
           var new1 = rec_count[3];
           var pgcount = rec_count[4];
           var newwh = rec_count[5];
           
          
            var newstart =1;
            if (new1 > 5)
            {
              if (newwh == 0)
              {
                  newstart = ((new1 - 5) + 1);
              }
              else
              {
                  newstart = ((new1 - newwh) + 1);
              }
            }
           document.getElementById("div_ccPaging").innerHTML = pagerecord;
           document.getElementById("catfill_chitchat").innerHTML = chitcat;
         
           jQuery(document).ready(function() {
	         jQuery('#invite-carousel').jcarousel({
	            horizontal: true,
                scroll:5,
                start:newstart
            });
            });
            document.getElementById("div_ccData").innerHTML = datapagerecord;
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}

function verifyLayer()
{
    xmlHttp2=getXmlHttpObject();
		if (xmlHttp2==null)
		{
			alert(geterrmsg('e51'));
		  	return;
		} 
	var url="/Captcha-another-img.aspx";
	
	xmlHttp2.onreadystatechange=stateChanged3;
	xmlHttp2.open("GET",url,true);
	xmlHttp2.send(null);
}

function stateChanged3()
{
    if (xmlHttp2.readyState==4)
	{ 		
		document.getElementById("captchareload").innerHTML=xmlHttp2.responseText;
	}
}


var myWidth = 0, myHeight = 0;

function alertSize() {
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
}

/*Call login layer*/
function callLoginLayer()
{
    document.getElementById('id_login').style.display='block';
    document.getElementById('fade').style.display='block';
    alertSize();
    document.getElementById('id_login').style.left=(parseInt(myWidth/2) - 213) + "px";
    window.scrollTo(0,0);
}

function closeLoginLayer()
{
    document.getElementById('ctl00_rigth_uname').value="";
    document.getElementById('ctl00_rigth_pword').value="";
    document.getElementById('ctl00_chk_remember').checked=false;
    document.getElementById('id_login').style.display='none';
    document.getElementById('fade').style.display='none';
}
/*ends here*/


/*call forgot password layer*/
function callForgotpassLayer(pagename)
{
    if (pagename == 'login')
        document.getElementById('id_login').style.display = 'none';
    else if (pagename == 'somedaycopy')
        document.getElementById('id_someday_copy').style.display = 'none';
    else
        document.getElementById('id_someday').style.display = 'none';
    document.getElementById('id_forgotpass').style.display='block';
    document.getElementById('fade').style.display='block';
    alertSize();
    document.getElementById('id_forgotpass').style.left=(parseInt(myWidth/2) - 213) + "px";
    window.scrollTo(0,0);
}

function closeForgotpassLayer()
{
    document.getElementById('ctl00_rigth_email').value="";
    document.getElementById('id_login').style.display='none';
    document.getElementById('id_forgotpass').style.display='none';
    document.getElementById('fade').style.display='none';
}
/*ends here*/

/**/
function checkLogin()
{
    alert("Please login to contact");
}
/**/
/*error alert if not login for chit chat*/
function callLoginAlert()
{
        alert(geterrmsg('e55'));
}
/*ends here*/

function loginAlertCharity()
{
    alert(geterrmsg('e184'));
}

function callLoginAlertCopy()
{
    //alert(geterrmsg('e64'));
    document.getElementById('id_someday_copy').style.display = 'block';   
    document.getElementById('fade').style.display = 'block';
    alertSize();
    document.getElementById('id_someday_copy').style.left = (parseInt(myWidth / 2) - 213) + "px";
    window.scrollTo(0, 0);
}

function closeSomedayCopyLayer() {
    if (document.getElementById(content + 'rigth_uname2') != null)
        document.getElementById(content +'rigth_uname2').value = "";
    if (document.getElementById(content +'rigth_pword2') != null)
        document.getElementById(content +'rigth_pword2').value = "";
    if (document.getElementById(content +'chk_remember2') != null)
        document.getElementById(content + 'chk_remember2').checked = false;
    document.getElementById('id_someday_copy').style.display = 'none';
    document.getElementById('fade').style.display = 'none';
}

function callLoginAlertFlag()
{
    alert('Please Login to Mark the Comment as Inappropriate');
}

/*function used for sign up link*/
function callReg()
{
    document.location = "/newuser-registration.aspx";
}
/*ends here*/

/*Add as friend functionality for Other User's Profile*/
function callAsFriend(strprofileid)
{
    document.getElementById('id_login').style.display='none';
    document.getElementById('id_forgotpass').style.display='none';
    document.getElementById('id_addasfriend').style.display='block';
    document.getElementById('fade').style.display='block';
    document.getElementById('hid_profileid').value = strprofileid;
    alertSize();
    document.getElementById('id_addasfriend').style.left=(parseInt(myWidth/2) - 213) + "px";
    window.scrollTo(0,0);
}

function closeAsFriend()
{
    document.getElementById('txt_addfriend').value="";
    document.getElementById('id_login').style.display='none';
    document.getElementById('id_forgotpass').style.display='none';
    document.getElementById('id_addasfriend').style.display='none';
    document.getElementById('fade').style.display='none';
}

function submitFriend()
{
    document.getElementById("subfriend").style.display="none"; 
    document.getElementById("preload_addfriend").style.display="block";
    
    var profileid = document.getElementById("hid_profileid").value;
    if(document.getElementById("txt_addfriend").value.replace(/^\s+|\s+$/g, "") == "")
    {
        alert(geterrmsg('e56'));
        document.getElementById("subfriend").style.display="block";
        document.getElementById("preload_addfriend").style.display="none";
        return;
    }
    
    var varaddfriend = document.getElementById("txt_addfriend").value;
    varaddfriend = varaddfriend.replace(new RegExp("\\n", "g"), "*****");
    
    sendMessageFriend(varaddfriend, profileid);
}

/*** Altruism layer ***/

function callAltruism()
{
    document.getElementById('id_altr').style.display='block';
    document.getElementById('fade').style.display='block';
    alertSize();
    document.getElementById('id_altr').style.left=(parseInt(myWidth/2) - 213) + "px";
    window.scrollTo(0,0);
}

function closeCallAltruism()
{
    document.getElementById('id_altr').style.display='none';
    document.getElementById('fade').style.display='none';
}
/*** Altruism layer ***/


function sendMessageFriend(strmessage, strprofileid)
{ 
    xmlHttp=getXmlHttpObject();
    if (xmlHttp==null)
      {
          alert (geterrmsg('e51'));
          return;
      } 
    var url="/AddasFriend.aspx";
    param='message='+ Base64.encode(strmessage)+'&profileid='+strprofileid;
    makePOSTRequest(url,param,'169');

}
function closeConfirmMessageLayer() {
    document.getElementById('id_Confirmmessage').style.display = 'none';
    document.getElementById('fade').style.display = 'none';
    window.location = "/Default_home.aspx";
}
function sendMessageStateChanged() 
{ 
    if (http_request.readyState==4)
	{ 		
	  if (http_request.status == 200)
	  {
	        result = http_request.responseText;
	        if (result == "1")
		    {
		        alert(geterrmsg('e58'));
		        window.location.reload(); 
		    }
		    else
		    {
		        alert(geterrmsg('e50'));
		        document.getElementById("txt_addfriend").value="";
		        document.getElementById("subfriend").style.display="block";
                document.getElementById("preload_addfriend").style.display="none";
		    }
       }
	}
}
/*ends here*/

/*Send a Message functionality for Other User's Profile*/
function callSendMessage(strprofileid)
{
    document.getElementById('id_login').style.display='none';
    document.getElementById('id_forgotpass').style.display='none';
    document.getElementById('id_addasfriend').style.display='none';
    document.getElementById('id_sendmessage').style.display='block';
    document.getElementById('fade').style.display='block';
    document.getElementById('hid_profileid_id').value = strprofileid;
    alertSize();
    document.getElementById('id_sendmessage').style.left=(parseInt(myWidth/2) - 213) + "px";
    window.scrollTo(0,0);
}

function closeSendMessage()
{
    document.getElementById('txt_sendmessage').value="";
    document.getElementById('id_login').style.display='none';
    document.getElementById('id_forgotpass').style.display='none';
    document.getElementById('id_addasfriend').style.display='none';
    document.getElementById('id_sendmessage').style.display='none';
    document.getElementById('fade').style.display='none';   
}


/* Added by ashwini 21 April*/

function callConfirmMessage()
{
    getPageSize(0);
    document.getElementById('id_login').style.display='none';
    document.getElementById('id_forgotpass').style.display='none';
    document.getElementById('id_addasfriend').style.display='none';   
    document.getElementById('id_Confirmmessage').style.display='block';
    document.getElementById('fade').style.width = (pageWidth + 'px');
    document.getElementById('fade').style.height = (pageHeight + 'px');
    document.getElementById('fade').style.display='block';
    //document.getElementById('hid_profileid_id').value = strprofileid;
    alertSize();
    document.getElementById('id_Confirmmessage').style.left=(parseInt(myWidth/2) - 213) + "px";
    window.scrollTo(0,0);
}

function submitMessage()
{
    document.getElementById("submitmsg").style.display="none"; 
    document.getElementById("preloadmsg").style.display="block";
    
    var valid=true;    
    
    var profileid = document.getElementById('hid_profileid_id').value;
    var errorstr="The following fields are incomplete:" +  '\r\n' ;

    if (wsTrim(document.getElementById("ctl00_txt_subject").value) == "")
    {
        errorstr=errorstr +'\r\n' + geterrmsg('e516');
        valid=false;
    }
    
    
    if(wsTrim(document.getElementById("txt_sendmessage").value) == "")
    {
        errorstr=errorstr +'\r\n' + geterrmsg('e56');
        valid=false;   
    }
   
    if(valid==false)
    {
        errorstr=errorstr +  '\r\n';
        alert(errorstr);
        document.getElementById("submitmsg").style.display="block"; 
        document.getElementById("preloadmsg").style.display="none";
    }
    else
    {
  
         var docsubject = document.getElementById('ctl00_txt_subject').value;
         var docmessage = document.getElementById('txt_sendmessage').value;
         docmessage = docmessage.replace(new RegExp("\\n", "g"), "*****");
         sendMsgFriend(docsubject,docmessage, profileid);
         document.getElementById('ctl00_txt_subject').value = '';
         document.getElementById('txt_sendmessage').value = '';
    }
   return valid;
}

function sendMsgFriend(strsubject,strmessage, strprofileid)
{ 
    xmlHttp9=getXmlHttpObject();
    if (xmlHttp9==null)
      {
          alert (geterrmsg('e51'));
          return;
      } 

    var url="/SendaMessage.aspx";
    var param='subject='+Base64.encode(strsubject) + '&message='+Base64.encode(strmessage)+'&profileid='+strprofileid;
    makePOSTRequest(url,param,'176')

}

function sendMsgStateChanged() 
{ 
    if (http_request.readyState==4)
	{ 		
	  if (http_request.status == 200)
	  {
	        result = http_request.responseText;
	        if (result == "1")
		    {
		        alert(geterrmsg('e57'));
		        window.location.reload(); 
		    }
		    else
		    {
		        alert(geterrmsg('e50'));
		        document.getElementById("txt_sendmessage").value="";
		        document.getElementById("submitmsg").style.display="block"; 
                document.getElementById("preloadmsg").style.display="none";
		    }
       }
	}
}
/*ends here*/

/*Layer for Post An Open Invite - Owner Someday */
function callOpenInvitelayer()
{
    document.getElementById('id_login').style.display='none';
    document.getElementById('id_forgotpass').style.display='none';
    document.getElementById('id_openInvite').style.display='block';
    document.getElementById('fade').style.display='block';
    alertSize();
    document.getElementById('id_openInvite').style.left=(parseInt(myWidth/2) - 213) + "px";
    window.scrollTo(0,0);
}

function closeOpenInvitelayer()
{
    document.getElementById('ctl00_ContentPlaceHolder1_rigth_invite').value="";
    document.getElementById('id_openInvite').style.display='none';
    document.getElementById('fade').style.display='none';
}

function inviteOthers(pUser)
{     
    pParam = document.getElementById("ctl00_ContentPlaceHolder1_hdnSomedayId").value;
    document.getElementById("sbutton").style.visibility="hidden"; 
    document.getElementById("ipreloader").style.visibility="visible";
    if(document.getElementById(content + "rigth_invite").value.replace(/^\s+|\s+$/g, "")=="")
    {
        alert("Please enter a Invitation Text");
        document.getElementById(content + "rigth_invite").focus();
        document.getElementById("sbutton").style.visibility="visible"; 
        document.getElementById("ipreloader").style.visibility="hidden";
        return false;
    }
    var invitationText=document.getElementById(content + "rigth_invite").value;
    invitationText = invitationText.replace(new RegExp("\\n", "g"), "*****");
    
    callInvitation(invitationText,pParam,pUser);
 }
 
 function callInvitation(pinvitationText,pParameters,pUserId)
 { 
    xmlHttp=getXmlHttpObject();
  
    if (xmlHttp==null)
    {
        alert(geterrmsg('e51'));
        return;
    } 
    var url="invite=" + Base64.encode(pinvitationText) + "&param="+pParameters + "&User="+pUserId;  
    makePOSTRequest('/SomedayOpenInvitation.aspx',url,'170');

}

function invitationStateChanged() 
{ 
    if (http_request.readyState==4)
	{ 		
	  if (http_request.status == 200)
	  {
		    result = http_request.responseText;
		    result=result.split(',');
		    
	        if (result[0] == "1")
		    {
		        //window.location="/SomedayOwner.aspx?plan="+ Base64.encode(result[1]);
		        window.location = siteURL + result[1] + "/someday/" + result[2] + "/" + result[3];		        
		    }
		    else
		    {
		        alert(geterrmsg('e56'));
		    }
       }
	}
}
/*End Layer for Post An Open Invite - Owner Someday*/

/*Plan- Edit Step */

function displayEditSpan(check,rate,reminder,deadline)
{
    //var txtStep=document.getElementById("hdn_" + check).value;
    //txtStep =txtStep.replace(new RegExp("#####", "g"), "'" );
    //var input_val = txtStep.replace(/<br\/>/g, "\n");
    
    document.getElementById("selRate_" + check).value=rate;
   if (reminder == "Daily")reminder = "1";
   else if (reminder == "Weekly")  reminder = "2";
   else if (reminder == "Monthly") reminder = "3";
   else if (reminder == "None") reminder = "0";
   else if (reminder == "") reminder = "0";

    document.getElementById("selRem_" + check).value=reminder;
    if (deadline != '01-01-1900')
    {
        document.getElementById("txtDeadline_" + check).value=deadline;
    }
    else
    {
        document.getElementById("txtDeadline_" + check).value=" Deadline";
    }
   // document.getElementById("text_" + check).value=input_val; 
    document.getElementById("span_" + check).style.display='block';
    document.getElementById("span_hide" + check).style.display='none';
    document.getElementById("stepht_" + check).style.height='auto';
}

function cancelEditedStep(check,txtStep) {
    if (txtStep != null)
        document.getElementById("span_" + check).value = txtStep;
    document.getElementById("span_" + check).style.display='none';
    document.getElementById("span_hide" + check).style.display='block';
    document.getElementById("stepht_" + check).style.height='auto'; 
}

function saveEditedStep(somedayid,check,textedit,rate,reminder,deadline)
{
    document.getElementById("stepht_" + check).style.height='20px';
    if(wsTrim(document.getElementById(textedit).value)!="")
     editDeletePlanSteps(somedayid,check , document.getElementById(textedit).value,document.getElementById(rate).value,document.getElementById(reminder).value,document.getElementById(deadline).value,'update');
     else
     {
     alert("Enter Step Description");
     displayEditSpan(check,rate,reminder,deadline)
     }
}

function deletePlanStep(somedayid,check)
{
    document.getElementById("stepht_" + check).style.height='20px';
    editDeletePlanSteps(somedayid, check,'','','','','delete');
}

 function editDeletePlanSteps(somedayid,pcheck,ptextedit,prate,preminder,pdeadline,mode)
 {   
    xmlHttp=getXmlHttpObject();
  
    if (xmlHttp==null)
    {
        alert(geterrmsg('e51'));
        return;
    } 
  if (prate == "Rate Step")
  {
    prate = "0";
  }
  
  if (preminder == "Get Reminder")
  {
    preminder = "0";
  }
  
  if(pdeadline == "Deadline")
  {
    pdeadline = "Deadline";
  }
  
        var newstep = ptextedit;
        newstep = newstep.replaceAll('[&]','amp;');
        newstep = newstep.replaceAll('[=]','amp61;');
        var url="/Ajax-EditDeleteStep.aspx";
        var param='somedayid=' + somedayid + '&stepId=' + pcheck + '&text='+newstep+'&rate='+prate+'&reminder='+preminder+ '&deadline='+ pdeadline +'&mode='+mode ;
        makePOSTRequest(url,param,'171') ;
}

function planStepStateChanged() 
{ 
    if (http_request.readyState==4)
	{ 		
	  if (http_request.status == 200)
	  {
		    
		    result = http_request.responseText;
            document.getElementById("div_plan").innerHTML = result;
       }
	}
}

/*Contact US*/
function callContactUsLayer()
{
    document.getElementById('start_contactus').style.display='block';
    document.getElementById('fade').style.display='block';
    alertSize();
    document.getElementById('start_contactus').style.left=(parseInt(myWidth/2) - 213) + "px";
    window.scrollTo(0,0);
}

function closeContactUsLayer()
{
    document.getElementById('start_contactus').style.display='none';
    document.getElementById('fade').style.display='none';
}
/*ends here*/


/*Copy plan*/
function callCopyPlanLayer()
{
    document.getElementById('start_copyplan').style.display='block';
    document.getElementById('fade').style.display='block';
    alertSize();
    document.getElementById('start_copyplan').style.left=(parseInt(myWidth/2) - 273) + "px";
    window.scrollTo(0,0);
}

function closeCopyPlanLayer()
{
    document.getElementById('start_copyplan').style.display='none';
    document.getElementById('fade').style.display='none';
}
/*ends here*/

/*Flag inappropriate*/
function flagInApp(varchat, varemailid,replyid,chatTit,lVal)
{
    xmlHttp11=getXmlHttpObject();
    if (xmlHttp11==null)
      {
          alert (geterrmsg('e51'));
          return;
      } 
    if(varemailid == "")
    {
        alert("You need to login to mark it as inappropriate");
    }
    else
    {
        var url="/FlagInappropriate.aspx";
        url=url+"?chatmg="+varchat+"&emailid="+varemailid+"&replyid="+replyid+"&title="+chatTit+"&link="+lVal;
        makePOSTRequest(url,'','172');
    
    }
}

function flagStateChanged() 
{ 
    if (http_request.readyState==4)
	{ 		
	  if (http_request.status == 200)
	  {
	        result = http_request.responseText;
	        if (result == "1")
		    {
		        alert(geterrmsg('e59'));
		        window.location.reload();
		    }
		    else
		    {
		        alert(geterrmsg('e50'));
		    }
       }
	}
}
/*ends here*/

/* Select only one checkbox in list - copy this plan to existing someday */
function setOneSelected(controlid,count,somedayId,planforid) {    
    var pcount=100;
    var PkSomedayId=new Array;
    PkSomedayId=document.getElementById("ctl00_ContentPlaceHolder1_PkSomedayId").value.split(',');
   
    for (i=0; i < document.forms[0].elements.length; i++) 
    {
        if ((document.forms[0].elements[i].type == 'checkbox') &&
         (document.forms[0].elements[i].name.indexOf(controlid) > -1))
        {
            pcount=pcount+1;
        }
    }

    for (i = 0; i < count ; i++)
    {
        var chkSelect; 
        chkSelect= "check_" + PkSomedayId[i];
             
        if (controlid==chkSelect)
        {        
            if(document.getElementById(chkSelect).checked == true)
            {
                document.getElementById(chkSelect).checked = true;
            }
            else
            {
                document.getElementById(chkSelect).checked = false;
            }
            document.getElementById('ctl00_ContentPlaceHolder1_pksdcopiedfor').value = somedayId;
            document.getElementById('ctl00_ContentPlaceHolder1_pkplancopiedfor').value =planforid;
        }
        else
        {
            document.getElementById(chkSelect).checked = false;
        }
    }
}
/* Ends here*/

/*for paging of Similar Somedays-Someday Landing Page*/
function pageDataSimSD(flag,somedaytype,pgno,userid,pgcount,recordsperpage,sdCaption,plan,someday)
{   
        var recordsper = recordsperpage;
        sdCaption=sdCaption.replaceAll('[&]','amp;');
   
        var url_arg;
        url_arg = "userid=" + userid + "&pgcount=" + pgcount + "&perpage=" + recordsper + "&currentpg=" + pgno + "&somedaytype=" + somedaytype + "&sdCaption=" + sdCaption +  "&plan=" + plan + "&someday=" + someday;        
        makePOSTRequest('/Ajax-SimilarSomeday.aspx?enc=' + Base64.encode(url_arg), '', '1');            
}
/*End -  paging of Similar Somedays-Someday Landing Page*/

/*for search page*/
function txtSearchCall()
{
    if(document.getElementById(content + 'txtSearchText').value == '' )
    {
        document.forms[0].ctl00_ContentPlaceHolder1_TextBox1.value ="";
    }
    return;
}

function callOnBlankSearch()
{
   alert('error-blank');
}
/*ends here*/

/*Display Alert - call in Common Function*/
function getAlertBox(message)
{
    alert(message);
}
/*ends here*/


/*Inbox message*/
function callCheck()
{
    document.getElementById("ctl00_ContentPlaceHolder1_checkall").checked = false;
}
/*ends here*/


/* Import contacts using sailthru */

function call_invitecontact_layer_new() {
    document.getElementById("ctl00_ContentPlaceHolder1_text_toemails").value = "";
    document.getElementById("inv_con").style.visibility = "hidden";
    document.getElementById("imgpreloader_invc").style.visibility = "visible";

    var emailadd = document.getElementById('ctl00_ContentPlaceHolder1_txt_importemail').value;
    var dropsel = document.getElementById('ctl00_ContentPlaceHolder1_dd_webcontact').options[document.getElementById('ctl00_ContentPlaceHolder1_dd_webcontact').selectedIndex].value;
    var emailpassword = document.getElementById('ctl00_ContentPlaceHolder1_txt_importpass').value;
    var chkpage = document.getElementById("chkpg").value;

    if (emailadd == "" || dropsel == "0" || emailpassword == "") {
        alert("Enter EmailID or Enter Password or select the dropdown");
        document.getElementById("inv_con").style.visibility = "visible";
        document.getElementById("imgpreloader_invc").style.visibility = "hidden";
    }
    else {
        if (dropsel == "1") {
            dropsel = "gmail.com";
        }
        else if (dropsel == "2") {
            dropsel = "hotmail.com";
        }
        else if (dropsel == "3") {
            dropsel = "aol.com";
        }
        else if (dropsel == "4") {
            dropsel = "msn.com";
        }
        else if (dropsel == "5") {
            dropsel = "yahoo.com"
        }
        else if (dropsel == "6") {
            dropsel = "linkedin.com"
        }
        else if (dropsel == "7") {
            dropsel = "mac.com"
        }
        else if (dropsel == "8") {
            dropsel = "lycos.com"
        }

        var url_arg_send;
        url_arg_send = "useremail='" + emailadd + "'&emailext='" + dropsel + "'&emailpass='" + emailpassword + "'&chkpage='" + chkpage + "'";
        makePOSTRequest('/InviteContactList_New.aspx?enc=' + Base64.encode(url_arg_send), '', '7');
    }
}

/* Import contacts using sailthru ends here */

/*Call Invite Contacts*/
function call_invitecontact_layer()
{
    document.getElementById("ctl00_ContentPlaceHolder1_text_toemails").value = "";
   document.getElementById("inv_con").style.visibility="hidden";
   document.getElementById("imgpreloader_invc").style.visibility="visible";
    
    var emailadd = document.getElementById('ctl00_ContentPlaceHolder1_txt_importemail').value;
    var dropsel = document.getElementById('ctl00_ContentPlaceHolder1_dd_webcontact').options[document.getElementById('ctl00_ContentPlaceHolder1_dd_webcontact').selectedIndex].value;
    var emailpassword = document.getElementById('ctl00_ContentPlaceHolder1_txt_importpass').value;
    var chkpage = document.getElementById("chkpg").value;

    if(emailadd == "" || dropsel == "0" || emailpassword == "")
    {
        alert("Enter EmailID or Enter Password or select the dropdown");
        document.getElementById("inv_con").style.visibility="visible";
        document.getElementById("imgpreloader_invc").style.visibility="hidden";
    }
    else
    {
        if (dropsel=="1")
        {
          dropsel = "gmail.com";
        }
        else if(dropsel == "2")
        {
          dropsel = "yahoo.co.in";
        }
        else if(dropsel == "3")
        {
          dropsel = "yahoo.com";
        }
        else if(dropsel == "4")
        {
          dropsel = "hotmail.com";
        }
        else if(dropsel == "5")
        {      
          dropsel = "hotmail.com.linkedin"
        }
        
        var url_arg_send;
        url_arg_send = "useremail='" + emailadd + "'&emailext='" + dropsel + "'&emailpass='" + emailpassword + "'&chkpage='"+chkpage+"'";
        makePOSTRequest('/InviteContactList.aspx?enc=' + Base64.encode(url_arg_send), '', '7');      
    }
}

function showinvitecontact()
{
 if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
           
           if(result == "1")
           {
             alert("Received unexpected content");
             document.getElementById("inv_con").style.visibility="visible";
             document.getElementById("imgpreloader_invc").style.visibility="hidden";
           }
           else if(result == "2")
           {
             alert("Bad user name or password");
             document.getElementById("inv_con").style.visibility="visible";
             document.getElementById("imgpreloader_invc").style.visibility="hidden";
           }
           else if(result == "3")
           {
             alert("Email address not supported");
             document.getElementById("inv_con").style.visibility="visible";
             document.getElementById("imgpreloader_invc").style.visibility="hidden";
           }
           else if(result == "4")
           {
             alert("General http request exception");
             document.getElementById("inv_con").style.visibility="visible";
             document.getElementById("imgpreloader_invc").style.visibility="hidden";
           }
           else
           {
             document.getElementById("invite_contactfull").innerHTML = result;
             document.getElementById('invite_contactfull').style.display='block';
             document.getElementById('fade').style.display='block';
             alertSize();
             document.getElementById('invite_contactfull').style.left=(parseInt(myWidth/2) - 274) + "px";
           }
        }
        else
        {
           alert('There was a problem with the request: ' + http_request.status);
        }
    }
}

function submitadd_invitecontact(viewlist,emailcount,emailname, emailext,check)
{
    document.getElementById("ctl00_ContentPlaceHolder1_checkval").value = check;
    var emailchecked="";
    var uid="";
    var countfields=0;
    for (i = 1; i <= emailcount ; i++)
    {
        var checkbox1 = document.getElementById("chk_" + i).checked;
        if (checkbox1 == true)
        {
            if(countfields>0) emailchecked = emailchecked + ", ";
            emailchecked = emailchecked + document.getElementById("chk_" + i).value;
           
            if(check==1)
            {
                if(countfields>0) uid = uid + ", ";
                uid = uid + document.getElementById("hid_" + i).value;
            }
            countfields++;
        }
    }
    if(countfields > 20)
    {
        alert("You have selected "+countfields+" contacts.\nPlease select only 20 contacts.");
        return;
    }
    else if(countfields ==0)
    {
        alert("Please select your contact/s.");
        return;
    }
    else
    {
        close_invitecontact_layer(check);
        if(check==0)
        {
            
            document.getElementById("ctl00_ContentPlaceHolder1_txt_importemail").value = "";
            document.getElementById("ctl00_ContentPlaceHolder1_dd_webcontact").value ="0"
            document.getElementById("ctl00_ContentPlaceHolder1_txt_importpass").value="";
        }
        else
        {
            document.getElementById("ctl00_ContentPlaceHolder1_txt_socialemail").value="";
            document.getElementById("ctl00_ContentPlaceHolder1_DdlNetwork").selectedIndex = 0;
            document.getElementById("ctl00_ContentPlaceHolder1_txt_socialpass").value=""; 
        }
    }
    
    document.getElementById("ctl00_ContentPlaceHolder1_text_toemails").value=document.getElementById("ctl00_ContentPlaceHolder1_text_toemails").value + emailchecked;
    if(check==1)
    {
        document.getElementById("ctl00_ContentPlaceHolder1_text_toemails").readOnly=true;
        document.getElementById("ctl00_ContentPlaceHolder1_SocialUIDS").value= document.getElementById("ctl00_ContentPlaceHolder1_SocialUIDS").value + uid;
        document.getElementById("ctl00_ContentPlaceHolder1_SelectedSocialNetwork").value=emailext;
    }
    else
    {
        document.getElementById("ctl00_ContentPlaceHolder1_text_toemails").readOnly=false;
    }
    
    if(check==0)
    {
        document.getElementById("imgpreloader_invc").style.visibility="hidden";
        document.getElementById("inv_con").style.visibility="visible";
    }
    else
    {
        document.getElementById("soc_con").style.visibility="visible";
        document.getElementById("imgpreloader_soc").style.visibility="hidden";
    }

    
}
/*ends here*/

/*Chitchat*/
function callchat(catid)
{
    window.location = siteURL+ "/ChitChat.aspx?pass=" + Base64.encode("Chittext=''&catid=" + catid );
}
/*ends here*/

/*Sponsore SD landing page - Flag As Inappropriate*/
function sponFlagEmail(stremailId,chkpg,sdcap,sdcmt,sdid,comntid,somdayid)
{
    stremailId =  stremailId.replace(/^\s*(\S*(\s+\S+)*)\s*$/, '$1');
    xmlHttp=getXmlHttpObject();
    if (xmlHttp==null)
    {
        alert (geterrmsg('e51'));
        return;
    } 
    if(stremailId =="")
    {
        alert(geterrmsg('e154'));
        return;
    }
    var url="/SponsoredFlag.aspx";
    url=url+"?email=" + stremailId+"&chkpg="+chkpg+"&caption="+Base64.encode(sdcap)+"&comment="+Base64.encode(sdcmt)+"&somid="+sdid+"&commentid="+comntid+"&somdayid="+somdayid;
    
    makePOSTRequest(url,'','173');

}

function emailFlag_stateChanged() 
{ 
    if (http_request.readyState==4)
	{ 			 
	  if (http_request.status == 200)
	  {
	        result = http_request.responseText;   
	        if (result == "1")
		    {
		        alert(geterrmsg('e60'));
		        
		        window.location.reload(); 
		    }
		    else
		    {
		        alert(geterrmsg('e50'));
		    }
       }
        else
        {
            alert(geterrmsg('e50'));
        }
	}
}

function showMedia() 
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
          
           rec_count=result.split("^^^^");
           var somedaytypes = rec_count[0];
           var pagerecord = rec_count[1];
           var datapagerecord = rec_count[2];
           var new1 = rec_count[3];
           var pgcount = rec_count[4];
           var newwh = rec_count[5];
           if(datapagerecord.toString().search(',') != -1)
           {
             valIds = datapagerecord.split(',');
             document.getElementById("imgDis_"+valIds[0]).style.display='block';
             document.getElementById("imgDis_"+valIds[1]).style.display='block';
           }
           else
           {
             document.getElementById("imgDis_"+datapagerecord).style.display='block';
           }
           var hideIDs = document.getElementById(content+"hidimgids").value;
           if(hideIDs.toString().search(',') != -1)
           {
                hidImgs = hideIDs.split(',');
                document.getElementById("imgDis_"+hidImgs[0]).style.display='none';
                document.getElementById("imgDis_"+hidImgs[1]).style.display='none';
           }
           else{
            document.getElementById("imgDis_"+hideIDs).style.display='none';
           }
           document.getElementById(content+"hidimgids").value = datapagerecord;
            var newstart;
            newstart =1;
            if (new1 > 5)
            {
              if (newwh == 0)
              {
                  newstart = ((new1 - 5) + 1);
              }
              else
              {
                  newstart = ((new1 - newwh) + 1);
              }
            }
           document.getElementById("div_paging").innerHTML = pagerecord;
         
           jQuery(document).ready(function() {
	         jQuery('#invite-carousel1').jcarousel({
	            horizontal: true,
                scroll:5,
                start:newstart
            });
            });
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}


function showMedia_charitable() 
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
          
           rec_count=result.split("^^^^");
           var somedaytypes = rec_count[0];
           var pagerecord = rec_count[1];
           var datapagerecord = rec_count[2];
           var new1 = rec_count[3];
           var pgcount = rec_count[4];
           var newwh = rec_count[5];
           if(datapagerecord.toString().search('&') != -1)
           {
             valIds = datapagerecord.split('&');
             if(valIds[1].toString().search(',') != -1)
             {
                disIDs = valIds[1].split(',');
                document.getElementById("imgDis_"+disIDs[0]).style.display='block';
                document.getElementById("imgDis_"+disIDs[1]).style.display='block';
             }
             else
             {
                document.getElementById("imgDis_"+valIds[1]).style.display='block';
             }
             
             if(valIds[0].toString().search(',') != -1)
             {
                disIDs2 = valIds[0].split(',');
                document.getElementById("imgDis_"+disIDs2[0]).style.display='block';
                document.getElementById("imgDis_"+disIDs2[1]).style.display='block';
             }
             else
             {
                document.getElementById("imgDis_"+valIds[0]).style.display='block';
             }
           }
           else
           {
                 if(datapagerecord.toString().search(',') != -1)
                 {
                    disIDs = datapagerecord.split(',');
                    document.getElementById("imgDis_"+disIDs[0]).style.display='block';
                    document.getElementById("imgDis_"+disIDs[1]).style.display='block';
                 }
                 else
                 {
                    document.getElementById("imgDis_"+datapagerecord).style.display='block';
                 }
           }
           var hideIDs = document.getElementById(content+"hidimgids").value;
           if(hideIDs.toString().search('&') != -1)
           {
                hidImgs = hideIDs.split('&');
                if(hidImgs[1].toString().search(',') !=-1)
                {
                    hidvals = hidImgs[1].split(',');
                    document.getElementById("imgDis_"+hidvals[0]).style.display='none';
                    document.getElementById("imgDis_"+hidvals[1]).style.display='none';
                }
                else
                {
                    document.getElementById("imgDis_"+hidImgs[1]).style.display='none';
                }
                
                if(hidImgs[0].toString().search(',') !=-1)
                {
                    hidvals = hidImgs[0].split(',');
                    document.getElementById("imgDis_"+hidvals[0]).style.display='none';
                    document.getElementById("imgDis_"+hidvals[1]).style.display='none';
                }
                else
                {
                    document.getElementById("imgDis_"+hidImgs[0]).style.display='none';
                }
           }
           else
           {
                if(hideIDs.toString().search(',') !=-1)
                {
                    hidvals = hideIDs.split(',');
                    document.getElementById("imgDis_"+hidvals[0]).style.display='none';
                    document.getElementById("imgDis_"+hidvals[1]).style.display='none';
                }
                else
                {
                    document.getElementById("imgDis_"+hideIDs).style.display='none';
                }
           }
           document.getElementById(content+"hidimgids").value = datapagerecord;
            var newstart;
            newstart =1;
            if (new1 > 5)
            {
              if (newwh == 0)
              {
                  newstart = ((new1 - 5) + 1);
              }
              else
              {
                  newstart = ((new1 - newwh) + 1);
              }
            }
           document.getElementById("div_paging").innerHTML = pagerecord;
         
           jQuery(document).ready(function() {
	         jQuery('#invite-carousel1').jcarousel({
	            horizontal: true,
                scroll:5,
                start:newstart
            });
            });
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}

/*End of media Paging*/
/*Sponsored sd - Using this Plan Paging*/
function pagedata_usingPlan(pgno,pgcount,recordsperpage,planId,type)
{
        var recordsper = recordsperpage;
        var url_arg;
        url_arg = "pgcount=" + pgcount + "&perpage=" + recordsper + "&currentpg=" + pgno + "&plan=" + planId + "&type=" + type;
        makePOSTRequest('/Ajax-UsingPlan.aspx?enc=' + Base64.encode(url_arg), '', '9');            
}

function showUsingPlan() 
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
          
           rec_count=result.split("^^^^");
           var somedaytypes = rec_count[0];
           var pagerecord = rec_count[1];
           var datapagerecord = rec_count[2];
           var new1 = rec_count[3];
           var pgcount = rec_count[4];
           var newwh = rec_count[5];
           var type = rec_count[6];
           
            var newstart;
            newstart =1;
            if (new1 > 5)
            {
              if (newwh == 0)
              {
                  newstart = ((new1 - 5) + 1);
              }
              else
              {
                  newstart = ((new1 - newwh) + 1);
              }
            }
            
            document.getElementById("div_UsingPaging").innerHTML = pagerecord;
            jQuery(document).ready(function() {
            jQuery('#invite-carousel').jcarousel({
            horizontal: true,
            scroll:5,
            start:newstart
            });
            });

            document.getElementById("div_UsingData").innerHTML = datapagerecord;
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}


function addch()
{
    document.getElementById("ctl00_ContentPlaceHolder1_savebutton").style.visibility ="hidden";
    document.getElementById("ctl00_ContentPlaceHolder1_imgpreloader").style.visibility ="visible"; 
}

/*Contact us layer*/

function contactus()
{
    var name = document.getElementById("ctl00_TextBox3").value;
    var email = document.getElementById("ctl00_txt_title").value;
    var reason = document.getElementById("ctl00_dd_Categories").value;
    var message = document.getElementById("ctl00_txt_message").value;
    
    if(name == "")
    {
        alert(geterrmsg('e100'));
        return;
    }
    if(email == "")
    {
        alert(geterrmsg('e101'));
        return;
    }
    if(reason == "Select")
    {
        alert(geterrmsg('e102'));
        return;
    }
    if(message == "")
    {
        alert(geterrmsg('e103'));
        return;
    }
    
    if (!validateEmail(email))
    {
        alert(geterrmsg('e62'));
        return;
    }
    
    document.getElementById("consubbtn").style.display="none";
    document.getElementById("contactpreloader").style.display="block";
    var url = "nam="+name+"&email="+email+"&reason="+reason+"&mess="+message;
    makePOSTRequest("/contactus.aspx?lnk="+ Base64.encode(url),'',"11");
}

  function validateEmail(id)
  {
    var expression = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
    return expression.test(id);
  }

function showcontactus()
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
            var result = http_request.responseText;
            if(result =="successful")   
            {
                alert(geterrmsg('e104'));
                window.location.reload("/Default_home.aspx");
                document.getElementById("ctl00_TextBox3").value = '';
                document.getElementById("ctl00_txt_title").value = '';
                document.getElementById("ctl00_dd_Categories").value = '';
                document.getElementById("ctl00_txt_message").value = '' ;
            }
            else
            {
                alert(geterrmsg('e105'));
                document.getElementById("consubbtn").style.display="block";
                document.getElementById("contactpreloader").style.display="none";
                
            }
        }
        else
        {
            alert("There is some problem with request "+ http_request.status);
        }
    }
}
/*ends here*/



/*Compose Message checkall functionality for the friend list*/
function checked_true(ObjID) 
{
   var chkids="";
   
   if(document.getElementById("chk_mess").checked == true)
   {
        for (i=0; i < document.aspnetForm.elements.length; i++) 
        {
            
            if ((document.aspnetForm.elements[i].type == 'checkbox') && (document.aspnetForm.elements[i].name.indexOf('chk_search') > -1)) 
            {
                   document.aspnetForm.elements[i].checked = true;
                   if (document.aspnetForm.elements[i].checked == true)
                    {
                        if(chkids == "")
                        {
                            chkids = document.aspnetForm.elements[i].value;
                        }
                       else
                       {
                            chkids = chkids + "," + document.aspnetForm.elements[i].value;
                       }
                    }       
            }
        }
        document.aspnetForm.ctl00$ContentPlaceHolder1$to_name.value = chkids;
   }
   else
   {
       for (i=0; i < document.aspnetForm.elements.length; i++) 
        {
            
            if ((document.aspnetForm.elements[i].type == 'checkbox') && (document.aspnetForm.elements[i].name.indexOf('chk_search') > -1)) 
            {
                   document.aspnetForm.elements[i].checked = false;
            }
        }
        document.aspnetForm.ctl00$ContentPlaceHolder1$to_name.value = "";
    }
}

function DispName()
{
    var chkids="";
    for (i=0; i < document.aspnetForm.elements.length; i++) 
    {
        if ((document.aspnetForm.elements[i].type == 'checkbox') && (document.aspnetForm.elements[i].name.indexOf('chk_search') > -1)) 
        {
                if (document.aspnetForm.elements[i].checked == true)
                {
                    if(chkids == "")
                    {
                        chkids = document.aspnetForm.elements[i].value;
                    }
                   else
                   {
                        chkids = chkids + "," + document.aspnetForm.elements[i].value;
                   }
                }  
                else{
                    document.getElementById("chk_mess").checked = false;
                }          
        }
    }
    document.aspnetForm.ctl00$ContentPlaceHolder1$to_name.value = chkids;
}
/*ends here*/

/*Friends sorting functionality in the user profile section*/
function sort_friends(varcheck, varcurrentpg, varuserid, varpgcount, recordsperpage)
{
    var urlsend;
    urlsend = "varcheck=" + varcheck + "&varuserid=" + varuserid + "&currpg=" + varcurrentpg + "&varpgcount=" + varpgcount + "&recordsperpg=" + recordsperpage + ""
    makePOSTRequest('/Ajax-alphsort-friends.aspx?enc=' + Base64.encode(urlsend),'','26');
}

/*Recently active friends*/
function pagefriends(flag,currentpage,userid,pgcount,recordsperpage)
{
        var url_arg;
        url_arg = "pgcount=" + pgcount + "&perpage=" + recordsperpage + "&currentpg=" + currentpage + "&userid=" + userid + "";
        makePOSTRequest('/Ajax-friends.aspx?enc=' + Base64.encode(url_arg), '', '26');
}

function showbindactivefriends()
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
          
           rec_count=result.split("^^^^");

           var pagerecord = rec_count[0];
           var datapagerecord = rec_count[1];
           var new1 = rec_count[2];
           var pgcount = rec_count[3];
           var newwh = rec_count[4];
           var linkfriends = rec_count[5];
         
            var newstart =1;
            if (new1 > 5)
            {
              if (newwh == 0)
              {
                  newstart = ((new1 - 5) + 1);
              }
              else
              {
                  newstart = ((new1 - newwh) + 1);
              }
            }
          document.getElementById("friends_paging").innerHTML = pagerecord;
         
           jQuery(document).ready(function() {
	         jQuery('#friends-carousel').jcarousel({
	            horizontal: true,
                scroll:5,
                start:newstart
            });
            });
            document.getElementById("friendsort").innerHTML = linkfriends;
            document.getElementById("frienddata").innerHTML = datapagerecord;
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}
/**/

function callsubmitinvitecontact()
{
    var txtto = document.getElementById("ctl00_ContentPlaceHolder1_text_toemails").value;
    var txtmsg = document.getElementById("ctl00_ContentPlaceHolder1_txt_messages").value;
    var txtfrom = document.getElementById("hidfromid").value;
    
    var urlinvite;
    urlinvite ="txtto='" + txtto + "'&txtmsgs='" + txtmsg + "'&txtfrom='" + txtfrom;
}


function close_invitecontact_layer(type)
{
  
    if(type==0){
    document.getElementById("ctl00_ContentPlaceHolder1_txt_importemail").value = "";
    document.getElementById("ctl00_ContentPlaceHolder1_dd_webcontact").value ="0"
    document.getElementById("ctl00_ContentPlaceHolder1_txt_importpass").value="";
    document.getElementById("inv_con").style.visibility="visible";
    document.getElementById("imgpreloader_invc").style.visibility="hidden";
    }
    
    if(type==1){
    document.getElementById("ctl00_ContentPlaceHolder1_txt_socialemail").value="";
    document.getElementById("ctl00_ContentPlaceHolder1_DdlNetwork").selectedIndex = 0;
    document.getElementById("ctl00_ContentPlaceHolder1_txt_socialpass").value="";
    document.getElementById("soc_con").style.visibility="visible";
    document.getElementById("imgpreloader_soc").style.visibility="hidden";
    }
    document.getElementById('invite_contactfull').style.display='none';
    document.getElementById('fade').style.display='none';
}


function call_socialcontact_layer()
{
    document.getElementById("ctl00_ContentPlaceHolder1_text_toemails").value = "";
    document.getElementById("soc_con").style.visibility="hidden";
    document.getElementById("imgpreloader_soc").style.visibility="visible";
    var emailadd = document.getElementById('ctl00_ContentPlaceHolder1_txt_socialemail').value;
    var dropsel = document.getElementById('ctl00_ContentPlaceHolder1_DdlNetwork').options[document.getElementById('ctl00_ContentPlaceHolder1_DdlNetwork').selectedIndex].value;
    var emailpassword = document.getElementById('ctl00_ContentPlaceHolder1_txt_socialpass').value;
    var chkpg = document.getElementById("chkpg").value;
    
    if(emailadd == "" || dropsel == "0" || emailpassword == "")
    {
        alert("Enter EmailID or Enter Password or select the dropdown");
        document.getElementById("soc_con").style.visibility="visible";
        document.getElementById("imgpreloader_soc").style.visibility="hidden";
    }
    else
    {
        var url_arg_send;
        url_arg_send = "useremail=" + emailadd + "&emailext=" + dropsel + "&emailpass=" + emailpassword + "&chkpage='"+chkpg;
        document.getElementById("ctl00_ContentPlaceHolder1_acc").value = Base64.encode(url_arg_send);
        makePOSTRequest('/InviteSender.aspx?enc=' + Base64.encode(url_arg_send), '', '14');      
    } 
}


function showsocialcontact()
{
 if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
           
           if(result == "1")
           {
             alert("Sorry, bad user name or password");
             document.getElementById("soc_con").style.visibility="visible";
             document.getElementById("imgpreloader_soc").style.visibility="hidden";
           }
           else if(result == "2")
           {
             alert("Server error. Received unexpected content");
             document.getElementById("soc_con").style.visibility="visible";
             document.getElementById("imgpreloader_soc").style.visibility="hidden";
           }
           else if(result == "3")
           {
             alert("General http request exception");
             document.getElementById("soc_con").style.visibility="visible";
             document.getElementById("imgpreloader_soc").style.visibility="hidden";
           }
           else
           {
                document.getElementById("invite_contactfull").innerHTML = result;
                document.getElementById('invite_contactfull').style.display='block';
                document.getElementById('fade').style.display='block';
                alertSize();
                document.getElementById('invite_contactfull').style.left=(parseInt(myWidth/2) - 274) + "px";
           }
        }
        else
        {
           alert('There was a problem with the request: ' + http_request.status);
        }
    }
}
/******Notification *************************/
function delNotificationMessages()
{
 var delids="";

    for (i=0; i < document.aspnetForm.elements.length; i++) 
    {
        if ((document.aspnetForm.elements[i].type == 'checkbox') && (document.aspnetForm.elements[i].name.indexOf('chk_del') > -1)) 
        {
                if (document.aspnetForm.elements[i].checked == true)
                {
                    if(delids == "")
                    {
                        delids = document.aspnetForm.elements[i].value;
                    }
                   else
                   {
                        delids = delids + "," + document.aspnetForm.elements[i].value;
                   }
                }            
        }
     }
     
     if(delids !="")
     {
        var urldel = "ids="+delids;
        makePOSTRequest('/deleteNotification.aspx?lnk=' + Base64.encode(urldel),'','23');
     }
     else
     {
        alert(geterrmsg('e106'));
        return;
     }
}
/********************* Notification **************/


function delMessages()
{
    var delids="";
    for (i=0; i < document.aspnetForm.elements.length; i++) 
    {
        if ((document.aspnetForm.elements[i].type == 'checkbox') && (document.aspnetForm.elements[i].name.indexOf('chk_del') > -1)) 
        {
                if (document.aspnetForm.elements[i].checked == true)
                {
                    if(delids == "")
                    {
                        delids = document.aspnetForm.elements[i].value;
                    }
                   else
                   {
                        delids = delids + "," + document.aspnetForm.elements[i].value;
                   }
                }            
        }
     }
     
     if(delids !="")
     {
        var urldel = "ids="+delids;
        makePOSTRequest('/DeleteMessages.aspx?lnk=' + Base64.encode(urldel),'','23');
     }
     else
     {
        alert(geterrmsg('e106'));
        return;
     }
}

function showInbox()
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
           if (result == "1")
           {
               window.location.reload("/inboxmessage.aspx");
           }
           else
           {
             return;
           }
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}

function blocksender()
{
    var messid="";
    for (i=0; i < document.forms[1].elements.length; i++) 
    {
        if ((document.forms[1].elements[i].type == 'checkbox') && (document.forms[1].elements[i].name.indexOf('chk_del') > -1)) 
        {
                if (document.forms[1].elements[i].checked == true)
                {
                    if(messid == "")
                    {
                        messid = document.forms[1].elements[i].value;
                    }
                   else
                   {
                        messid = messid + "," + document.forms[1].elements[i].value;
                   }
                }            
        }
     }
     
     if(messid !="")
     {
        var urlmess = "ids="+messid;
        makePOSTRequest('/BlockSender.aspx?lnk=' + Base64.encode(urlmess),'','24');
     }
     else
     {
        return;
     }
}


function DeleteSentMessages()
{
    var messid="";
    for (i=0; i < document.aspnetForm.elements.length; i++) 
    {
        if ((document.aspnetForm.elements[i].type == 'checkbox') && (document.aspnetForm.elements[i].name.indexOf('chk_') > -1)) 
        {
                if (document.aspnetForm.elements[i].checked == true)
                {
                    if(messid == "")
                    {
                        messid = document.aspnetForm.elements[i].value;
                    }
                   else
                   {
                        messid = messid + "," + document.aspnetForm.elements[i].value;
                   }
                }            
        }
     }
     
     if(messid !="")
     {
        var urlmess = "ids="+messid;
        makePOSTRequest('/DeleteSentMessages.aspx?lnk=' + Base64.encode(urlmess),'','25');
     }
     else
     {
        alert(geterrmsg('e106'));
        return;
     }
}

function showSentMessages()
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
           if (result == "1")
           {
               window.location.reload("/inboxsent.aspx");
           }
           else
           {
             return;
           }
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}


String.prototype.replaceAll=function(s1, s2) {
        return this.replace(new RegExp(s1,"g"), s2);
}

function callstepsave()
{
    document.getElementById("preloadstepsave").style.display='block';
    document.getElementById("ctl00_ContentPlaceHolder1_checklinkbutton").style.display='none';
    var deadline;
    if (trim(document.getElementById('ctl00_ContentPlaceHolder1_txtNewStep').value))
    {
        var newstep = document.getElementById('ctl00_ContentPlaceHolder1_txtNewStep').value;
        newstep = newstep.replaceAll('[&]','amp;');
        newstep = newstep.replaceAll('[=]','amp61;');
//        newstep = newstep.replaceAll('[>]','amp#62;');
//        newstep = newstep.replaceAll('[<]','amp#60;');
        var ratestep = document.getElementById('ctl00_ContentPlaceHolder1_ddlRateStep').value;
        var reminderstep = document.getElementById('ctl00_ContentPlaceHolder1_ddlReminder').value;
        if (trim(document.getElementById('ctl00_ContentPlaceHolder1_txtDeadline').value) != "Deadline")
        {
            deadline = document.getElementById('ctl00_ContentPlaceHolder1_txtDeadline').value;
        }
        else
        {
            deadline = "0";
        }
            
        var planid = document.getElementById('ctl00_ContentPlaceHolder1_hdnPlanId').value;
        var userid = document.getElementById('ctl00_ContentPlaceHolder1_usercookieid').value;
        var somedayid = document.getElementById('ctl00_ContentPlaceHolder1_hdnSomedayId').value;
      
        if (reminderstep == "")
        {
            reminderstep = "0";
        }
        
        if (newstep != "")
        {
            var url_arg_send;
            url_arg_send = "newstep=" + newstep + "&ratestep='" + ratestep + "'&reminder='" + reminderstep + "'&deadline='" + deadline + "'&planid='" + planid + "'&userid='" + userid + "'&somedayid='" + somedayid + "'";            
            makePOSTRequest('/Blueprint-step-save.aspx',url_arg_send,'27');
        }
        else
        {
            alert("Enter Step Description");
            document.getElementById("ctl00_ContentPlaceHolder1_checklinkbutton").style.display='block';
            document.getElementById("preloadstepsave").style.display='none';
        }
    }
    else
    {
        alert("Enter Step Description");
        document.getElementById("ctl00_ContentPlaceHolder1_checklinkbutton").style.display='block';
        document.getElementById("preloadstepsave").style.display='none';
    }
}


function trim(str)
{
    if(!str || typeof str != 'string')
        return null;

    return str.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');
}

function bindstep()
{
    document.getElementById("preloadstepsave").style.display='block';
    document.getElementById("ctl00_ContentPlaceHolder1_checklinkbutton").style.display='none';
     if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
           document.getElementById("div_plan").innerHTML = result;
           document.getElementById('ctl00_ContentPlaceHolder1_txtNewStep').value="";
           document.getElementById('ctl00_ContentPlaceHolder1_ddlRateStep').value="0";
           document.getElementById('ctl00_ContentPlaceHolder1_ddlReminder').value="0";
           document.getElementById('ctl00_ContentPlaceHolder1_txtDeadline').value="Deadline";
           document.getElementById("preloadstepsave").style.display='none';
           document.getElementById("ctl00_ContentPlaceHolder1_checklinkbutton").style.display='block';
        }
        else
        {
           alert('There was a problem with the request: ' + http_request.status);
        }
    }
}

function chkAvailability()
{
    var usernm = trim(document.getElementById("ctl00_ContentPlaceHolder1_txtEnterUName").value);
    if(usernm !="")
    {
        var regex=/^[0-9A-Za-z_]+$/; 
        if(regex.test(usernm))
        {
            if(usernm !=null)
            {
                var url ="";
                var urldat ="usn="+usernm;
                url = "/UserNameAvailability.aspx?lnk="+Base64.encode(urldat);
                makePOSTRequest(url,'','30');
            }
            else
            {
                alert(geterrmsg('e46'));
                return;
            }
        }
         else 
         {
            alert(geterrmsg('e168'))
            return;
         }

   }
   else
   {
       alert(geterrmsg('e46'));
       return;
   }
}

function showRegispage()
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
           if (result == "1")
           {
               alert(geterrmsg('e151'));
               document.getElementById("ctl00_ContentPlaceHolder1_txtEnterPass").focus();
               return;
           }
           else
           {
                alert(geterrmsg('e150'));
                document.getElementById("ctl00_ContentPlaceHolder1_txtEnterUName").focus();
             return;
           }
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}

function toggleOptWindow()
{
		if(document.getElementById("id_login").style.visibility != "visible")
		{
			var arrayPageSize = getPageSize(1);
			var objOverlay = document.getElementById('id_login');
			objOverlay.style.height = (arrayPageSize[1] + 'px');
			objOverlay.style.display = 'block';
			
			var objOverlayIframe = document.getElementById('fade');
			objOverlayIframe.style.height = (arrayPageSize[1] + 'px');
			objOverlayIframe.style.display = 'block';
		}
		else
		{
			var objOverlay = document.getElementById('overlay');
			var objOverlayIframe = document.getElementById('overlayiframe');
			objOverlay.style.display = 'none';
			objOverlayIframe.style.display = 'none';
		}
		
		newVisibility = (document.getElementById("modalwin").style.visibility != "visible") ? "visible" : "hidden";
		// center modal
		
		getwindowdims();
		s_x = getpagescrollx();
		s_y = getpagescrolly();
	
		// to center the window we need to know the window width and height	
		startx = s_x + ((w_x / 2) - (443 /2));
		starty = s_y + ((w_y / 2) - (179 /2));
	
		document.getElementById("modalwin").style.left = startx + "px";
		document.getElementById("modalwin").style.top = starty + "px";
		
		document.getElementById("modalwin").style.visibility = newVisibility;
		scroll(startx,starty - 200);
}

function getwindowdims()
{
	w_y=(is_ie4up)?document.body.clientHeight:window.innerHeight;
	w_x=(is_ie4up)?document.body.clientWidth:window.innerWidth;
}

function getpagescrolly(){
if(is_ie4up)return document.body.scrollTop;
else return window.pageYOffset;
}

function getpagescrollx(){
if(is_ie4up)return document.body.scrollLeft;
else return window.pageXOffset;
}



function flagasinapp(somcap)
{
    var url= "somd="+somcap;
    makePOSTRequest("/Ajax-flagIn.aspx?lnk="+Base64.encode(url),'','35');
}

function showOwnerpage()
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
           if (result == "1")
           {
               alert(geterrmsg('e59'));
               return;
           }
           else
           {
                alert(geterrmsg('e105'));
                return;
           }
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}


function showcharitablepage_1()
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
            if (result == "1")
           {
               alert(geterrmsg('e181'));
               return;
           }
           else
           {
                alert(geterrmsg('e182'));
                var sid= document.getElementById("ctl00_ContentPlaceHolder1_hdnurlencrypt").value;
                window.location.reload("/CharitableSomedays.aspx?lnk="+sid);
           }

        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}

function add_charitable(somedayid)
{
        var url_arg;
        url_arg = "somedayid=" + somedayid;
        makePOSTRequest('/Ajax-Charitable.aspx?enc=' + Base64.encode(url_arg), '', '50');            
}



function validateZipCode(id)
{
   var reg = /^\d+$/;
    return reg.test(id); 
}

function validatePassword(id)
{
    var reg = /^[a-zA-Z0-9_\@\~\$\!\:\.\#\&\^\`\*\|\{\}\-]+$/;
    return reg.test(id); 
}

function validateUploadImage(chkUp)
{
    if(chkUp=="photo")
    {
        document.getElementById("ctl00_ContentPlaceHolder1_uploadpht").style.display="none";
        document.getElementById("ctl00_ContentPlaceHolder1_uploadpre").style.display="block";
    }
    var valid=true;
  
    var errorstr="The following fields are not proper:" +  '\r\n' ;
    
        if(document.getElementById("ctl00_ContentPlaceHolder1_file1")!=null)
        {
            if(document.getElementById("ctl00_ContentPlaceHolder1_file1").value!="")
            {
            
               if(!validateImageExtension(document.getElementById("ctl00_ContentPlaceHolder1_file1")))
                {
                 
                errorstr=errorstr +  '\r\n' + geterrmsg('e66');
                
                 var valid=false;
                }
           
            }
             else
            {
                errorstr=errorstr +'\r\n' + 'Please select your photo';
                valid=false;
            
            }
        }
    if(valid==false)
    {
        errorstr=errorstr +  '\r\n';
        alert(errorstr);       
        if(chkUp=="photo")
        {
            document.getElementById("ctl00_ContentPlaceHolder1_uploadpht").style.display="block";
            document.getElementById("ctl00_ContentPlaceHolder1_uploadpre").style.display="none";
        }
    }
    else
    {
        if(document.getElementById("ctl00_ContentPlaceHolder1_file1").value!=""){
        getWindowSize();
        }
    }
    return valid;
}

function validateUploadVideo()
{
    var valid=true;
  
    var errorstr="The following fields are not proper:" +  '\r\n' ;
     
    if(document.getElementById("FileUploadedVideo").value!="")
    {
       if(!validateVideoExtension(document.getElementById("FileUploadedVideo")))
        {
            errorstr=errorstr +  '\r\n' + geterrmsg('e66');
            var valid=false;
        }
        else
        {
        if(document.getElementById("ctl00_ContentPlaceHolder1_chk_certified")!=null){
            if(document.getElementById("ctl00_ContentPlaceHolder1_chk_certified").checked==false)
            {  
                errorstr=errorstr +'\r\n' + 'You have not tick the check box';
                valid=false;
            }
          }
        }
    }
    else
    {
        errorstr=errorstr +'\r\n' + 'Please select your video';
        valid=false;
    }
   
    if(valid==false)
    {
        errorstr=errorstr +  '\r\n';
        alert(errorstr);       
    }
    else
    {
        if(document.getElementById("ctl00_ContentPlaceHolder1_file2").value!=""){
        getWindowSize();
    }
    }
    return valid;
}


function checkChatRep()
{
    var txtch = document.getElementById("ctl00_ContentPlaceHolder1_txt_chat_reply").value;
    txtch = txtch.replace(/^\s*(\S*(\s+\S+)*)\s*$/, '$1');
    if(txtch =="")
    {
        alert(geterrmsg('e152'));
    }
    return;
}


function validateInputFields()
{
    var valid=true;
  
    var errorstr="The following fields are incomplete:" +  '\r\n' ;
    if (validateEmail(trim(document.getElementById("ctl00_ContentPlaceHolder1_txt_editEmail").value)) == false)
    {
        errorstr=errorstr +'\r\n' + geterrmsg('e9');
        valid=false;
    }
    
    if(trim(document.getElementById("ctl00_ContentPlaceHolder1_txt_editZip").value)!=null){
    
    
    if(validateZipCode(document.getElementById("ctl00_ContentPlaceHolder1_txt_editZip").value) == false)
    {
        errorstr=errorstr +'\r\n' + geterrmsg('e36');
        valid=false;    
    }
    }
    if( removeSpaces(document.getElementById("ctl00_ContentPlaceHolder1_txt_editFName").value)=="")
    {
        errorstr=errorstr +'\r\n' + geterrmsg('e2');
        valid=false;  
    }
    if(removeSpaces(document.getElementById("ctl00_ContentPlaceHolder1_txt_editLName").value)=="")
    {
        errorstr=errorstr +'\r\n' + geterrmsg('e513');
        valid=false;  

    }
    if(document.getElementById("ctl00_ContentPlaceHolder1_txt_pass").value != ((document.getElementById("ctl00_ContentPlaceHolder1_txt_pass").value.toString().replace(' ',"" ))))
    {
            errorstr=errorstr +'\r\n' + geterrmsg('e514');
             valid=false; 
    }

    if(trim(document.getElementById("ctl00_ContentPlaceHolder1_txt_pass").value)!=null)
    {
        if((trim(document.getElementById("ctl00_ContentPlaceHolder1_txt_pass").value))!=(trim(document.getElementById("ctl00_ContentPlaceHolder1_txt_confirm").value)))
        {    
             errorstr=errorstr +'\r\n' + geterrmsg('e156');
             valid=false;   
        }
        else if(validatePassword(document.getElementById("ctl00_ContentPlaceHolder1_txt_pass").value)== false)
        {
            errorstr=errorstr +'\r\n' + geterrmsg('e169');
             valid=false;         
        }
    }
    else
    {
        if(trim(document.getElementById("ctl00_ContentPlaceHolder1_txt_confirm").value)!=null)
        {
            errorstr=errorstr +'\r\n' + geterrmsg('e157');
            valid=false;
        }
    }

    
    if(valid==false)
    {
        errorstr=errorstr +  '\r\n';
        alert(errorstr);
       
    }     
     return valid;
}


function replyAlert()
{
    var checkvalid;
    if (trim(document.getElementById('ctl00_ContentPlaceHolder1_txtReplyComments').value))
    {
      checkvalid = true;
    }
    else
    {
      alert(geterrmsg('e183'));
      checkvalid = false;
    }
    return checkvalid;
}


function disableEnterKey(e)
{
     var key;      
     if(window.event)
          key = window.event.keyCode; //IE
     else
          key = e.which; //firefox      

     return (key != 13);
}


function removeText(cid)
{
    document.getElementById(cid).select();
//    if (document.getElementById(cid).value != "") {
//        document.getElementById(cid).value = "";
//    }
//    else {
//        document.getElementById(cid).value = "Search by Name";
//     }
     return;
}

function searchfn()
{
        var kew = document.getElementById("ctl00_txt_key").value;
        var ddl = document.getElementById("ctl00_DropDownList1").value;
        kew = kew.replace(/^\s*(\S*(\s+\S+)*)\s*$/, '$1');
        if(kew=="Search by keyword")
        {
            kew="";
        }
        if(kew=="" && ddl=="0")
        {
            alert(geterrmsg('e153'));
        }
        else
        {
            window.location = "/Search.aspx?msl="+ Base64.encode("cat="+ddl+"&kw="+kew);
        }
}

function callfr(i)
{
    getPageSize(2);
    var pr = i;
       
    var url = "/PlayVideo.aspx?vdo=" + pr + "";
    window.open(url,null,"height=330,width=420, top=225, left=325, status=no,toolbar=no,menubar=no,location=no");
}

function overViewRestrict(obj, length)
{

var maxlength=length
if (obj.value.length>maxlength)
obj.value=obj.value.substring(0, maxlength)
}

function deleteComment(cmtid,type)
{
      var url="";
      var chkcmt = confirm("Do you want to delete this comment?");
      if(chkcmt == true)
      {
          url = "/Ajax-Comments.aspx?cmid="+cmtid+"&typ="+type;
          makePOSTRequest(url, '', '55');
      }
      else
      {
        return;
      }         
}
function markHelpful(toid,type)
{
      var url="";
      url = "/Ajax-Comments.aspx?somto="+toid+"&typ="+type;
      makePOSTRequest(url, '', '55');      
}
function showOwnerPageRel()
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
           typRes = result.split("^^^^");
           if (typRes[0] != "0")
           {
               if(typRes[0]=="1")
               {
                    var planid= document.getElementById("ctl00_ContentPlaceHolder1_hdnSomedayId").value;
                    var url = "planid="+planid;
                    window.location.reload("/SomedayOwner.aspx?plan="+Base64.encode(url));
               }
               if(typRes[0] =="2")
               {
                    alert(typRes[1] + geterrmsg('e161'));
                    var planid= document.getElementById("ctl00_ContentPlaceHolder1_hdnSomedayId").value;
                    var url = "planid="+planid;
                    window.location.reload("/SomedayOwner.aspx?plan="+Base64.encode(url));
               }
           }
           else
           {
             return;
           }
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}

function keyPress(e,type)
{
    if (e.keyCode == 13) {
        if (type == "Login") loginValidate();
        if (type == "LoginCopy") loginValidateCopy();
        if (type == "Search") searchfn();
        if (type == "SearchUsers") searchuser();
        if (type == "Splash") loginValidateMembers('buttonid', 'imgpreload');
        if (type == "Register") loginValidateMembers('sbtnid', 'preloader');
        if (type == "Default") return true;
        if (type == "Searchtxt") return true;
        if (type == "Searchreplytxt") return true;
        return false;
    }
}

/*Call Next Step layer*/
function callNextLayer()
{
    getPageSize(1);
    document.getElementById("ctl00_ContentPlaceHolder1_div_save").style.display="block";
    document.getElementById("ctl00_ContentPlaceHolder1_div_savepreloader").style.display="none";
    document.getElementById('id_next').style.display='block';
    document.getElementById('fade').style.display='block';
    alertSize();
    document.getElementById('id_next').style.left=(parseInt(myWidth/2) - 272) + "px";
    window.scrollTo(0,0);
} 

function closeNextLayer()
{
    document.getElementById('id_next').style.display='none';
    document.getElementById('fade').style.display='none';
}
/*ends here*/


/*Validation for Start New Chitchat layer*/
function validateChitChat()
{
    var valid=true;
    var errorstr="The following fields are incomplete:" +  '\r\n' ;
    
    document.getElementById("chatbutton").style.visibility="hidden"; 
    document.getElementById("chatpreloader").style.visibility="visible";
   
    if(document.getElementById("ctl00_drp_cat").value =="0")
    {
         errorstr=errorstr +'\r\n' + geterrmsg('e158');
         valid=false;   
    }

    if(document.getElementById("ctl00_txt_title_chat").value.replace(/^\s+|\s+$/g, "") =="")
    {
         errorstr=errorstr +'\r\n' + geterrmsg('e159');
         valid=false;   
    }
    if(document.getElementById("ctl00_txt_msg_chat").value.replace(/^\s+|\s+$/g, "") =="")
    {
         errorstr=errorstr +'\r\n' + geterrmsg('e160');
         valid=false;   
    }
    if(valid==false)
    {
        errorstr=errorstr +  '\r\n';
        document.getElementById("chatbutton").style.visibility="visible"; 
        document.getElementById("chatpreloader").style.visibility="hidden";
        alert(errorstr); 
    }
    if(valid==true)
    {
        document.getElementById("chatbutton").style.visibility="hidden"; 
        document.getElementById("chatpreloader").style.visibility="visible";
    }
     return valid;
}
/*ends here*/

function checkMakePrimary(varchek)
{
    pcount = document.getElementById('ctl00_ContentPlaceHolder1_imgescount').value;
    var flag=0;
    for (i = 0; i <= pcount -1 ; i++)
    {
        var chkSelect;
        var delcheck;       
        if (i < 10)
        {
            chkSelect= "ctl00_ContentPlaceHolder1_dtl_Media_ctl0" + i + "_chkMakePrimary";
            delcheck="ctl00_ContentPlaceHolder1_dtl_Media_ctl0" + i + "_chkDelete";            
        }
        else if(99 >= i >= 10)
        {
            chkSelect= "ctl00_ContentPlaceHolder1_dtl_Media_ctl" + i + "_chkMakePrimary ";
            delcheck="ctl00_ContentPlaceHolder1_dtl_Media_ctl" + i + "_chkDelete";
        }
        
        if(varchek == chkSelect)
        {   
            if((document.getElementById(varchek).checked == true)&&(document.getElementById(delcheck).checked == false))
            {
                document.getElementById(varchek).checked = true;
                flag=flag+1;
            }
            else
            {
                document.getElementById(varchek).checked = false;
            }
        }
        else
        {
           if(document.getElementById(chkSelect) != null)
           {
             document.getElementById(chkSelect).checked = false;
           }
           
        }
    }
    var chkprimaryintialid=document.getElementById("ctl00_ContentPlaceHolder1_chkprimary_initial").value;
    if (flag == 0)
    {
         var chk_del;
         if(chkprimaryintialid!=varchek)
         document.getElementById(chkprimaryintialid).checked = true;
         chk_del=chkprimaryintialid.split('_chk')[0]+ "_chkDelete";
         if(document.getElementById(chk_del).checked == true)
         {
            document.getElementById(chk_del).checked = false;
         }
    }
}


function checkAssociatePhoto(varchek)
{
    
    chkphtDelete=varchek.split('_chk')[0]+ "_chkDelete";
    if(document.getElementById(chkphtDelete).checked == true)
    {
        document.getElementById(varchek).checked = false;
    }
   
}

function checkAssociateVideo(varchek)
{
    chkvidDelete=varchek.split('_chk')[0]+ "_chkDeleteVideo";
    if(document.getElementById(chkvidDelete).checked == true)
    {
        document.getElementById(varchek).checked = false;
    }
   
}

function checkbForDelete(delchek)
{
    chkprimary=delchek.split('_chk')[0]+ "_chkMakePrimary";
    chkPhtAssociate=delchek.split('_chk')[0]+ "_chkAssociate";
    if(document.getElementById(chkprimary).checked == true)
    {
        document.getElementById(delchek).checked = false;
    }
    if(document.getElementById(chkPhtAssociate)!=null){
    if(document.getElementById(chkPhtAssociate).checked == true)
    {
        document.getElementById(delchek).checked = false;
    }
    }
}

function checkbForPhotoDelete(delchek)
{
   
    chkPhtAssociate=delchek.split('_chk')[0]+ "_chkAssociate";
    if(document.getElementById(chkPhtAssociate).checked == true)
    {
        document.getElementById(delchek).checked = false;
    }
}

function checkbForVideoDelete(delchek)
{
    chkVidAssociate=delchek.split('_chk')[0]+ "_chkbxAssociate";
    if(document.getElementById(chkVidAssociate).checked == true)
    {
        document.getElementById(delchek).checked = false;
    }
}

function chitChatReply(userid,chid,chkid,email,username,varreplies, varchattitle)
{
    document.getElementById("subbutton_c").style.visibility="hidden"; 
    document.getElementById("imgpreloader_c").style.visibility="visible";
    var reply=document.getElementById('ctl00_ContentPlaceHolder1_txt_chat_reply').value;
    chkid = document.getElementById('ctl00_ContentPlaceHolder1_chk_reply').checked;
    var ownerchatid = document.getElementById('ctl00_ContentPlaceHolder1_chitownerid').value;
    var ownerchat = document.getElementById('ctl00_ContentPlaceHolder1_chatownermsg').value;
    if (chkid == true)
    {
        chkid = 1;
    }
    else
    {
        chkid = 0;
    }
    reply=reply.replace(/^\s+|\s+$/g, "");
    
    reply=reply.replace(new RegExp("\\n", "g"), "*****");
    reply=reply.replace("&", "&#38;");
    
    
    if (reply=="")
    {
         alert(geterrmsg('e152'));
         document.getElementById("subbutton_c").style.visibility="visible"; 
         document.getElementById("imgpreloader_c").style.visibility="hidden";
    }
    else
    {
        var urlarg;
        reply=Base64.encode(reply).replaceAll('=','amp61;')
        urlarg = 'userid=' + userid + '&reply=' + reply + '&chid=' + chid + '&chkid=' + chkid + '&email=' + email + '&username=' + username + '&varreplies=' + varreplies +'&varownerchatid='+ownerchatid+'&varownerchat='+ownerchat +'&varchattitle='+varchattitle+'';
        var param='enc='+ Base64.encode(urlarg);
        
        makePOSTRequest('/AjaxChitchat-Reply.aspx' ,param,  '56');  
    } 
}

function replyStateChanged() 
{ 
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
           document.getElementById("subbutton_c").style.visibility="visible";
           document.getElementById("imgpreloader_c").style.visibility="hidden";
           document.getElementById('ctl00_ContentPlaceHolder1_txt_chat_reply').value="";
           document.getElementById('ctl00_ContentPlaceHolder1_chk_reply').checked=false;
           var link = document.getElementById('ctl00_ContentPlaceHolder1_h_reply').value;
           if (result != "")
               document.location = result;
           else
               document.location = siteURL + "ChitchatReply.aspx?enc=" + link;
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}

function displayFullImage(imgpath,alttext)
{
    var url = "path="+imgpath+"&alt="+alttext;
    makePOSTRequest('/AjaxImageDisplay.aspx?enc=' + Base64.encode(url), '', '57');  
}

function getImageSize(w, h)
{
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) 
	{	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} 
	else if (document.body.scrollHeight > document.body.offsetHeight)
	{
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;

	} 
	else 
	{ 
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;
	if (self.innerHeight) 
	{	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} 
	else if (document.documentElement && document.documentElement.clientHeight) 
	{ // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} 
	else if (document.body)
	{ // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
    
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	// for small pages with total width less then width of the viewport

	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
		
	} else {
		pageWidth = xScroll;
	}

    var paghg;
    paghg =  windowHeight + yScroll;
    if(navigator.userAgent.indexOf("Firefox")!=-1)
    {
        pageWidth = pageWidth - 17;   
    }
    var res;
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	wt = pageWidth - w;   
	if(wt > 0)
	{
	    wt = wt / 4;
	    tot = wt / 2;
	    res = tot + wt;
	}
	else
	{
	    inc_width = w - pageWidth;
	    pageWidth = inc_width + pageWidth;
	    pageWidth = pageWidth + 52;
	    res = 0;
	}
	ht = h - pageHeight;
	if(ht > 0)
	{
	    pageHeight = parseInt(h,10) + 52;
	}
	document.getElementById('id_altr').style.left= res + 'px';
    document.getElementById('fade').style.width = (pageWidth + 'px');
    document.getElementById('fade').style.height =  (pageHeight + 'px');
}


function displayImageDetails()
  {
    if (http_request.readyState == 4)
    {
	    if (http_request.status == 200) 
	    {	        
            var res = http_request.responseText;
		    res_arr = res.split("||");
		    document.getElementById("id_altr").style.width = res_arr[2] + "px";
            document.getElementById("id_altr").style.height = res_arr[3] + "px";		    
		    document.getElementById("id_altr").style.display = 'block';
		    var var1;
		    var1 = res_arr[3];
            getImageSize(res_arr[2], var1);
            var s = parseInt(res_arr[2]);
            var i = s + 25;
    
		    document.getElementById('id_altr').style.display='block';
            document.getElementById('fade').style.display='block';
            document.getElementById('closebtn').style.display='block';
            
            document.getElementById('ctl00_ContentPlaceHolder1_imgid').src= "Upload/"+res_arr[0];
            document.getElementById('ctl00_ContentPlaceHolder1_imgid').alt= res_arr[1];
            document.getElementById('ctl00_ContentPlaceHolder1_imgid').title= res_arr[1];
		}
		else
		{
            alert("Problem retrieving data from the server: " + http_request.status);
        }
     }
  }



function pageDataPhotos(pgno,pgcount,recordsperpage,sdId)
{
        var recordsper = recordsperpage;
        var url_arg;
        url_arg = "pgcount=" + pgcount + "&perpage=" + recordsper + "&currentpg=" + pgno + "&someday=" + sdId + "";
        
        makePOSTRequest('/Ajax-SomedayPhotos.aspx?enc=' + Base64.encode(url_arg), '', '58');            
}

function pageDataPhotosDisplay(pgno,pgcount,recordsperpage,sdId)
{
        var recordsper = recordsperpage;
        var url_arg;
        url_arg = "pgcount=" + pgcount + "&perpage=" + recordsper + "&currentpg=" + pgno + "&someday=" + sdId + "";
        
        makePOSTRequest('/Ajax-SomedayPhotos.aspx?enc=' + Base64.encode(url_arg), '', '58');            
}

function showPhotos() 
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
          
           rec_count=result.split("^^^^");
           var somedaytypes = rec_count[0];
           var pagerecord = rec_count[1];
           var datapagerecord = rec_count[2];
           var new1 = rec_count[3];
           var pgcount = rec_count[4];
           var newwh = rec_count[5];
           if(datapagerecord.toString().search('&') != -1)
           {
             valIds = datapagerecord.split('&');
             if(valIds[1].toString().search(',') != -1)
             {
                disIDs = valIds[1].split(',');
                document.getElementById("imgDis_"+disIDs[0]).style.display='block';
                document.getElementById("imgDis_"+disIDs[1]).style.display='block';
             }
             else
             {
                document.getElementById("imgDis_"+valIds[1]).style.display='block';
             }
             
             if(valIds[0].toString().search(',') != -1)
             {
                disIDs2 = valIds[0].split(',');
                document.getElementById("imgDis_"+disIDs2[0]).style.display='block';
                document.getElementById("imgDis_"+disIDs2[1]).style.display='block';
             }
             else
             {
                document.getElementById("imgDis_"+valIds[0]).style.display='block';
             }
           }
           else
           {
                 if(datapagerecord.toString().search(',') != -1)
                 {
                    disIDs = datapagerecord.split(',');
                    document.getElementById("imgDis_"+disIDs[0]).style.display='block';
                    document.getElementById("imgDis_"+disIDs[1]).style.display='block';
                 }
                 else
                 {
                    document.getElementById("imgDis_"+datapagerecord).style.display='block';
                 }
           }
           var hideIDs = document.getElementById(content+"hidimgids").value;
           if(hideIDs.toString().search('&') != -1)
           {
                hidImgs = hideIDs.split('&');
                if(hidImgs[1].toString().search(',') !=-1)
                {
                    hidvals = hidImgs[1].split(',');
                    document.getElementById("imgDis_"+hidvals[0]).style.display='none';
                    document.getElementById("imgDis_"+hidvals[1]).style.display='none';
                }
                else
                {
                    document.getElementById("imgDis_"+hidImgs[1]).style.display='none';
                }
                
                if(hidImgs[0].toString().search(',') !=-1)
                {
                    hidvals = hidImgs[0].split(',');
                    document.getElementById("imgDis_"+hidvals[0]).style.display='none';
                    document.getElementById("imgDis_"+hidvals[1]).style.display='none';
                }
                else
                {
                    document.getElementById("imgDis_"+hidImgs[0]).style.display='none';
                }
           }
           else
           {
                if(hideIDs.toString().search(',') !=-1)
                {
                    hidvals = hideIDs.split(',');
                    document.getElementById("imgDis_"+hidvals[0]).style.display='none';
                    document.getElementById("imgDis_"+hidvals[1]).style.display='none';
                }
                else
                {
                    document.getElementById("imgDis_"+hideIDs).style.display='none';
                }
           }
           document.getElementById(content+"hidimgids").value = datapagerecord;
            var newstart;
            newstart =1;
            if (new1 > 5)
            {
              if (newwh == 0)
              {
                  newstart = ((new1 - 5) + 1);
              }
              else
              {
                  newstart = ((new1 - newwh) + 1);
              }
            }
              document.getElementById("cc_photospaging").innerHTML = pagerecord;
         
           jQuery(document).ready(function() {
	         jQuery('#invite-carousel1').jcarousel({
	            horizontal: true,
                scroll:5,
                start:newstart
            });
            });
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}

function chkImageUpload(fld)
{
   if(!/(\.gif|\.jpg|\.jpeg)$/i.test(fld.value)) 
    {
	    alert(geterrmsg('e53'));
	    fld.form.reset();
	    fld.focus();
	    return false;
    }
    else
    {
        return true;    
    }
}

function chkVideoUpload(fld)
{
   if(!/(\.mov|\.mpg|\.asf|\.amr-nb|\.avi|\.mp4|\.mp3|\.movieclip|\.flv|\.3gp|\.wav|\.mod|\.mpeg|\.dv|\.wma|\.3g2|\.wmv|\.qt|\.gcelp)$/i.test(fld.value)) 
    {
	    alert('Invalid video file format');
	    fld.form.reset();
	    fld.focus();
	    return false;
    }
    else
    {
        return true;
    }
}


function imageUpload(fld) 
{
        xmlHttp=getXmlHttpObject();
        if (xmlHttp==null)
        {
            alert(geterrmsg('e51'));
            return;
        }
        document.getElementById('ctl00_ContentPlaceHolder1_layer_image').style.display='block';
        document.getElementById('fade').style.display='block'; 
        document.getElementById('div_load').style.display='block';
        document.getElementById('ctl00_ContentPlaceHolder1_pnl_image').style.display='none';         
   if(document.getElementById('ctl00_ContentPlaceHolder1_CheckBox1').Checked==true)document.getElementById('ctl00_ContentPlaceHolder1_chk_certified').Checked=true;
    else if(document.getElementById('ctl00_ContentPlaceHolder1_CheckBox1').Checked==false)document.getElementById('ctl00_ContentPlaceHolder1_chk_certified').Checked=false;

        var url="/showimage.aspx";
        var pathname = enableFileBrowse(fld);
        url=url+"?value="+pathname;
        
        makePOSTRequest(url,'','174');
}

function layerImage(imgresult)
{
	        if (imgresult != "")
		    {
		       document.getElementById('ProfileImage').src=imgresult.split(',height=')[0];
		       var height= imgresult.split(',height=')[1];   
		       
               document.getElementById('div_image').style.height=parseFloat(height)+"px";
               document.getElementById('ctl00_ContentPlaceHolder1_layer_image').style.height=parseFloat(height) + 125 +"px"; 
               document.getElementById('ctl00_ContentPlaceHolder1_pnl_image').style.height=(parseFloat(height) + 100)+"px";   
               document.getElementById('ctl00_ContentPlaceHolder1_layer_image').style.display='block';
    	       document.getElementById('div_load').style.display='none';
               document.getElementById('ctl00_ContentPlaceHolder1_pnl_image').style.display='block';
               document.getElementById('ctl00_ContentPlaceHolder1_img_input').value=imgresult.split(',height=')[0];
		       document.getElementById('fade').style.display='block'; 
		    }
}

function enableFileBrowse(fname)
{
    try
    {
        if (window.netscape && navigator.javaEnabled) {
           netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
        }
    }
    catch(e)
    {
        alert('Unable to access local files due to browser security settings. To overcome this, follow these steps: (1)              Enter "about:config" in the URL field; (2) Right click and select New->Boolean; (3) Enter "signed.applets.                codebase_principal_support" (without the quotes) as a new preference name; (4) Click OK and try loading                   the file again.');
    }
    finally
    {
        var pathname1 = fname.value;
        return pathname1;
    }
}

function homeTab()
{
    document.getElementById('home').style.backgroundImage = 'url(../cssimages/myprofile_roll.gif)';
}

function myprofileTab()
{
    document.getElementById('myprofile').style.background = "url(./cssimages/myprofile_roll.gif)";
}
function chitchatTab()
{
    document.getElementById('chitchat').style.background = "url(./cssimages/chitchat_roll.gif)";
}
function spotlightOnTab()
{
    document.getElementById('spotlighton').style.background = "url(./cssimages/spotlighton_roll.gif)";
}
function messagesTab() {
    document.getElementById('DivMessages').style.background = "url(./cssimages/messagesTabHov.gif)";
}

/*Call someday layer*/
function callSomedayLayer()
{
    document.getElementById('id_someday_what').style.display = 'block';
    document.getElementById('fade').style.display='block';
    alertSize();
    document.getElementById('id_someday_what').style.left = (parseInt(myWidth / 2) - 460) + "px";
    window.scrollTo(0,0);
}

function closeSomedayLayer()
{
    if(document.getElementById('ctl00_rigth_uname1')!=null)
    document.getElementById('ctl00_rigth_uname1').value="";
    if(document.getElementById('ctl00_rigth_pword1')!=null)
    document.getElementById('ctl00_rigth_pword1').value="";
    if(document.getElementById('ctl00_chk_remember1')!=null)
    document.getElementById('ctl00_chk_remember1').checked=false;
document.getElementById('id_someday_what').style.display = 'none';
    document.getElementById('fade').style.display='none';
}

function updateViewComment(somedayid)
{
        var url="/UpdateComments.aspx";
        url=url+"?sid="+somedayid;
        makePOSTRequest(url,'',89);
}

function onCommentUpdate()
{
       if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
           if (result != "0")
           {
               var querystring = Base64.encode("someday="+ result);
               document.location="/SomedayOwner.aspx?plan="+ querystring  ;
           }
           else
           {
                alert(geterrmsg('e162'));
                return;
           }
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}

function removeSpaces(strVal)
{
    strVal = strVal.replace(/^\s*(\S*(\s+\S+)*)\s*$/, '$1');
    return strVal;
}

function chkEmptySearch()
{
    var valid=true;
    if(trim(document.getElementById(content+"txtSearchText").value) =="")
    {
        alert(geterrmsg('e71'));
        valid=false;
    
    }
    return valid;

}


function fillImageDatalist() /*NEW ADDED ON 30DEC 2008*/
{
    xmlHttp=getXmlHttpObject();  
    if (xmlHttp==null)
    {
        alert(geterrmsg('e51'));
        return;
    }
    var ddlselectvalue="0";
    var txtsomedayvalue="";
    ddlselectvalue=document.getElementById("ddl_Category").value;
    document.getElementById("ctl00_ContentPlaceHolder1_ddlCategoryId").value=document.getElementById("ddl_Category").value;
    txtsomedayvalue=document.getElementById("ctl00_ContentPlaceHolder1_txtSomedayTitle").value;

    var url="/Ajax-FillImagesPerCategory.aspx";
    var urlstring="somedaytitle="+Base64.encode(txtsomedayvalue)+"&categoryid="+ddlselectvalue;
    url=url+"?urlvalue="+Base64.encode(urlstring); 
    
    makePOSTRequest(url,'','175');

}


function fillImageDatalist_NEW(PageNo) 
{
    xmlHttp = getXmlHttpObject();
    if (xmlHttp == null) {
        alert(geterrmsg('e51'));
        return;
    }
    var ddlselectvalue = "0";
    var txtsomedayvalue = "";
    
    ddlselectvalue = document.getElementById("ddl_Category").value;
    document.getElementById("ctl00_ContentPlaceHolder1_ddlCategoryId").value = document.getElementById("ddl_Category").value;
    txtsomedayvalue = document.getElementById("ctl00_ContentPlaceHolder1_txtSomedayTitle").value;
    

    var url = "/Ajax-FillImagesPerCategory.aspx";
    var urlstring = "somedaytitle=" + txtsomedayvalue + "&categoryid=" + ddlselectvalue + "&PageNo=" + PageNo;
    url = url + "?urlvalue=" + Base64.encode(urlstring);    
    makePOSTRequest(url, '', '175');

}



function addsomedayDatalistStateChanged() /*NEW ADDED ON 30DEC 2008*/
{ 
    if (http_request.readyState==4)
	{ 		
	  if (http_request.status == 200) {

	      result = http_request.responseText;

	      rec_count = result.split("^^^^");
	      var imageLib = rec_count[0];
	      var pagerecord = rec_count[1];
	      //var datapagerecord = rec_count[2];
	      var new1 = rec_count[2];
	      var pgcount = rec_count[3];
	      var newwh = rec_count[4];
	      var hrLine = rec_count[5];
	      var alamyLogo = rec_count[6];

	      var newstart;
	      newstart = 1;
	      if (new1 > 5) {
	          if (newwh == 0) {
	              newstart = ((new1 - 5) + 1);
	          }
	          else {
	              newstart = ((new1 - newwh) + 1);
	          }
	      }	     
	      document.getElementById("dvPagingRecords").innerHTML = pagerecord;

	      jQuery(document).ready(function() {
	          jQuery('#search-carousel').jcarousel({
	              horizontal: true,
	              scroll: 5,
	              start: newstart
	          });
	      });	     
	      document.getElementById("ctl00_ContentPlaceHolder1_dvImageLib").innerHTML = imageLib;
	      document.getElementById("ctl00_ContentPlaceHolder1_dvhrLine").innerHTML = hrLine;
	      document.getElementById("ctl00_ContentPlaceHolder1_dvAlamyLogo").innerHTML = alamyLogo;

	      //reset values
	      document.getElementById("ctl00_ContentPlaceHolder1_Flag").value = "";
	      document.getElementById("ctl00_ContentPlaceHolder1_img_input").value = "";
	      document.getElementById("ctl00_ContentPlaceHolder1_SelectedImage").value = "";	      
	      document.getElementById("ctl00_ContentPlaceHolder1_hdnImgLibID").value = "";
      }
      else 
  	  {
		alert(geterrmsg('e52'));
	  }
	}
}

function assignHiddenValue()
{
    var ddlselectvalue=document.getElementById("ddl_Category").value;
    document.getElementById("ctl00_ContentPlaceHolder1_ddlCategoryId").value=document.getElementById("ddl_Category").value;
}


function validateFields() /*NEW ADDED ON 30DEC 2008*/
{
    var valid=true;    
    document.getElementById("ctl00_ContentPlaceHolder1_div_save").style.display="none";
    document.getElementById("ctl00_ContentPlaceHolder1_div_savepreloader").style.display="block";
  
    var errorstr="The following fields are incomplete:" +  '\r\n' ;

    if (wsTrim(document.getElementById("ctl00_ContentPlaceHolder1_txtSomedayTitle").value) == "")
    {
        errorstr=errorstr +'\r\n' + geterrmsg('e68');
        valid=false;
    }
    
    if((document.getElementById("ddl_Category").value)=="0"){
        errorstr=errorstr +'\r\n' + geterrmsg('e69');
        valid=false;    
    }
    
    if((wsTrim(document.getElementById("ctl00_ContentPlaceHolder1_txtOverview").value) == "Tell the community a little about what you're trying to achieve and why...") || (wsTrim(document.getElementById("ctl00_ContentPlaceHolder1_txtOverview").value) == ""))
    {
        errorstr=errorstr +'\r\n' + geterrmsg('e70');
        valid=false;   
    }
   
    if(valid==false)
    {
        errorstr=errorstr +  '\r\n';
        alert(errorstr);
        document.getElementById("ctl00_ContentPlaceHolder1_div_save").style.display="block";
        document.getElementById("ctl00_ContentPlaceHolder1_div_savepreloader").style.display="none";
    }
   return valid;
}

function loadPage()
{
    window.location.href='/AddASomeday.aspx';
}

function confirmFriend(fid)
{
    makePOSTRequest('/confirm-friend.aspx?fid='+fid,"","150");
}

function addFriend()
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
           alert(result) ;
        }
        else
        {
           alert('There was a problem with the request: ' + http_request.status);
        }
    }
}

function stopReply()
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
           alert(result) ;
        }
        else
        {
           alert('There was a problem with the request: ' + http_request.status);
        }
    }
}

function unsubscribeChitReply(ChitID,UserID)
{
    if(document.getElementById('unsubscribeReply')!=null)
    {
        document.getElementById('unsubscribeReply').style.display = 'none';
        document.getElementById('subscribeReply').style.display = 'block';        
    }
    makePOSTRequest('/Ajax-Stop-Reply.aspx?ChitID='+ChitID+'&UserID='+UserID,"","151");
}

function unsubscribeCommentReply(SomedayID,UserID,PlanID)
{
    if(document.getElementById('unsubscribeReply')!=null)
    {
        document.getElementById('unsubscribeReply').style.display = 'none';
        document.getElementById('subscribeReply').style.display = 'block';
        document.getElementById('ctl00_ContentPlaceHolder1_chkUpdateAsReply').checked=false;
    }
    makePOSTRequest('/Ajax-Stop-Reply.aspx?SomedayID='+SomedayID+'&UserID='+UserID+'&PlanID='+PlanID,"","151");
}

function showHideReplyCheck()
{
    if(document.getElementById('ctl00_ContentPlaceHolder1_chkUpdateAsReply').checked==true)
    {
        document.getElementById('unsubscribeReply').style.display = 'block';
    }
}

function flipPanel(flipvalue)
{
    switch (flipvalue)
    {
    case "tovideo":
        document.getElementById("ctl00_ContentPlaceHolder1_Pnl_Video").style.display="block"; 
        document.getElementById("ctl00_ContentPlaceHolder1_Pnl_Photo").style.display="none";
        document.getElementById("div_btnforvideo").style.display="none" ;
        document.getElementById("div_btnforphoto").style.display="block" ;
        document.getElementById("ctl00_ContentPlaceHolder1_txt_uploadtype").value="Upload Video&#58;&nbsp;";
        document.getElementById("lbl_video").style.display="block" ;
        document.getElementById("lbl_photo").style.display="none";
        document.getElementById("txt_len1").style.display="none";
        document.getElementById("txt_len").style.display="block";
        document.getElementById("txt_format").style.display="block";
        document.getElementById("FileUploadedVideo").value="";
        document.getElementById("video_txt").style.display="block";
        document.getElementById("photo_txt").style.display="none";
    break;
    
    case "tophoto":
        document.getElementById("ctl00_ContentPlaceHolder1_Pnl_Video").style.display="none"  
        document.getElementById("ctl00_ContentPlaceHolder1_Pnl_Photo").style.display="block";
        document.getElementById("div_btnforphoto").style.display="none";
        document.getElementById("div_btnforvideo").style.display="block" ; 
        document.getElementById("ctl00_ContentPlaceHolder1_txt_uploadtype").value="Upload Photo&#58;&nbsp;";
        document.getElementById("lbl_video").style.display="none" ;
        document.getElementById("lbl_photo").style.display="block";
        document.getElementById("txt_len").style.display="none";
        document.getElementById("txt_len1").style.display="block";
        document.getElementById("txt_format").style.display="none";
        document.getElementById("FileUploadedVideo").value="";
        document.getElementById("video_txt").style.display="none";
        document.getElementById("photo_txt").style.display="block";
        break;
    }
}


 function changeAction()
    {
        var errorstr="The following fields are not proper:" +  '\r\n' ;
        var valid= true;
         document.getElementById("Upload_ht").style.display="none";
         document.getElementById("ctl00_ContentPlaceHolder1_Upload_pre").style.display="block";
        if(document.getElementById("FileUploadedVideo").value!="")
        {
            if(validateVideoFileExtension(document.getElementById("FileUploadedVideo"))==false)
            {                 
            errorstr=errorstr +  '\r\n' + geterrmsg('e163');
            valid=false;        
            }
            else if(wsTrim(document.getElementById("ctl00_ContentPlaceHolder1_txtTitle").value)=="")
            {
            errorstr=errorstr +  '\r\n' + geterrmsg('e68');
            valid=false; 
            }
           
            if(!valid)
            {
                alert(errorstr);
                document.getElementById("Upload_ht").style.display="block";
                document.getElementById("ctl00_ContentPlaceHolder1_Upload_pre").style.display="none";
            }
        }
        else        
        {
             alert(errorstr + '\r\n' + 'Please select your Video');
             document.getElementById("Upload_ht").style.display="block";
             document.getElementById("ctl00_ContentPlaceHolder1_Upload_pre").style.display="none";
             valid = false;
        }
        return valid;
    }
   
function validateUploadedFiles()
{
    var valid=true;  
    var errorstr="The following fields are not proper:" +  '\r\n' ;
    
    
        if(document.getElementById("FileUploadedVideo").value!="")
        {
            if((document.getElementById("lbl_video").style.display=="none")||(document.getElementById("lbl_video").style.display=="")){
               if(!validateImageExtension(document.getElementById("FileUploadedVideo")))
                {
                    errorstr=errorstr +  '\r\n' + geterrmsg('e66');
                    valid=false;
                }
            }
            else if(document.getElementById("lbl_photo").style.display=="none")
            {
                if(!validateVideoFileExtension(document.getElementById("FileUploadedVideo")))
                {
                   errorstr=errorstr +  '\r\n' + geterrmsg('e163');
                   valid=false;
                }
            }
        }
         else
        {
            errorstr=errorstr +'\r\n' + 'Please select your photo/video';
            valid=false;
        
        }
    if(valid==false)
    {
        alert(errorstr)
        return false;
    
    }
    else return true;
}

function validateUploadPhotoVideo()
{
    var valid=true;  
    var errorstr="The following fields are not proper:" +  '\r\n' ;
    document.getElementById("ctl00_ContentPlaceHolder1_uploadpht").style.display="none";
    document.getElementById("ctl00_ContentPlaceHolder1_uploadpre").style.display="block";
    
    if(document.getElementById("FileUploadedVideo").value =="")
    {
        errorstr=errorstr +'\r\n' + 'Please select your Photo';
        valid=false;
    }
    else if(!validateImageExtension(document.getElementById("FileUploadedVideo")))
    {
         errorstr=errorstr +  '\r\n' + geterrmsg('e66');
         valid=false;
    }

    if(valid==false)
    {
        errorstr=errorstr +  '\r\n';
        alert(errorstr);
        document.getElementById("ctl00_ContentPlaceHolder1_uploadpht").style.display="block";
        document.getElementById("ctl00_ContentPlaceHolder1_uploadpre").style.display="none";       
    }
    else
    {
        if(document.getElementById("FileUploadedVideo").value!=""){
        getWindowSize();
        }
    }     
    return valid;
}
    
/*ends here*/


function spotlightReply(chkup)
{
    document.getElementById("repbtn").style.display="none";
    document.getElementById("preloaderImg").style.display="block";
    if (trim(document.getElementById('ctl00_ContentPlaceHolder1_txtReplyComments').value))
    {
        var commentstxt = document.getElementById('ctl00_ContentPlaceHolder1_txtReplyComments').value;
        commentstxt = commentstxt.replaceAll('[&]','amp;');
        commentstxt = commentstxt.replaceAll('[=]','amp61;');
        var planid=  document.getElementById('ctl00_ContentPlaceHolder1_hdnPlanId').value;
        var sdid = document.getElementById('ctl00_ContentPlaceHolder1_hdnSomedayId').value;
        var lnk = document.getElementById('ctl00_ContentPlaceHolder1_hdnEn').value;
        if(document.getElementById("ctl00_ContentPlaceHolder1_chkUpdateAsReply").checked==true) 
        {
            chkval="1";
        }
        else
        {
            chkval=chkup;
        }
        var url_arg_send ="SomedayID="+sdid+"&PlanID="+planid+"&cmttxt="+commentstxt+"&update="+ chkval+"&lnk="+lnk;
        makePOSTRequest('/Ajax-SpotlightComments.aspx',url_arg_send,'160');
    }
    else
    {
      alert(geterrmsg('e183'));
      document.getElementById("repbtn").style.display="block";
      document.getElementById("preloaderImg").style.display="none";
      return
    }
}

function CommentsSpotlight()
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
           if(result =="1")
           {
                document.location ="/SpotlightOn.aspx";
           }
           else if(result=="2")
           {
                document.location ="/SpotlightOn.aspx?lnk="+document.getElementById("ctl00_ContentPlaceHolder1_hdnEn").value;
           }
           document.getElementById("repbtn").style.display="block";
           document.getElementById("preloaderImg").style.display="none";
        }
        else
        {
           alert('There was a problem with the request: ' + http_request.status);
        }
    }
}

function unsubscribeSpotlightReply(SomedayID,UserID,PlanID)
{
    if(document.getElementById('unsubscribeReply')!=null)
    {
        document.getElementById('unsubscribeReply').style.display = 'none';
        document.getElementById('subscribeReply').style.display = 'block';
        document.getElementById('ctl00_ContentPlaceHolder1_chkUpdateAsReply').checked=false;
    }
    makePOSTRequest('/Ajax-Stop-Reply.aspx?spotID='+SomedayID+'&UserID='+UserID,"","151");
}

function viewECVideos(Toggleid,pgno,pgvideos,records,sdtyp) {
    var sdid = document.getElementById("ctl00_ContentPlaceHolder1_inphid").value;
    alert("/Ajax-SponVideos.aspx?tgle=" + Toggleid + "&sid=" + sdid + "&currentpg=" + pgno + "&sdtyp=" + sdtyp);
    makePOSTRequest('/Ajax-SponVideos.aspx?tgle='+Toggleid+"&sid="+sdid+"&currentpg="+pgno+"&sdtyp="+sdtyp,"","211");
}
function videoECDisplay()
{
     if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
            result = http_request.responseText.split("^^^^");
            if(result[0] =="1")//photos
            {
               document.getElementById("div_ccData").style.display="block";
               document.getElementById("div_videos").style.display="none";
               document.getElementById("photos").style.display="none";
               document.getElementById("videos").style.display="block";
               document.getElementById('div_paging').style.display="block";
               document.getElementById('div_vidpaging').style.display="none";
           }
           else if(result[0] =="2")//videos
           {
               document.getElementById("div_ccData").style.display="none";
               document.getElementById("div_videos").style.display="block";
               document.getElementById("photos").style.display="block";
               document.getElementById("videos").style.display="none";
               document.getElementById('div_paging').style.display="none";
               document.getElementById('div_vidpaging').style.display="block";
               document.getElementById('div_vidpaging').innerHTML = result[1];
               document.getElementById('div_videos').innerHTML = result[2];
           }
           jQuery(document).ready(function() {
	         jQuery('#invite-carousel21').jcarousel({
	            horizontal: true,
                scroll:5,
                start:0
            });
            });
        }
        else
        {
           alert('There was a problem with the request: ' + http_request.status);
        }
    }
}
	
function viewVideos(Toggleid,pgno,pgvideos,records)
{
    var sdid = document.getElementById("ctl00_ContentPlaceHolder1_hdnSomedayId").value;
    makePOSTRequest('/Ajax-Videos.aspx?tgle='+Toggleid+"&sid="+sdid+"&currentpg="+pgno,"","161");
}

function VideoDisplayOld()
{
     if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
            result = http_request.responseText.split("^^^^");
            if(result[0] =="1")//photos
            {
               document.getElementById("div_photos").style.display="block";
                document.getElementById("div_videos").style.display="none";
                document.getElementById("photos").style.display="none";
                document.getElementById("videos").style.display="block";
                document.getElementById('cc_photospaging').style.display="block";
               document.getElementById('cc_videopaging').style.display="none";
           }
           else if(result[0] =="2")//videos
           {
               document.getElementById("div_photos").style.display="none";
               document.getElementById("div_videos").style.display="block";
             document.getElementById("photos").style.display="block";
              document.getElementById("videos").style.display="none";
            document.getElementById('cc_photospaging').style.display="none";
               document.getElementById('cc_videopaging').style.display="block";
               document.getElementById('cc_photospaging').innerHTML = result[1];
               document.getElementById('div_photos').innerHTML = result[2];
           }
           jQuery(document).ready(function() {
	         jQuery('#invite-carousel21').jcarousel({
	            horizontal: true,
                scroll:5,
                start:0
            });
            });
        }
        else
        {
           alert('There was a problem with the request: ' + http_request.status);
        }
    }
}


function videoDisplay()
{
     if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
            result = http_request.responseText.split("^^^^");
            if(result[0] =="1")//photos
            {
               document.getElementById("div_photos").style.display="block";
               document.getElementById("div_videos").style.display="none";
               document.getElementById("photos").style.display="none";
               document.getElementById("videos").style.display="block";
               document.getElementById('cc_photospaging').style.display="block";
               document.getElementById('cc_videopaging').style.display="none";
           }
           else if(result[0] =="2")//videos
           {
               document.getElementById("div_photos").style.display="none";
               document.getElementById("div_videos").style.display="block";
               document.getElementById("photos").style.display="block";
               document.getElementById("videos").style.display="none";
               document.getElementById('cc_photospaging').style.display="none";
               document.getElementById('cc_videopaging').style.display="block";
               document.getElementById('cc_videopaging').innerHTML = result[1];
               document.getElementById('div_videos').innerHTML = result[2];
           }
           jQuery(document).ready(function() {
	         jQuery('#invite-carousel21').jcarousel({
	            horizontal: true,
                scroll:5,
                start:0
            });
            });
        }
        else
        {
           alert('There was a problem with the request: ' + http_request.status);
        }
    }
}


function showPhotosImgs() 
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
          
           rec_count=result.split("^^^^");
           var somedaytypes = rec_count[0];
           var pagerecord = rec_count[1];
           var datapagerecord = rec_count[2];
           var new1 = rec_count[3];
           var pgcount = rec_count[4];
           var newwh = rec_count[5];
           alert(pagerecord);
           var profilepics = document.getElementById("ctl00_ContentPlaceHolder1_hdnphotos").value;
           document.getElementById("videos").style.display="block";
           document.getElementById("photos").style.display="none";
           document.getElementById("div_photos").innerHTML = profilepics;
           document.getElementById("cc_photospaging").innerHTML = pagerecord;
         
           jQuery(document).ready(function() {
	         jQuery('#invite-carousel1').jcarousel({
	            horizontal: true,
                scroll:5,
                start:0
            });
            });
        }
        else
        {
            alert('There was a problem with the request: ' + http_request.status);
        }
    }
}



function clearText(chk)
{
    if(chk=="1")
    {
        if(document.getElementById("ctl00_ContentPlaceHolder1_txt_ms").value==document.getElementById("ctl00_ContentPlaceHolder1_txtar").value)
        {
            document.getElementById("ctl00_ContentPlaceHolder1_txt_ms").value="";
        }
    }
    
    if(chk=="2")
    {
        if(document.getElementById("ctl00_ContentPlaceHolder1_txt_messages").value==document.getElementById("ctl00_ContentPlaceHolder1_txtar").value)
        {
            document.getElementById("ctl00_ContentPlaceHolder1_txt_messages").value="";
        }
    }
}

function validateIds(chkid)
{
    if(chkid=="1")
    {
        if(removeSpaces(document.getElementById("ctl00_ContentPlaceHolder1_text_toemails").value) =="")
        {
            alert(geterrmsg('e511'));
            return false;
        }
    }
    else if(chkid=="2")
    {
        if(removeSpaces(document.getElementById("ctl00_ContentPlaceHolder1_to_name").value) =="")
        {
            alert(geterrmsg('e510'));
            return false;
        }
    }
    return true;
}


function searchuser()
{
    var usrnam = document.getElementById("ctl00_txtUsername").value;

    if(removeSpaces(usrnam)=="")
    {
        alert("Please enter the name.");
        return;
    }
    if (usrnam == 'Search by Name')
    {
        alert("Please enter the name.");
        return;
    }
    document.location = '/Searchusers.aspx?lnk='+Base64.encode(usrnam);
}

function pageDataUsersDisplay(pgno,pgcount,recordsperpage,nam) {

        var recordsper = recordsperpage;
        var url_arg;
        url_arg = "pgcount=" + pgcount + "&perpage=" + recordsper + "&currentpg=" + pgno + "&name=" + nam + "";
        
        makePOSTRequest('/Ajax-UserSearch.aspx?enc=' + Base64.encode(url_arg), '', '180');            
}

function showUsers()
{
     if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
           result = http_request.responseText;
          
           rec_count=result.split("^^^^");
           var somedaytypes = rec_count[0];
           var pagerecord = rec_count[1];
           var datapagerecord = rec_count[2];
           var new1 = rec_count[3];
           var pgcount = rec_count[4];
           var newwh = rec_count[5];
           var pagedown=rec_count[6];
          
           document.getElementById("id_users_paging").innerHTML=pagerecord;
           jQuery(document).ready(function() {
	         jQuery('#suser-carousel').jcarousel({
	            horizontal: true,
                scroll:5,
                start:1
            });
            });
            
            document.getElementById("id_users_paging_btm").innerHTML=pagedown;
            jQuery(document).ready(function() {
	         jQuery('#suser-carousel-down').jcarousel({
	            horizontal: true,
                scroll:5,
                start:1
            });
            });
              document.getElementById("id_users_data").innerHTML=datapagerecord;
           }
           else
           {
           alert('There was a problem with the request: ' + http_request.status);
           }
           
     }
}

function stepOrderDrag()
{
   
    var i=0,j=1,str="";
    var ni = document.getElementById("drag_list");        
    while(ni.childNodes.length >i)
    {   
        var list_id=(ni.childNodes[i].id).split("_") 
        if(trim(list_id[0])=="draght") {        
        str= str + j + ",";
        str=str + list_id[1] + ";";
        i++;
        j++;
        }
    }
        str = str.substring(0,(str.length-1));
        document.getElementById(content+"hdn_new_ord").value=str;

    return true;

}


function LinkBtnEnter(e,btn)
{
    var btn = document.getElementById("ctl00_ContentPlaceHolder1_btnSearch");
    if(e.keyCode == 13)
    {
        eval(btn.href);
    }
}

//Added by Nikhil. 30 Mar
function wsTrim(str)
{
    return str.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');

}

  function Open_Video_Window(url)
 {
     mywindow = window.open (url,'Video','location=0,status=0,scrollbars=0,width=550,height=492,resizable=1');   
     mywindow.moveTo(350,175);
 }
 
 function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

 
 
function deleteCookies()
{
alert("test");
self.blur();
}


/*Copy plan*/
function callDragPlanLayer()
{
    document.getElementById('drag_someday').style.display='block';
    document.getElementById('fade').style.display='block';
    alertSize();
    document.getElementById('drag_someday').style.left=(parseInt(myWidth/2) - 273) + "px";
    window.scrollTo(0,0);
}

function closeDragPlanLayer()
{
    document.getElementById('drag_someday').style.display='none';
    document.getElementById('fade').style.display='none';
}
/*ends here*/

function cycle() 
{
    makePOSTRequest('/Ajax-ExpertRefresh.aspx',"","210");
    
}
function showExpertOnRefresh()
{
    if (http_request.readyState == 4){
        if (http_request.status == 200)
        {
            result = http_request.responseText;
           document.getElementById("sponsored_content").innerHTML=result;
           var getTime = document.getElementById("ctl00_ContentPlaceHolder1_hidexp").value;
           window.setTimeout('cycle();',getTime);
        }
        else alert("There was problem with request." + http_request.status);
        }
}

function viewVideo(val)
{
    getPageSize(0);
    window.scroll(0,0);
    document.getElementById('fadeifr').style.width = (pageWidth + 'px');
    document.getElementById('fadeifr').style.height =  (pageHeight + 'px');
    var srcUrl =  siteURL + "PlayFlashVideoWndow.aspx?videodet=" + val;   
    var left = parseInt(pageWidth/2)-parseInt(550/2);
    
    var iFrame = document.getElementById("ifrPlayVid");
    iFrame.src = srcUrl;
    iFrame.style.left = left + 'px';
    iFrame.style.display = 'block';
    document.getElementById("fadeifr").style.display = "block";
  }

function closeVideo(){
    window.parent.document.getElementById("fadeifr").style.display = "none";
}

function verification_code()
{
 var val= document.getElementById("ctl00_ContentPlaceHolder1_txtverification_code").value;
 if(val=="")
 {
 alert("Please enter verification code");
 return false;
 }
 return true;
 
}


//Funcs added by Nikhil
/***click tracking***/
var chkElem, lnk;
function trackClicks(somedayID, page, element,link){
    chkElem = element;
    lnk = link;
    var qs = "somedayID=" + somedayID + "&page=" + page + "&element=" + element;
    makePOSTRequest('/Ajax-ClickTracking.aspx?'+qs,"","201");
}

function ResultClickTracking(){
    if (http_request.readyState == 4){
        if (http_request.status == 200){
            if(chkElem == "name") window.open(lnk,"website");
            else if(chkElem == "logo") window.location = lnk;
            else if(chkElem == "original"){
                window.open(lnk,"website");
            }
        }
        else alert("There was problem with request." + http_request.status);
    }
}
/***end click tracking***/

/***add pix/vid in step***/
function showAddPixVid(){
    document.getElementById("divAddPixVid").style.display = "block";
}

function validateAddPixVid(){
    var retVal = false;
    var errorstr = "";
    document.getElementById("preloadstepsave").style.display='block';
    document.getElementById("ctl00_ContentPlaceHolder1_checklinkbutton").style.display='none';
    if (wsTrim(document.getElementById('ctl00_ContentPlaceHolder1_txtNewStep').value)=="")
    {
        errorstr = errorstr + "Enter Step Description";
    }
    if(wsTrim(document.getElementById("ctl00_ContentPlaceHolder1_fileVideo").value)!="")
    {
        if(validateVideoFileExtension(document.getElementById("ctl00_ContentPlaceHolder1_fileVideo"))==false)
        errorstr=errorstr +  '\r\n' + geterrmsg('e163');
    }
    if(wsTrim(document.getElementById("ctl00_ContentPlaceHolder1_filePhoto").value)!="")
    {
        if(!validateImageExtension(document.getElementById("ctl00_ContentPlaceHolder1_filePhoto")))
        errorstr=errorstr +  '\r\n' + geterrmsg('e66');
    }
    if(errorstr!="")
    {
        alert(errorstr);
        document.getElementById("ctl00_ContentPlaceHolder1_checklinkbutton").style.display='block';
        document.getElementById("preloadstepsave").style.display='none';
    }
    else
    {
        retVal = true;
    }
    return retVal;
}
/***end add pix/vid in step***/

/*Common function for preloder.
  divID - ID of div/control to be hidden/shown
  preID - ID of the preloader div/image
*/  
function preloader(divID,preID,mode)    
{
    switch(mode.toLowerCase())
    {
        case "show":
            document.getElementById(divID).style.display = "none";
            document.getElementById(preID).style.display = "block";
            break;
        case "hide":
            document.getElementById(preID).style.display = "none";
            document.getElementById(divID).style.display = "block";
            break;
    }
}

function validate(val,field){
    var expr;
    switch(field){
        case "splchars": expr = /^[a-zA-Z0-9@~$!:.#&^`*_|{}-]+$/; break;
    }
    return expr.test(val);
}
//Changes on 17/dec/2009
function validateSignUp()
{
    var success = false;
    var SomedayGoal = wsTrim(document.getElementById(content + "txtSomedayTitle").value);
    var userName = wsTrim(document.getElementById(content + "txtEnterUName").value);
    var pass = document.getElementById(content + "txtEnterPass").value;
//    var firstName = wsTrim(document.getElementById(content + "txtEnterFName").value);
//    var lastName = wsTrim(document.getElementById(content + "txtEnterLName").value);
    var email1 = wsTrim(document.getElementById(content + "txtEnterEmail").value);
//    var email2 = wsTrim(document.getElementById(content + "txtConfirmEmail").value);
//    var month = document.getElementById(content + "ddlMonth").value;
//    var day = document.getElementById(content + "ddlDay").value;
//    var year = document.getElementById(content + "ddlYear").value;
    var captcha = wsTrim(document.getElementById(content + "txtCaptcha").value);
    var errStr = "";

    if (SomedayGoal == "")
        errStr += "Someday I'm going to?\n";

    if(userName == "")
        errStr += "Username?\n";
    else{
        if (userName.indexOf(' ') != -1) errStr += "Please remove spaces from Username.\n";
        if (userName.length < 4) errStr += "Username must be of minimum 4 characters.\n";
        if (!validate(userName, "splchars")) errStr += "Please use alphanumeric Username.\n";
    }
    
    if(pass == "")
        errStr += "Password?\n";
    else {
        if (pass.indexOf(' ') != -1) errStr += "Please remove spaces from password.\n";
        //if (!validate(pass, "splchars")) errStr += "Please use Alphaneumeric password.\n";
        if(!validate(pass,"splchars")) errStr += "Please use a different password.\n";
        
        
    }
    
//    if(firstName == "") errStr += "First name?\n";
    
//    if(lastName == "") errStr += "Last name?\n";
    
    if(email1 == "") errStr += "email address?\n";
    else if(!validateEmail(email1)) errStr += "email address is invalid.\n";
//    if(email2 == "") errStr += "confirm email address?\n";
//    else if(!validateEmail(email2)) errStr += "confirm email address is invalid.\n";
//    if(email1 != "" && email2 != ""){
//        if(validateEmail(email1) && validateEmail(email2))
//        if(email1 != email2) errStr += "confirm email address is not same as email address.\n";
//    }
//    
//    if(month.toLowerCase() == "month") errStr += "birth month?\n";
//    if(day.toLowerCase() == "day") errStr += "birth day?\n";
//    if(year.toLowerCase() == "year") errStr += "birth year?\n";
    
    if(captcha == "") errStr += "security code?\n";
    
    preloader("divSubmit","divPreloder","show");
    if(errStr!=""){
        alert("Have you entered your:\n" + errStr);
        preloader("divSubmit","divPreloder","hide");
    }
    else {
        success = true;
        preloader("divSubmit","divPreloder","show");
    }
    return success;
}
//End - Nikhil

function handleEnter(field, event){
	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if (keyCode == 13) {
		var i;
		for (i = 0; i < field.form.elements.length; i++)
			if (field == field.form.elements[i])
				break;
		i = (i + 1) % field.form.elements.length;
		field.form.elements[i].focus();
		return false;
	} 
	else
	return true;
};

function getFeedEntry(userID, pageIndexobj, isMoreEntry) {    
//    if (isMoreEntry) {
//        pageIndexobj.value = parseInt(pageIndexobj.value) + 1;
//    }
//    else {
//        pageIndexobj.value = parseInt(pageIndexobj.value) - 1;
//        if (parseInt(pageIndexobj.value) < 0)
//            pageIndexobj.value = 0;
//    }
//    if (pageIndexobj.value > 0)
//        varPrevEntry.style.display = "block";
//    else
//        varPrevEntry.style.display = "none";   
    var pageIndex = pageIndexobj.value;
    var qs = "userID=" + userID + "&pageIndex=" + pageIndex + "&isMoreEntry=" + isMoreEntry;   
    makePOSTRequest('/Ajax-ActivityFeed.aspx?' + qs, "", "212");
};

function activityFeedDisplay() {
    varPrevEntry.style.display = "none";
    varNextEntry.style.display = "none"; 
    if (http_request.readyState == 4) {        
        if (http_request.status == 200) {
            result = http_request.responseText.split("^^^^");
            vardvFeed.innerHTML = result[0];
            var isMoreEntry = result[2];            
            if (parseInt(isMoreEntry) == 1) {
                varhdnPageIndex.value = parseInt(varhdnPageIndex.value) + 1;
            }
            else {
                varhdnPageIndex.value = parseInt(varhdnPageIndex.value) - 1;
                if (parseInt(varhdnPageIndex.value) < 0)
                    varhdnPageIndex.value = 0;
            }            
            if (varhdnPageIndex.value > 0)
                varPrevEntry.style.display = "block";
            else
                varPrevEntry.style.display = "none"; 
                
            if (parseInt(result[1]) < 10)
                varNextEntry.style.display = "none";
            else
                varNextEntry.style.display = "block";            
        }
        else {
            alert('There was a problem with the Feed request: ' + http_request.status);
        }
    }
};

function selectLibImage(controlid) 
{    
    for (i = 0; i < 10; i++) {
        var chkSelect = "ImageLib_ct" + i + "_spn_ImageName";
        var chkHidden = "ImageLib_ct" + i + "_hdn_ImageName";
        var chkHiddenImageID = "ImageLib_ct" + i + "_hdn_ImageID";   

        if (controlid == chkSelect) {
            //set active class
            if (navigator.appName == "Microsoft Internet Explorer") {
                document.getElementById(chkSelect).className = "imgLibActive";
            }
            else {
                document.getElementById(chkSelect).setAttribute("class", "imgLibActive");
            }
            if (document.getElementById(chkHiddenImageID) != null) {
                document.getElementById("ctl00_ContentPlaceHolder1_hdnImgLibID").value = document.getElementById(chkHiddenImageID).value;
                document.getElementById("ctl00_ContentPlaceHolder1_Flag").value = "1";
                document.getElementById("ctl00_ContentPlaceHolder1_img_input").value = "";
                document.getElementById("ctl00_ContentPlaceHolder1_SelectedImage").value = document.getElementById(chkHidden).value;
//                alert(document.getElementById("ctl00_ContentPlaceHolder1_SelectedImage").value);
//                alert('Id= ' + document.getElementById("ctl00_ContentPlaceHolder1_hdnImgLibID").value);
            }    
        }
        else {        
            if (document.getElementById(chkSelect) != null) {
                // remove active class
                if (navigator.appName == "Microsoft Internet Explorer") {
                    document.getElementById(chkSelect).className = "";
                }
                else {
                    document.getElementById(chkSelect).setAttribute("class", "");
                } 
            }
        }
    }
   
//    document.getElementById("ctl00_ContentPlaceHolder1_Flag").value = "1";
//    document.getElementById("ctl00_ContentPlaceHolder1_SelectedImage").value = document.getElementById(controlid).value;
//    document.getElementById(content + "img_input").value = "";
//    document.getElementById("ctl00_ContentPlaceHolder1_span_thumbnail").style.display = 'none';
//    document.getElementById("ctl00_ContentPlaceHolder1_Img_thumb").src = "";
};

function deSelectAllLibImage() {

    for (i = 0; i < 10; i++) {
        var chkSelect = "ImageLib_ct" + i + "_spn_ImageName";
        var chkHidden = "ImageLib_ct" + i + "_hdn_ImageName";
        var chkHiddenImageID = "ImageLib_ct" + i + "_hdn_ImageID";

        if (document.getElementById(chkSelect) != null) {
            // remove active class
            if (navigator.appName == "Microsoft Internet Explorer") {
                document.getElementById(chkSelect).className = "";
            }
            else {
                document.getElementById(chkSelect).setAttribute("class", "");
            }
        }
    }
        document.getElementById("ctl00_ContentPlaceHolder1_Flag").value = "";
        document.getElementById("ctl00_ContentPlaceHolder1_SelectedImage").value = "";
        document.getElementById("ctl00_ContentPlaceHolder1_img_input").value = "";
        document.getElementById("ctl00_ContentPlaceHolder1_hdnImgLibID").value = "";
    };
    
    /*Reorder Someday*/
    function callDragSomedayLayer() {
        document.getElementById('drag_someday').style.display = 'block';
        document.getElementById('fade').style.display = 'block';
        alertSize();
        document.getElementById('drag_someday').style.left = (parseInt(myWidth / 2) - 273) + "px";
        window.scrollTo(0, 0);
    }

    function closeDragSomedayLayer() {
        document.getElementById('drag_someday').style.display = 'none';
        document.getElementById('fade').style.display = 'none';
    }
    /*Reorder Someday ends here*/

    function somedayOrderDrag() {

        var i = 0, j = 1, str = "";
        var ni = document.getElementById("drag_list");
        while (ni.childNodes.length > i) {
            var list_id = (ni.childNodes[i].id).split("_")
            if (trim(list_id[0]) == "draght") {
                str = str + j + ",";
                str = str + list_id[1] + ";";
                i++;
                j++;
            }
        }
        str = str.substring(0, (str.length - 1));
        document.getElementById(content + "hdn_new_ord").value = str;

        return true;

    }

    function getReorderPageSize() {        
        var xScroll, yScroll;       
        if (window.innerHeight && window.scrollMaxY) {            
            xScroll = document.body.scrollWidth;
            yScroll = window.innerHeight + window.scrollMaxY;
        } else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac        
            xScroll = document.body.scrollWidth;
            yScroll = document.body.scrollHeight;
        } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari       
            xScroll = document.body.offsetWidth;
            yScroll = document.body.offsetHeight + document.documentElement.scrollHeight - document.documentElement.clientHeight;
            //yScroll = document.body.offsetHeight;            
        }

        var windowWidth, windowHeight;
        if (self.innerHeight) {	// all except Explorer           
            windowWidth = self.innerWidth;
            windowHeight = self.innerHeight;
        } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode      
            windowWidth = document.documentElement.clientWidth;
            windowHeight = document.documentElement.clientHeight;
        } else if (document.body) { // other Explorers        
            windowWidth = document.body.clientWidth;
            windowHeight = document.body.clientHeight;
        }

        // for small pages with total height less then height of the viewport
        if (yScroll < windowHeight) {
            pageHeight = windowHeight;
        } else {
            pageHeight = yScroll;
        }


        // for small pages with total width less then width of the viewport
        if (xScroll < windowWidth) {
            pageWidth = windowWidth;
        } else {
            pageWidth = xScroll;
        }

        var paghg;
        paghg = windowHeight + yScroll;
        arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight)
        if (navigator.userAgent.indexOf("Firefox") != -1) {
            pageWidth = pageWidth - 17;
        }        
        document.getElementById('fade').style.width = (pageWidth + 'px');
        document.getElementById('fade').style.height = (pageHeight + 'px');

    };

    function loginValidateWelcomeCopy() {
        //        document.getElementById("welcombtn2").style.visibility = "hidden";
        //        document.getElementById("welcomepl2").style.visibility = "visible";

        for (var i = 0; i < document.getElementById(content + "rigth_uname2").value.length; i++) {
            if (specialchar.indexOf(document.getElementById(content + "rigth_uname2").value.charAt(i)) != -1) {
                alert(geterrmsg('e512'));
                document.getElementById(content + "rigth_uname2").focus();
                //document.getElementById("welcombtn2").style.visibility = "visible";
                //document.getElementById("welcomepl2").style.visibility = "hidden";
                return;
            }
        }
        if (removeSpaces(document.getElementById(content + "rigth_uname2").value) == "") {
            alert(geterrmsg('e46'));
            document.getElementById(content + "rigth_uname2").focus();
            //document.getElementById("welcombtn2").style.visibility = "visible";
            //document.getElementById("welcomepl2").style.visibility = "hidden";
            return;
        }
        if (removeSpaces(document.getElementById(content + "rigth_pword2").value) == "") {
            alert(geterrmsg('e43'));
            document.getElementById(content + "rigth_pword2").focus();
            //document.getElementById("welcombtn2").style.visibility = "visible";
            //document.getElementById("welcomepl2").style.visibility = "hidden";
            return;
        }
        loginCheck("1", document.getElementById(content + "rigth_uname2").value, document.getElementById(content +"rigth_pword2").value, document.getElementById(content + "chk_remember2").checked, 'copysomeday');
    };

    /*Call someday layer*/
    function callSomedayCongratsLayer() {
        document.getElementById('id_someday_Congrats').style.display = 'block';
        document.getElementById('fade').style.display = 'block';
        alertSize();
        document.getElementById('id_someday_Congrats').style.left = (parseInt(myWidth / 2) - 260) + "px";
        window.scrollTo(0, 0);
    };

    function closeSomedayCongratsLayer() {       
        document.getElementById('id_someday_Congrats').style.display = 'none';
        document.getElementById('fade').style.display = 'none';
    };

    /*Login Validation*/
    var specialchar = "#";
    function loginValidateCopy() {
        document.getElementById("subbutton").style.visibility = "hidden";
        document.getElementById("imgpreloader").style.visibility = "visible";

        for (var i = 0; i < document.getElementById(content + "rigth_uname2").value.length; i++) {
            if (specialchar.indexOf(document.getElementById(content+ "rigth_uname2").value.charAt(i)) != -1) {
                alert(geterrmsg('e512'));
                document.getElementById(content +"rigth_uname2").focus();
                document.getElementById("subbutton").style.visibility = "visible";
                document.getElementById("imgpreloader").style.visibility = "hidden";
                return false;
            }
        }
        if (removeSpaces(document.getElementById(content +"rigth_uname2").value) == "") {
            alert(geterrmsg('e46'));
            document.getElementById(content + "rigth_uname2").focus();
            document.getElementById("subbutton").style.visibility = "visible";
            document.getElementById("imgpreloader").style.visibility = "hidden";
            return false;
        }
        if (removeSpaces(document.getElementById(content + "rigth_pword2").value) == "") {
            alert(geterrmsg('e43'));
            document.getElementById(content + "rigth_pword2").focus();
            document.getElementById("subbutton").style.visibility = "visible";
            document.getElementById("imgpreloader").style.visibility = "hidden";
            return false;
        }
        loginCheck("1", document.getElementById(content + "rigth_uname2").value, document.getElementById(content + "rigth_pword2").value, document.getElementById(content + "chk_remember2").checked, 'nonmember');
    };
    /*ends here*/