 /**
 * all function fnShowFeaturedDiv
 * Created By: Tanvi
 * Created On: 25 June 2010
 * Last Modified By:
 * Last modified On:
 * Purpose : 
 */
function fnShowFeaturedDiv()
{
   elem = document.getElementById("ShowFeaturedDiv");
	 vis = elem.style;
   if(vis.display=='block')
	{
		vis.display = 'none';
		
	}
	else
	{
		vis.display = 'block';
		
	}
}
/**
 * all function 20MAR2002 Version 6.0
 * Created By: Tanvi
 * Created On: 8 June 2010
 * Last Modified By:
 * Last modified On:
 * Purpose : strTrim for all strings
**/
function strUrlEncode(str) {
str = encodeURIComponent(str);
return str;
}

/**
 * all function 20MAR2002 Version 6.0
 * Created By: Tanvi
 * Created On: 8 June 2010
 * Last Modified By:
 * Last modified On:
 * Purpose : strTrim for all strings
**/
function strTrim(str) {
String.prototype.trim = function () {
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
}

var s = new String(str);
// use it like this
//alert(s);
s=s.trim();
//alert("!" + s + "!");
return s;
}

/**
 * all function 20MAR2002 Version 6.0
 * Created By: Tanvi
 * Created On: 8 June 2010
 * Last Modified By:
 * Last modified On:
 * Purpose : preload for all pages
**/
function preload(images) {
    if (document.images) {
        var i = 0;
        var imageArray = new Array();
        imageArray = images.split(',');
        var imageObj = new Image();
        for(i=0; i<=imageArray.length-1; i++) {
		//alert('<img src="' + imageArray[i] + '" />');
           //document.write('<img src="' + imageArray[i] + '" />');// Write to page (uncomment to check images)
            imageObj.src=images[i];
        }
    }
}
/**
 * all function 20MAR2002 Version 6.0
 * Created By: Krunal
 * Created On: 11 May 2010
 * Last Modified By:
 * Last modified On:
 * Purpose : all function for all pages
**/
function reset_html(id) {
$('#'+id).html($('#'+id).html());
} 
/**
 * all function chanage_image
 * Created By: Tanvi
 * Created On: 11 May 2010
 * Last Modified By:
 * Last modified On:
 * Purpose : to getCannedResponse
 */

function chanage_image(div_id)
{
	//alert('tets');
  var url = jQuery("#hdnTemplateImagePath").val();
  newImage = "url("+url+"box_hover.jpg)";	
/*  document.getElementById(div_id).style.backgroundImage= newImage;
  document.getElementById(div_id).style.backgroundPosition = '0px 4px';
  document.getElementById(div_id).style.backgroundRepeat="repeat-x"*/
  document.getElementById(div_id).style.backgroundColor= '#EEEEEE';
}
/**
 * all function remove_image
 * Created By: Tanvi
 * Created On: 11 May 2010
 * Last Modified By:
 * Last modified On:
 * Purpose : to getCannedResponse
 */
function remove_image(div_id)
{
	//alert('tets mouseout');
  newImage = "none";	
  /*document.getElementById(div_id).style.backgroundImage= newImage;*/
  document.getElementById(div_id).style.backgroundColor= '';
}
/**
 * all function fnInsertUsers
 * Created By: Tanvi
 * Created On: 11 May 2010
 * Last Modified By:
 * Last modified On:
 * Purpose : to getCannedResponse
 */
//---------------------------------------------------------------------------------------------------- 
function fnInsertUsers()
{
	
	var txtemail = document.getElementById('txtemail').value;
	var txtusername = document.getElementById('txtusername').value;
	var txtpassword = document.getElementById('txtpassword').value;
	var strsecurity_code = document.getElementById('security_code').value;
	var txtuser_terms_of_use = 0;
	var strSiteUrl = document.getElementById('hdnSiteUrl').value;
	$("input[@type=checkbox][checked]").each( 
    function() { 
       // Insert code here 
	   	txtuser_terms_of_use = 1;
    } 
	);

	fnAjaxInsertUsers(txtemail,txtusername,txtpassword,txtuser_terms_of_use,strsecurity_code);
	//location.href=strSiteUrl+"index.php";
}
//==================================================================================================== 

