// JavaScript Document

// JavaScript Document
$(document).ready(function(){

$(".nyroModal").nyroModal({minHeight:200});
 
 $(".tooltip").tipTip({defaultPosition:'top', edgeOffset:3});

})

$(document).ready(function(){
   showPopup=function(id){
	  // alert("ok")
	$("#popupWrapper span:not('#' + id)").hide();
	if($("#"+id).css('display')=='none'){
		$("#"+id).fadeIn();
		currentId="#"+id;
	}
   }
   
   $(".closePopup").click(function(){
		//alert(currentId);
		  $(currentId).fadeOut("fast");
	})
   
   
   $('.input001').focus(function() {
    		    if (this.value == this.defaultValue){ 
    		    	this.value = '';
				}
				if(this.value != this.defaultValue){
	    			this.select();
	    		}
    		});
    		$('.input001').blur(function() {
    		    if ($.trim(this.value) == ''){
			    	this.value = (this.defaultValue ? this.defaultValue : '');
				}
    		});
			
	$('.list tr').live('click',function(){
		//alert(this);
		$(this).next('tr').find('div').slideDown();
		})
						   


///////////////////////////////////////////////////
	       	   /*Calender Tab*/
///////////////////////////////////////////////////
$(".calenderTab ul li").click(function(){
	
	$(this).addClass('active').siblings('li').removeClass('active');
	var currtab = "#"+$(this).attr('id');
	//alert(currtab);
	$("#calenderTab-wrapper div:not('currtab')").hide();
	$("#calenderTab-wrapper "+currtab+"-content").fadeIn();
	})
	
//End Ready state
})


//////////////////////////////////////////////////////////////
					  /*Add Friends*/
//////////////////////////////////////////////////////////////

function addFriends()
{
	var tilltotal = Number(document.getElementById('totalflds').value);
	var addmr = "";
	new createDiv(tilltotal);
	for(i=tilltotal+1; i<=tilltotal+1; i++)
	{
		addmr = addmr + "<tr style='line-height:40px'><td  width='80'>Friends Name</td><td width='128'><input name='frdName"+ i +"' type='text' class='input002' id='frdName"+ i +"' /></td> <td  width='91'>Friends Email ID</td><td width='147'><input name='frdEmailID"+ i +"' type='text' class='input002' id='frdEmailID"+ i +"' /></td><td width='16' align='center'><img src='images/r2i-down-arrow.gif' alt='' width='9' height='8' /></td></tr><tr><td colspan='5'><div style='display:none; margin:0px 0px 5px 0px'><table width='464' border='0' cellspacing='0' cellpadding='0'><tr><td width='80'>Friends Country</td><td width='128'><select name='country2"+i+"' class='select001' id='country"+i+"'></select></td><td width='91'>Friends Phone No.</td><td><input name='countryCode"+i+"' type='text' class='input003' id='countryCode"+i+"' style='width:30px' value='Country Code' />&nbsp;<input name='areaCode"+i+"' type='text' class='input003' id='areaCode"+i+"' style='width:30px' value='Area Code' />&nbsp;<input name='phoneNo"+i+"' type='text' class='input003' id='phoneNo"+i+"' style='width:63px' value='Number' /></td></tr></table></div></td></tr><tr><td colspan='5' class='border-btm'><img src='images/spacer.gif' width='1' height='3' alt=''/></td></tr>";
		
	}

	var addmoreflds = "<table width='100%' border='0' cellspacing='0' cellpadding='0' class='list'>" + addmr + "</table>";
	document.getElementById('totalflds').value = tilltotal + 1;
	document.getElementById('div'+tilltotal).innerHTML = addmoreflds;	
}

function createDiv(id)
{
	var divTag = document.createElement("div");
	divTag.id = "div"+id;
	document.getElementById("list").appendChild(divTag);
}






function changecolor(id,colorcode)
{
	var obj = document.getElementById(id)
	obj.style.backgroundColor = colorcode;
}

