	function validateForm ( form_obj )
	{
		var returnValue = true ;
		$("#"+form_obj+" input,select,textarea").each ( function ( )
							{
								if ( $(this).attr("sch_req") == "1" && returnValue )
								{
									if ( $(this).val() == "" )
									{
										alert ( $(this).attr("sch_msg")+" cannot be empty" ) ;
										$(this).focus();
										returnValue = false ;
									}
								}
							}

		 ) ;
		 return returnValue ;

	}

	function copy_coupon_and_go_to_site ( coupon_id )
	{
		window.open ( base_url +"load/"+coupon_id+"/" , "_blank" ) ;
	}

	function animate_area ( div_id , direction )
	{
		if ( direction == 0 )
			$("#"+div_id).animate ( { scrollLeft : "-=504" } , "slow" ) ;
		else
			$("#"+div_id).animate ( { scrollLeft : "+=504" } , "slow" ) ;
	}

	function show_tool_tip ( copon_id )
	{
		$("#coupon_Tool_tip_action_"+copon_id).show() ;
	}

	function hide_tool_tip ( copon_id )
	{
		$("#coupon_Tool_tip_action_"+copon_id).hide() ;
	}


	function set_copy_command ( text_to_copy , control_id , coupon_id )
	{
		if ( navigator.userAgent.indexOf("MSIE") > -1 )
		{
			$("#"+control_id).click ( function ( )
										{
											window.clipboardData.setData("Text",text_to_copy);
											copy_coupon_and_go_to_site ( coupon_id ) ;
										}
									 ) ;
		}
		else
		{
			var clip = new ZeroClipboard.Client();

			ZeroClipboard.setMoviePath ( base_url +"js/ZeroClipboard.swf" ) ;

			clip.setText( text_to_copy );
			clip.setHandCursor( true );
			clip.addEventListener( 'mouseOver', function(client) {
                                show_tool_tip ( coupon_id ) ;
                        } );
			clip.addEventListener( 'mouseOut', function(client) {
                                hide_tool_tip ( coupon_id ) ;
                        } );
			clip.addEventListener( 'complete', function(client, text) {
				$("#"+control_id).css("background-color" , "#33CC66");
				$("#coupon_Tool_tip_action_"+coupon_id).css("width","60px").text("Copied ! ") ;
				copy_coupon_and_go_to_site ( coupon_id ) ;
			} );

			clip.glue( control_id );
		}
	}


	var wd = $(window).width ( ) ;
	var ht = $(window).height ( ) ;

	function close_window ( )
	{

		$("#div_Window").animate ( { top : "25%" , opacity : 0.10 } , "normal" , function ( )
																					{
																						$(this).hide().css({top:"15%"});
																						$("#div_Background").hide ( ) ;
																					}
			 ) ;

	}

	function show_Screen_bg ( divArea )
	{

		$("#div_Background").css ( {"left" : "0px" , "top" : "0px" , "opacity" : 0.60} ).width( wd ).height ( ht ).show();

	}

	function show_window_comment( coupon_id )
	{
		show_Screen_bg ( ) ;

		$("#div_loading").show();
		$("#div_Window").load(base_url + "comments_post/" + coupon_id +"/", function()
																						{
																							var n_wd = $("#div_Window").width ( ) ;
																							var n_ht = $("#div_Window").height ( ) ;
																							//$(this).css ( { "left" : ( ( wd / 2 ) - ( n_wd / 2 ) )+"px" , "opacity" : 0.10 } ).show().animate ( { top : "20%" , opacity : 1.0 } , "normal" ) ;
																							$(this).css ( { "left" : ( ( wd / 2 ) - ( n_wd / 2 ) )+"px" , "opacity" : 0.10 } ).show().animate ( { top : "20%" , opacity : 1.0 } , "normal" ) ;
																							$("#div_loading").hide();
																						}
		 ) ;
	}


	function show_comments ( coupon_id )
	{
		$("#li_close_comments_"+coupon_id).children().show();
		$("#li_write_comments_"+coupon_id).children().show();
		$("#div_comments_"+coupon_id).slideDown('normal');
	}

	function close_comments ( coupon_id )
	{
		$("#div_comments_"+coupon_id).slideUp('normal');
		$("#li_close_comments_"+coupon_id).children().hide();
		$("#li_write_comments_"+coupon_id).children().hide();
	}