/**
 * all function fnSelectUsers
 * Created By: Tanvi
 * Created On: 11 May 2010
 * Last Modified By:
 * Last modified On:
 * Purpose : to getCannedResponse
 */
//---------------------------------------------------------------------------------------------------- 
function fnSelectUsers()
{
	
	var txtusername = document.getElementById('txtusername_in').value;
	var txtpassword = document.getElementById('txtpassword_in').value;
	var txtrememberme = 0;
	var strSiteUrl = document.getElementById('hdnSiteUrl').value;
	$("input[@type=checkbox][checked]").each( 
    function() { 
       // Insert code here 
	   	txtrememberme = 1;
    } 
	);
		
	fnAjaxSelectUsers(txtusername,txtpassword,txtrememberme);
	//location.href=strSiteUrl+"index.php";
}
//==================================================================================================== 


/**
 * all function fnforgotpass
 * Created By: Tanvi
 * Created On: 11 May 2010
 * Last Modified By:
 * Last modified On:
 * Purpose : to getCannedResponse
 */
//---------------------------------------------------------------------------------------------------- 
function fnforgotpasss()
{
	
	var txtemail = document.getElementById('txtemail_in').value;

	fnAjaxForgotPass(txtemail);
	//location.href=strSiteUrl+"index.php";
}
//==================================================================================================== 


/**
 * all function checkbox_checker
 * Created By: Krunal
 * Created On: 06 January 2010
 * Last Modified By:
 * Last modified On:
 * Purpose : to checkbox_checker
 */
function checkbox_checker(formObj, min,max,sure,action)
{
	var checked=getSelectedCheckbox(formObj); 
	var total=checked.length;
    var action= action?action:"process";
	var data = document.getElementById('setdata').value;
 	if(formObj.chkParent.checked)
	{
		total=total-1;
	}
	if (max>0 && total > max )
 	{
 		msg="You're limited to only " + max + " selections.\n"
 		msg=msg + "You have made " + total + " selections.\n"
 		msg=msg + "Please remove " + (total-max) + " selection(s)."
 		alert(msg)
 		return (false);
 	}
 
 	if (total< min )
 	{
 		//alert("Please select at least " + min + " record  to " + data + ". " + total + " entered so far.")
		alert("Please select at least " + min + " record  to " + data)
 		return (false);
 	}
   
  if(sure){
  	if(confirm("PLEASE CONFIRM\n About to "+ action +" "+ total + " record(s).")){
 		return (true);
  	}else{
        reset_all(formObj);
	 	return (false);
  	}
  }
 
  return (true);
}

/**
 * all function set_data
 * Created By: Tanvi.M.Patel
 * Created On: 17 March 2010
 * Last Modified By:
 * Last modified On:
 * Purpose : to set the data in hidden field
 */
function set_data(data){
		document.getElementById('setdata').value=data;
}
/**
 * all function selectAll
 * Created By: Krunal
 * Created On: 06 January 2010
 * Last Modified By:
 * Last modified On:
 * Purpose : to selectAll
 */
function selectAll(formObj,task,highlight)
{
   var highlight = highlight || false;

   for (var i=0;i < formObj.length;i++)
   {
      var e = formObj.elements[i];
      if (e.type == 'checkbox')
      {
         if(task==0) {
            e.checked =false;
         }else if(task==1) {
            e.checked = true;
         }else{
            e.checked = (e.checked) ? false : true;
         }
         
	     if(highlight) {
			highLight(e.value,e.checked);
		 }
       }
   }
   //Return false..to mute submits or href.
   return false;
}
/**
 * all function reset_all
 * Created By: Krunal
 * Created On: 06 January 2010
 * Last Modified By:
 * Last modified On:
 * Purpose : to reset_all
 */
function reset_all(formObj){
    return selectAll(formObj,0,true);
}
/**
 * all function select_all
 * Created By: Krunal
 * Created On: 06 January 2010
 * Last Modified By:
 * Last modified On:
 * Purpose : to select_all
 */
function select_all(formObj,highlight){
    return selectAll(formObj,1,highlight);
}

/**
 * all function highLight
 * Created By: Krunal
 * Created On: 06 January 2010
 * Last Modified By:
 * Last modified On:
 * Purpose : to highLight
 */
