function openpopup(popurl){
	var winpops=window.open(popurl,"","width=415,height=420,toolbar='no',location='no',status='no',scrollbars,menubar='no',resizable='no',left='0',top='0'")
}

function get_cookie(Name) {
	var search = Name + "="
	var returnvalue = "";
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(search)
    if (offset != -1) { // if cookie exists
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1)
         end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}

function loadpopup(vURL){
	// first time there is no cookie then pop up window default is browser session cookie. 
	//after click "remind me later", set up browser session cookie
	//after click "dont show me any more", set up cookie expire date.
	var cookieenable;
	document.cookie="cookiesenable=yes";
	if (document.cookie==''){
		//alert("cookie disable!"); per session 
		cookieenable=false;
	}
	else{
		cookieenable=true;
	}
	if (cookieenable){
		if (get_cookie('popup')==''){
			openpopup(vURL);
			document.cookie="popup=yes";
		}
	}
}

function setcookieexpire(){
	document.cookie="popup=yes; expires=Thu, 13 Jan 2049 00:00:00 UTC; path=/";
}

function dojoin(){
	document.joinform.email.value=(document.joinform.email.value=='your email address')?'':document.joinform.email.value;
	document.joinform.submit()
}

function doclear(){
    /*switch (document.joinform.email.value)
    {
        case 'your email address':
            document.joinform.email.value = '';
            break;
        case 'EMAIL: ':
            document.joinform.email.value = '';
            break;
    }
    
    if(document.joinform.email.value=='EMAIL'){
		document.joinform.email.value = '';
	}*/
	
	if(document.joinform.email.value=='your email address'){
		document.joinform.email.value = '';
	}
}

function doclear(obj, value){
    if (obj.value == value)
        obj.value = '';
}

function bookmark(){
	bName = navigator.appName
	if(bName.indexOf("Microsoft")!=-1){
		window.external.AddFavorite(document.location,document.title)
	}	
	if(bName.indexOf("Netscape")!=-1){
		//document.forms[0].msgNet.value = "Press CTRL + D for bookmarking this page"
		alert("To bookmark - press(Ctrl-D) on your keyboard after clicking on the OK button")
	}
}

function statusdefault(){
	window.defaultStatus = 'Done'
}

function customDateString(oneDate) {
	var theDay = dayNames[oneDate.getDay() + 1]
	var theMonth = monthNames[oneDate.getMonth() + 1]
	var theYear = oneDate.getYear()
	theYear += (theYear < 100) ? 1900 : 0
	return theDay + " " + oneDate.getDate() + " " + theMonth + ", " + theYear
}

function showalternate(obj,image){
	if (obj.src != image){
	obj.src=image
	}
}

function clearsearch() {
	var d = document.formkeyword,sv = d.keywrd
	if (sv.value == " Search") {sv.value = ""; sv.select()}
	if (sv.value == " Search site") {sv.value = ""; sv.select()}

}

function submitkeywordsearch() {
	var d = document.formkeyword,sv = d.keywrd
	if (sv.value == " Search" || sv.value == "") {
		alert("Please enter a value for the search.");
		sv.value = " Search"; sv.select()} else {d.submit()}
}

function MakeArray(n) {
	this.length = n
	return this
}

monthNames = new MakeArray(12)
monthNames[1] = "January"
monthNames[2] = "February"
monthNames[3] = "March"
monthNames[4] = "April"
monthNames[5] = "May"
monthNames[6] = "June"
monthNames[7] = "July"
monthNames[8] = "August"
monthNames[9] = "September"
monthNames[10] = "October"
monthNames[11] = "November"
monthNames[12] = "December"
dayNames = new MakeArray(7)
dayNames[1] = "Sunday"
dayNames[2] = "Monday"
dayNames[3] = "Tuesday"
dayNames[4] = "Wednesday"
dayNames[5] = "Thursday"
dayNames[6] = "Friday"
dayNames[7] = "Saturday"

//This function will set cursor position in text box or textarea at a desired position.
function setCaretPosition(elemId, caretPos) {
    var elem = document.getElementById(elemId);

    if(elem != null) {
        if(elem.createTextRange) {
            var range = elem.createTextRange();
            range.move('character', caretPos);
            range.select();
        }
        else {
            if(elem.selectionStart) {
                elem.focus();
                elem.setSelectionRange(caretPos, caretPos);
            }
            else
                elem.focus();
        }
    }
}

//FA:SCAN08092009 - Email this page to a friend. IM2413
//Insert referral QS
function setReferralQS()
{
	document.refer.hdnPageURL.value = window.opener.location.toString();

}

//IM 2553 - Interests Paage javascript
// This function is called in button which will expand the div and display the values under sub-categories
function showMeDiv(divname,pname,cname,dis)
{
	document.getElementById(divname).style.display = dis;
	
}
// End function -->

function showMe (it, box,cname,dis) {

	var vis;
	vis=dis;
	
	
	if (box.checked==true)
	{
	    document.getElementById(it).style.display = vis;	
		if (typeof cname.length!='undefined')
		{
		var c = cname.length
		for (i=0; i<c; i++)
		{
		cname[i].checked=true;
		}
		}
		else
		{
		
		cname.checked=true;

		}
	

	}
	else
	if (box.checked==false)
	{
		vis="display"
	
		 if(document.getElementById(it).style.display == vis)
			 {
			 document.getElementById(it).style.display = vis;
			 }
			
		if (typeof cname.length!='undefined' )
		    {
		    var c = cname.length
		    for (i=0; i<c; i++)
		        {
		            cname[i].checked=false;
		        }
		    }
		else
		{
		    cname.checked=false;
		}
}
		
	
}
//end of IM 2553