function highLight(trid,checked) {

    var class_name='highlight';
    var elem;

    if( document.getElementById )
        elem = document.getElementById( trid );
    else if( document.all )
        elem = document.all[trid];
    else if( document.layers )
        elem = document.layers[trid];
    if(elem){
        var found=false;
        var temparray=elem.className.split(' ');
        for(var i=0;i<temparray.length;i++){
            if(temparray[i]==class_name){found=true;}
        }
        if(found && checked) { return; }

        if(found && checked==false){ //remove
            var rep=elem.className.match(' '+class_name)?' '+class_name:class_name;
            elem.className=elem.className.replace(rep,'');
        }
        if(checked && found==false) { //add
            elem.className+=elem.className?' '+class_name:class_name;
        }
    }
}
/**
 * all function highLightToggle
 * Created By: Krunal
 * Created On: 06 January 2010
 * Last Modified By:
 * Last modified On:
 * Purpose : to highLightToggle
 */
function highLightToggle(trid) {

    var class_name='highlight';
    var e;
    if( document.getElementById )
        e = document.getElementById(trid);
    else if( document.all )
        e = document.all[trid];
    else if( document.layers )
        e = document.layers[trid];

    if(e){
        var found=false;
        var temparray=e.className.split(' ');
        for(var i=0;i<temparray.length;i++){
            if(temparray[i]==class_name){found=true;}
        }
        if(found){ //remove
            var rep=e.className.match(' '+class_name)?' '+class_name:class_name;
            e.className=e.className.replace(rep,'');
        }else { //add
            e.className+=e.className?' '+class_name:class_name;
        }
    }
}
/**
 * all function trim
 * Created By: Krunal
 * Created On: 06 January 2010
 * Last Modified By:
 * Last modified On:
 * Purpose : to trim
 */
function trim (str) {
    str = this != window? this : str;
    return str.replace(/^\s+/,'').replace(/\s+$/,'');
}
/**
 * all function strcmp
 * Created By: Krunal
 * Created On: 06 January 2010
 * Last Modified By:
 * Last modified On:
 * Purpose : to strcmp
 */
function strcmp(){
    var arg1=arguments[0];
    if(arg1) {
        for (var i=1; i<arguments.length; i++){
            if(arg1==arguments[i])
                return true;
        }
    }
    return false;
}

/**
 * all function defCombo
 * Created By: Krunal
 * Created On: 06 January 2010
 * Last Modified By:
 * Last modified On:
 * Purpose : to defCombo
 */
function defCombo(combo, val) {
for(var i=0; i<combo.length; i++)
if(combo.options[i].value == val) combo.options[i].selected = true;
}

/**
 * all function setCheckedValue
 * Created By: Krunal
 * Created On: 06 January 2010
 * Last Modified By:
 * Last modified On:
 * Purpose : 
 // set the radio button with the given value as being checked
 // do nothing if there are no radio buttons
 // if the given value does not exist, all the radio buttons
 // are reset to unchecked
 */

function setCheckedValue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}


//==================================================================================================== 
//  Function Name : fnChangeStatus
//	# Created By: Tanvi Patel
//	# Created On: 11 November 2009
//	Last Modified By:
//	Last modified On:
//  Purpose : Change Status for user availability
//  Parameters: 
//---------------------------------------------------------------------------------------------------- 
function fnChangeStatus(status, likeid, imageurl, gId, cid, uId, divi)
{
	var imgUrl = imageurl;
	var like = 'Like';
	if(status == 'Like')
	{
		
		var like = 'Unlike';
		
		/*var label = '<a href="javascript:void(0);" onclick="javascript:fnChangeStatus(\''+like+'\', \''+likeid+'\', \''+imageurl+'\', \''+gId+'\', \''+cid+'\', \''+uId+'\');">'+like+'</a>';			
		jQuery('#likes_'+gId).html(label);*/
	}
	else if(status == 'Unlike')
	{
		var like = 'Like';
		
		/*var label = '<a href="javascript:void(0);" onclick="javascript:fnChangeStatus(\''+like+'\', \''+likeid+'\', \''+imageurl+'\', \''+gId+'\', \''+cid+'\', \''+uId+'\');">'+like+'</a>';			
		jQuery('#likes_'+gId).html(label);*/
	}
	
	//eventid = jQuery("#eventId").val();
	
	fnUpdateStatus(like,likeid,gId, cid, uId,imageurl, divi);
}
//==================================================================================================== 
//  Function Name : fnToggleShare
//	# Created By: Amit Sankhala
//	# Created On: 22nd May - 2010
//	Last Modified By: 
//	Last modified On:
//  Purpose : Toggle Share Button
//  Parameters: 
//---------------------------------------------------------------------------------------------------- 
function fnToggleShare(id)
{	
	if(jQuery('#'+id+'_temp'))
	{
		jQuery('#'+id+'_temp').toggle();
	}
}
//==================================================================================================== 
//  Function Name : fnToggleChangePass
//	# Created By: Amit Sankhala
//	# Created On: 2nd June - 2010
//	Last Modified By: 
//	Last modified On:
//  Purpose : Toggle ChangePass  Button
//  Parameters: 
//---------------------------------------------------------------------------------------------------- 
function fnToggleChangePass(id)
{	

	if(jQuery('#'+id))
	{
		jQuery('#'+id).toggle();
	}
}
//==================================================================================================== 
//  Function Name : fnkeypressed
//	# Created By: Tanvi . M. Patel
//	# Created On: 22nd May - 2010
//	Last Modified By: 
//	Last modified On:
//  Purpose : Toggle Share Button
//  Parameters: 
//---------------------------------------------------------------------------------------------------- 

function fnkeypressed(event,signtype,url){
	
if(event.keyCode==13){
	if(signtype == 'signin') {
	fnSelectUsers(); 
	}
	if(signtype == 'signup') {
	fnInsertUsers(); }
	if(signtype == 'forpass') {
	fnforgotpasss(); }
	if(signtype == 'QuickTitle') {
	fnAddMesg(url); }
	if(signtype == 'txtSearch') {
	fnSearch(url); }
	if(signtype == 'QuickSearch') {
		//alert(url);
	fnAddSearch(url);
	}
	if(signtype == 'Request') {
		
		fnPostSuggestion();
	}
	
	
	return true;
	}
	else
	{
	
	}
} 

//==================================================================================================== 
//  Function Name : slider
//	# Created By: Tanvi Patel
//	# Created On: 12nd June - 2010
//	Last Modified By: 
//	Last modified On:
//  Purpose : For slideshow
//  Parameters: 
//---------------------------------------------------------------------------------------------------- 

jQuery(window).load(function() {
		jQuery('#slider').nivoSlider({
			effect:'fold', //Specify sets like: 'fold,fade,sliceDown','random
			slices:8,
			animSpeed:500,
			pauseTime:4000,
			startSlide:0, //Set starting Slide (0 index)
			directionNav:false, //Next & Prev
			directionNavHide:true, //Only show on hover
			controlNav:true, //1,2,3...
			controlNavThumbs:false, //Use thumbnails for Control Nav
			controlNavThumbsFromRel:false, //Use image rel for thumbs
			keyboardNav:false, //Use left & right arrows
			pauseOnHover:false, //Stop animation while hovering
			manualAdvance:false, //Force manual transitions
			captionOpacity:0.8, //Universal caption opacity
			beforeChange: function(){},
			afterChange: function(){},
			slideshowEnd: function(){} //Triggers after all slides have been shown
		});
	});
//==================================================================================================== 
//  Function Name : fnTextCounter
//	# Created By: Nirav Patel
//	# Created On: 12nd June - 2010
//	Last Modified By: 
//	Last modified On:
//  Purpose : For Count Text charecter
//  Parameters: 
//---------------------------------------------------------------------------------------------------- 
function fnTextCounter(field,cntfield,maxlimit)
{
	if (field.value.length > maxlimit) // if too long...trim it!
	{
		field.value = field.value.substring(0, maxlimit);
	}
	else
	{
		cntfield.innerHTML = field.value.length;
	}
}
//==================================================================================================== 
//  Function Name : tootltip
//	# Created By: Tanvi Patel
//	# Created On: 12nd June - 2010
//	Last Modified By: 
//	Last modified On:
//  Purpose : For tootltip
//  Parameters: 
//---------------------------------------------------------------------------------------------------- 

 

jQuery(function() {
jQuery('#set_right *').tooltip();
});

  
			function roll_over(img_name, img_src)
			   {
   				document[img_name].src = img_src;
   				}
			 
