<?php
if ( ! function_exists('removeMSWordattributes1')){
	function removeMSWordattributes1($str)
	{
		$str = str_replace('<p class="MsoNormal"', '<p', $str);
		$str = str_replace('class="MsoNormal"', '', $str);
		$str = str_replace('<span style="mso-spacerun:yes">&nbsp; </span>"', '&nbsp;', $str);
		$str = str_replace('<span style="mso-spacerun:yes">&nbsp;</span>"', '&nbsp;', $str);
		$str = str_replace('style="mso-spacerun:yes""', '', $str);
		$str = str_replace('"mso-bidi-font-weight:""', 'font-weight:', $str);

		$str = iconv('UTF-8', 'ASCII//TRANSLIT', $str);
		$str = str_replace(chr(130), ',', $str);    // baseline single quote
		$str = str_replace(chr(132), '"', $str);    // baseline double quote
		$str = str_replace(chr(133), '...', $str);  // ellipsis
		$str = str_replace(chr(145), "'", $str);    // left single quote
		$str = str_replace(chr(146), "'", $str);    // right single quote
		$str = str_replace(chr(147), '"', $str);    // left double quote
		$str = str_replace(chr(148), '"', $str);    // right double quote
		$str = mb_convert_encoding(
				$str,
				"HTML-ENTITIES",
				"UTF-8"
		);

		$quotes = array(
			"\xC2\xAB"     => '"',
			"\xC2\xBB"     => '"',
			"\xE2\x80\x98" => "'",
			"\xE2\x80\x99" => "'",
			"\xE2\x80\x9A" => "'",
			"\xE2\x80\x9B" => "'",
			"\xE2\x80\x9C" => '"',
			"\xE2\x80\x9D" => '"',
			"\xE2\x80\x9E" => '"',
			"\xE2\x80\x9F" => '"',
			"\xE2\x80\xB9" => "'",
			"\xE2\x80\xBA" => "'"
		);
		$str = strtr($str, $quotes);


		return $str;
	}
}

if ( ! function_exists('removeMSWordattributesNew1')){
	function removeMSWordattributesNew1($str)
	{
		$str = str_replace('<p class="MsoNormal"', '<p', $str);
		$str = str_replace('class="MsoNormal"', '', $str);
		$str = str_replace('<span style="mso-spacerun:yes">&nbsp; </span>"', '&nbsp;', $str);
		$str = str_replace('<span style="mso-spacerun:yes">&nbsp;</span>"', '&nbsp;', $str);
		$str = str_replace('style="mso-spacerun:yes""', '', $str);
		$str = str_replace('"mso-bidi-font-weight:""', 'font-weight:', $str);

		$str = iconv('UTF-8', 'ASCII//TRANSLIT', $str);
		$str = str_replace(chr(130), ',', $str);    // baseline single quote
		$str = str_replace(chr(132), '"', $str);    // baseline double quote
		$str = str_replace(chr(133), '...', $str);  // ellipsis
		$str = str_replace(chr(145), "'", $str);    // left single quote
		$str = str_replace(chr(146), "'", $str);    // right single quote
		$str = str_replace(chr(147), '"', $str);    // left double quote
		$str = str_replace(chr(148), '"', $str);    // right double quote
		$str = mb_convert_encoding(
				$str,
				"HTML-ENTITIES",
				"UTF-8"
		);

		/* $quotes = array(
			"\xC2\xAB"     => '"',
			"\xC2\xBB"     => '"',
			"\xE2\x80\x98" => "'",
			"\xE2\x80\x99" => "'",
			"\xE2\x80\x9A" => "'",
			"\xE2\x80\x9B" => "'",
			"\xE2\x80\x9C" => '"',
			"\xE2\x80\x9D" => '"',
			"\xE2\x80\x9E" => '"',
			"\xE2\x80\x9F" => '"',
			"\xE2\x80\xB9" => "'",
			"\xE2\x80\xBA" => "'"
		); */
		$str = strtr($str, $quotes);


		return $str;
	}
}
if ( ! function_exists('qryToCommaSepString1')){
	function qryToCommaSepString1($sqlQry, $uniqueResult = 'Y', &$countOfArr = 0)
	{
		
		$result = mysql_query($sqlQry) or die($sqlQry . " : " . mysql_error());
		$namesW=array();
		//$namesW[]=0;
		while ($row = mysql_fetch_row($result))
		 $namesW[]=$row[0];
		$countOfArr = count($namesW);
		if( 'Y' == $uniqueResult )
			$dist_emails = implode(',',array_values(array_unique(array_filter($namesW))));
		else
			$dist_emails = implode(',',$namesW);
		mysql_free_result($result);
		return $dist_emails;
	}
}

if ( ! function_exists('getImagesByTableType')){
	function getImagesByTableType($lead_id='', $table_type=''){
		if($table_type=='')
			$table_type='plant';
		$query = "SELECT image_url, type
				FROM images 
				where table_id='$lead_id' 
				and table_type like '%$table_type%'";		
		$rs = mysql_query($query)or die(mysql_error());
		$images=array();
		while($row = mysql_fetch_object($rs))
		{
			//$images[] = $row->image_url;
			//$emedium_url = str_replace('assets/product_img/', 'images/leads/emedium/', $row->image_url);
			$imgArr = array( "type" => $row->type, "imageURL"=>str_replace('../', BASEURL, $row->image_url), "thumbnailImage"=>str_replace('../', BASEURL, $row->image_url),"videoUrl"=>"");
			$images[] = $imgArr;	
		}	
		return $images;
	}
}

	function getDateRangeByTwoDates($startDate="", $endDate=''){
		//$start_date = date('Y-m-01', strtotime($start_date));
        //$end_date = date('Y-m-30', strtotime($end_date));
		$dateRange = array();			
		$chkQtr = array();
		$chkYear = array();
		while (strtotime($startDate) <= strtotime($endDate)) {
			///$months[] = array('year' => date('Y', strtotime($startDate)), 'month' => date('m', strtotime($startDate)), );
			//monthly
			$dateRange['monthly'][] =	array(
								"key" => date('m-Y', strtotime($startDate)),
								"value" => date("M Y", strtotime($startDate))
							 );
			//quarterly
			$quater =  ceil(date('n', strtotime($startDate))/3);
			$year =  date('Y', strtotime($startDate));
			if(in_array($year.'-'.$quater, $chkQtr)===false){
				$chkQtr[] = date('Y', strtotime($startDate)).'-'.$row['quarter'];
				
				$dateRange['quarterly'][] =  array(
							  "key" => "Q".$quater.' '.$year,
							  "value" => "Q".$quater."-". $year
							 );
			}
			
			//yearly
			if(in_array($year, $chkYear)===false){
					$chkYear[] = $year;
					$dateRange['yearly'][] =  array(
							  "key" => $year,
							  "value" => $year
							 );
			}
			
			$startDate = date('d M Y', strtotime($startDate.'+ 1 month'));
		}
		
		return $dateRange;
	}
	
	function getDateRange($section="",$condition=''){
		$whr = " where 1";
		switch($section){
			case "prices":
			case "price":
				if($condition)
					$whr = " where ".$condition;
				$_sql_date = "select YEAR(f_date) AS year, MONTH(f_date) as month, QUARTER(f_date) AS quarter from tbl_steelprices $whr GROUP BY YEAR(f_date), MONTH(f_date), QUARTER(f_date) ORDER BY YEAR(f_date), MONTH(f_date), QUARTER(f_date)";
			break;
			case "import":
			break;
			case "export":
			break;
		}
		///echo $_sql_date;
		///$_sql_date = "select YEAR(f_date) AS year, MONTH(f_date) as month, QUARTER(f_date) AS quarter from tbl_steelprices where 1 GROUP BY YEAR(f_date), MONTH(f_date), QUARTER(f_date) ORDER BY YEAR(f_date), MONTH(f_date), QUARTER(f_date)";
		$qry_date =mysql_query($_sql_date)or die(mysql_error().'<pre>'.$_sql_date.'</pre>');
		$dateRange = array();			
		$chkQtr = array();
		$chkYear = array();
		while($row = mysql_fetch_assoc($qry_date))
		{							
			
			///monthly array
			$dateRange['monthly'][] =  array(
							  "key" => $row['month'].'-'.$row['year'],
							  "value" => date("M Y", strtotime('01-'.$row['month'].'-'.$row['year']))
							 );
			///quarterly array
			if(in_array($row['year'].'-'.$row['quarter'], $chkQtr)===false){
				$chkQtr[] = $row['year'].'-'.$row['quarter'];
				if($row['quarter']==1)
					$quarterText = " (Jan ".$row['year']." to Mar ".$row['year'].")";
				if($row['quarter']==2)
					$quarterText = " (Apr ".$row['year']." to Jun ".$row['year'].")";
				if($row['quarter']==3)
					$quarterText = " (Jul ".$row['year']." to Sep ".$row['year'].")";
				if($row['quarter']==4)
					$quarterText = " (Oct ".$row['year']." to Dec ".$row['year'].")";
				
				$dateRange['quarterly'][] =  array(
							  "key" => $row['quarter'].'-'.$row['year'],
							  "value" => "Q".$row['quarter']."-". $row['year'] . $quarterText
							 );
			}
			///year array
			if(in_array($row['year'], $chkYear)===false){
					$chkYear[] = $row['year'];
					$dateRange['yearly'][] =  array(
							  "key" => $row['year'],
							  "value" => $row['year'] 
							 );
			}
			//$dateRange['yearly'][] = $row['year'];
			
			
		}
		return $dateRange;
	}
	
	/*
		i/p
			type => order / subscription
			currency => "INR/USD/..."
			amount => order / subscription
			logID => log id
			planID => plan id in case subscription
			description => ""
	*/
	function getRZOrderID($type="order",$condition=''){
		
	}
	
	function setOneSignalNotifiation($fcmToken=''){
		$ch = curl_init();
		$fields = array(
			'app_id' => "368cc8df-ee3c-4401-9917-5e5494a1db0f",
			'identifier' => $fcmToken,
			'language' => "en",
			'timezone' => "-28800",
			'game_version' => "2.2",
			'device_os' => "10.0",
			'device_type' => "0",
			'device_model' => "iPhone 5s"//,
		   // 'test_type' => 1,
			//'tags' => array("id" => $row['id'], "UserID" => $row['user_id'])
		);
		
		$fields = json_encode($fields);
		///print("\nJSON sent:\n");
		////print($fields);
		
		curl_setopt($ch, CURLOPT_URL, "https://onesignal.com/api/v1/players");
		curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
		curl_setopt($ch, CURLOPT_HEADER, FALSE);
		curl_setopt($ch, CURLOPT_POST, TRUE);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
		
		$response = curl_exec($ch);
		//echo "<br />" . $response;
		//print_r($response);
		///print("Done\n");

		curl_close($ch);
		
		return true;

	}
	
	function replace_between($str, $needle_start, $needle_end, $replacement) {
		$pos = strpos($str, $needle_start);
		$start = $pos === false ? 0 : $pos + strlen($needle_start);

		$pos = strpos($str, $needle_end, $start);
		$end = $start === false ? strlen($str) : $pos;
	 
		return substr_replace($str,$replacement,  $start, $end - $start);
	}
	
	function getHeatMapColor($val=0) {
		$changePerColorCode = array(
			99=>array('bgColor'=>'#001008','textColor'=>'#ffffff'),
			98=>array('bgColor'=>'#00180c','textColor'=>'#ffffff'),
			97=>array('bgColor'=>'#00180c','textColor'=>'#ffffff'),
			96=>array('bgColor'=>'#002011','textColor'=>'#ffffff'),
			95=>array('bgColor'=>'#002011','textColor'=>'#ffffff'),
			94=>array('bgColor'=>'#002815','textColor'=>'#ffffff'),
			93=>array('bgColor'=>'#002815','textColor'=>'#ffffff'),
			92=>array('bgColor'=>'#003019','textColor'=>'#ffffff'),
			91=>array('bgColor'=>'#003019','textColor'=>'#ffffff'),
			90=>array('bgColor'=>'#00391e','textColor'=>'#ffffff'),
			89=>array('bgColor'=>'#00391e','textColor'=>'#ffffff'),
			88=>array('bgColor'=>'#004122','textColor'=>'#ffffff'),
			87=>array('bgColor'=>'#004122','textColor'=>'#ffffff'),
			86=>array('bgColor'=>'#004926','textColor'=>'#ffffff'),
			85=>array('bgColor'=>'#004926','textColor'=>'#ffffff'),
			84=>array('bgColor'=>'#00512b','textColor'=>'#ffffff'),
			83=>array('bgColor'=>'#00512b','textColor'=>'#ffffff'),
			82=>array('bgColor'=>'#00592f','textColor'=>'#ffffff'),
			81=>array('bgColor'=>'#00592f','textColor'=>'#ffffff'),
			80=>array('bgColor'=>'#006133','textColor'=>'#ffffff'),
			79=>array('bgColor'=>'#006133','textColor'=>'#ffffff'),
			78=>array('bgColor'=>'#006a38','textColor'=>'#ffffff'),
			77=>array('bgColor'=>'#006a38','textColor'=>'#ffffff'),
			76=>array('bgColor'=>'#00723c','textColor'=>'#ffffff'),
			75=>array('bgColor'=>'#00723c','textColor'=>'#ffffff'),
			74=>array('bgColor'=>'#007a40','textColor'=>'#ffffff'),
			73=>array('bgColor'=>'#007a40','textColor'=>'#ffffff'),
			72=>array('bgColor'=>'#008245','textColor'=>'#ffffff'),
			71=>array('bgColor'=>'#008245','textColor'=>'#ffffff'),
			70=>array('bgColor'=>'#008a49','textColor'=>'#ffffff'),
			69=>array('bgColor'=>'#008a49','textColor'=>'#ffffff'),
			68=>array('bgColor'=>'#00924d','textColor'=>'#ffffff'),
			67=>array('bgColor'=>'#00924d','textColor'=>'#ffffff'),
			66=>array('bgColor'=>'#009b52','textColor'=>'#ffffff'),
			65=>array('bgColor'=>'#009b52','textColor'=>'#ffffff'),
			64=>array('bgColor'=>'#00a356','textColor'=>'#ffffff'),
			63=>array('bgColor'=>'#00a356','textColor'=>'#ffffff'),
			62=>array('bgColor'=>'#00ab5a','textColor'=>'#ffffff'),
			61=>array('bgColor'=>'#00ab5a','textColor'=>'#ffffff'),
			60=>array('bgColor'=>'#00b35f','textColor'=>'#ffffff'),
			59=>array('bgColor'=>'#00b35f','textColor'=>'#ffffff'),
			58=>array('bgColor'=>'#00bb63','textColor'=>'#ffffff'),
			57=>array('bgColor'=>'#00bb63','textColor'=>'#ffffff'),
			56=>array('bgColor'=>'#00c367','textColor'=>'#ffffff'),
			55=>array('bgColor'=>'#00c367','textColor'=>'#ffffff'),
			54=>array('bgColor'=>'#00cc6c','textColor'=>'#ffffff'),
			53=>array('bgColor'=>'#00cc6c','textColor'=>'#ffffff'),
			52=>array('bgColor'=>'#00d470','textColor'=>'#ffffff'),
			51=>array('bgColor'=>'#00d470','textColor'=>'#ffffff'),
			50=>array('bgColor'=>'#00dc74','textColor'=>'#ffffff'),
			49=>array('bgColor'=>'#00dc74','textColor'=>'#ffffff'),
			48=>array('bgColor'=>'#00e479','textColor'=>'#ffffff'),
			47=>array('bgColor'=>'#00e479','textColor'=>'#ffffff'),
			46=>array('bgColor'=>'#00ec7d','textColor'=>'#ffffff'),
			45=>array('bgColor'=>'#00ec7d','textColor'=>'#ffffff'),
			44=>array('bgColor'=>'#00f481','textColor'=>'#ffffff'),
			43=>array('bgColor'=>'#00f481','textColor'=>'#ffffff'),
			42=>array('bgColor'=>'#00fc86','textColor'=>'#ffffff'),
			41=>array('bgColor'=>'#00fc86','textColor'=>'#ffffff'),
			40=>array('bgColor'=>'#06ff89','textColor'=>'#ffffff'),
			39=>array('bgColor'=>'#06ff89','textColor'=>'#ffffff'),
			38=>array('bgColor'=>'#16ff91','textColor'=>'#ffffff'),
			37=>array('bgColor'=>'#16ff91','textColor'=>'#ffffff'),
			36=>array('bgColor'=>'#16ff91','textColor'=>'#ffffff'),
			35=>array('bgColor'=>'#16ff91','textColor'=>'#ffffff'),
			34=>array('bgColor'=>'#1eff95','textColor'=>'#000000'),
			33=>array('bgColor'=>'#1eff95','textColor'=>'#000000'),
			32=>array('bgColor'=>'#26ff99','textColor'=>'#000000'),
			31=>array('bgColor'=>'#26ff99','textColor'=>'#000000'),
			30=>array('bgColor'=>'#2eff9d','textColor'=>'#000000'),
			29=>array('bgColor'=>'#2eff9d','textColor'=>'#000000'),
			28=>array('bgColor'=>'#37ffa0','textColor'=>'#000000'),
			27=>array('bgColor'=>'#37ffa0','textColor'=>'#000000'),
			26=>array('bgColor'=>'#3fffa4','textColor'=>'#000000'),
			25=>array('bgColor'=>'#3fffa4','textColor'=>'#000000'),
			24=>array('bgColor'=>'#47ffa8','textColor'=>'#000000'),
			23=>array('bgColor'=>'#47ffa8','textColor'=>'#000000'),
			22=>array('bgColor'=>'#4fffac','textColor'=>'#000000'),
			21=>array('bgColor'=>'#4fffac','textColor'=>'#000000'),
			20=>array('bgColor'=>'#57ffb0','textColor'=>'#000000'),
			19=>array('bgColor'=>'#5fffb4','textColor'=>'#000000'),
			18=>array('bgColor'=>'#68ffb8','textColor'=>'#000000'),
			17=>array('bgColor'=>'#70ffbb','textColor'=>'#000000'),
			16=>array('bgColor'=>'#78ffbf','textColor'=>'#000000'),
			15=>array('bgColor'=>'#80ffc3','textColor'=>'#000000'),
			14=>array('bgColor'=>'#88ffc7','textColor'=>'#000000'),
			13=>array('bgColor'=>'#90ffcb','textColor'=>'#000000'),
			12=>array('bgColor'=>'#99ffcf','textColor'=>'#000000'),
			11=>array('bgColor'=>'#a1ffd2','textColor'=>'#000000'),
			10=>array('bgColor'=>'#a9ffd6','textColor'=>'#000000'),
			9=>array('bgColor'=>'#b1feda','textColor'=>'#000000'),
			8=>array('bgColor'=>'#b9fede','textColor'=>'#000000'),
			7=>array('bgColor'=>'#c1fee2','textColor'=>'#000000'),
			6=>array('bgColor'=>'#c9fee6','textColor'=>'#000000'),
			5=>array('bgColor'=>'#d2fee9','textColor'=>'#000000'),
			4=>array('bgColor'=>'#dafeed','textColor'=>'#000000'),
			3=>array('bgColor'=>'#e2fef1','textColor'=>'#000000'),
			2=>array('bgColor'=>'#eafff5','textColor'=>'#000000'),
			1=>array('bgColor'=>'#f2fff9','textColor'=>'#000000'),
			0=>array('bgColor'=>'#ffffff','textColor'=>'#000000'),
			-1=>array('bgColor'=>'#fef3f4','textColor'=>'#000000'),
			-2=>array('bgColor'=>'#fdecec','textColor'=>'#000000'),
			-3=>array('bgColor'=>'#fce4e5','textColor'=>'#000000'),
			-4=>array('bgColor'=>'#fcddde','textColor'=>'#000000'),
			-5=>array('bgColor'=>'#fbd5d6','textColor'=>'#000000'),
			-6=>array('bgColor'=>'#facecf','textColor'=>'#000000'),
			-7=>array('bgColor'=>'#fac6c8','textColor'=>'#000000'),
			-8=>array('bgColor'=>'#f9bfc0','textColor'=>'#000000'),
			-9=>array('bgColor'=>'#f8b7b9','textColor'=>'#000000'),
			-10=>array('bgColor'=>'#f8b0b2','textColor'=>'#000000'),
			-11=>array('bgColor'=>'#f7a8aa','textColor'=>'#000000'),
			-12=>array('bgColor'=>'#f6a1a3','textColor'=>'#000000'),
			-13=>array('bgColor'=>'#f6999c','textColor'=>'#000000'),
			-14=>array('bgColor'=>'#f59294','textColor'=>'#000000'),
			-15=>array('bgColor'=>'#f48a8d','textColor'=>'#000000'),
			-16=>array('bgColor'=>'#f48386','textColor'=>'#000000'),
			-17=>array('bgColor'=>'#f37b7e','textColor'=>'#000000'),
			-18=>array('bgColor'=>'#f27477','textColor'=>'#000000'),
			-19=>array('bgColor'=>'#f26c70','textColor'=>'#000000'),
			-20=>array('bgColor'=>'#f16568','textColor'=>'#000000'),
			-21=>array('bgColor'=>'#f05d61','textColor'=>'#000000'),
			-22=>array('bgColor'=>'#f05d61','textColor'=>'#000000'),
			-23=>array('bgColor'=>'#f0565a','textColor'=>'#000000'),
			-24=>array('bgColor'=>'#f0565a','textColor'=>'#000000'),
			-25=>array('bgColor'=>'#ef4e53','textColor'=>'#000000'),
			-26=>array('bgColor'=>'#ef4e53','textColor'=>'#000000'),
			-27=>array('bgColor'=>'#ee474b','textColor'=>'#000000'),
			-28=>array('bgColor'=>'#ee474b','textColor'=>'#000000'),
			-29=>array('bgColor'=>'#ee3f44','textColor'=>'#000000'),
			-30=>array('bgColor'=>'#ee3f44','textColor'=>'#000000'),
			-31=>array('bgColor'=>'#ed383d','textColor'=>'#000000'),
			-32=>array('bgColor'=>'#ed383d','textColor'=>'#000000'),
			-33=>array('bgColor'=>'#ec3035','textColor'=>'#000000'),
			-34=>array('bgColor'=>'#ec3035','textColor'=>'#000000'),
			-35=>array('bgColor'=>'#ec292e','textColor'=>'#ffffff'),
			-36=>array('bgColor'=>'#ec292e','textColor'=>'#ffffff'),
			-37=>array('bgColor'=>'#eb2127','textColor'=>'#ffffff'),
			-38=>array('bgColor'=>'#eb2127','textColor'=>'#ffffff'),
			-39=>array('bgColor'=>'#ea1a1f','textColor'=>'#ffffff'),
			-40=>array('bgColor'=>'#ea1a1f','textColor'=>'#ffffff'),
			-41=>array('bgColor'=>'#e8141a','textColor'=>'#ffffff'),
			-42=>array('bgColor'=>'#e8141a','textColor'=>'#ffffff'),
			-43=>array('bgColor'=>'#e11319','textColor'=>'#ffffff'),
			-44=>array('bgColor'=>'#e11319','textColor'=>'#ffffff'),
			-45=>array('bgColor'=>'#d91318','textColor'=>'#ffffff'),
			-46=>array('bgColor'=>'#d91318','textColor'=>'#ffffff'),
			-47=>array('bgColor'=>'#d21217','textColor'=>'#ffffff'),
			-48=>array('bgColor'=>'#d21217','textColor'=>'#ffffff'),
			-49=>array('bgColor'=>'#ca1116','textColor'=>'#ffffff'),
			-50=>array('bgColor'=>'#ca1116','textColor'=>'#ffffff'),
			-51=>array('bgColor'=>'#c31115','textColor'=>'#ffffff'),
			-52=>array('bgColor'=>'#c31115','textColor'=>'#ffffff'),
			-53=>array('bgColor'=>'#bb1015','textColor'=>'#ffffff'),
			-54=>array('bgColor'=>'#bb1015','textColor'=>'#ffffff'),
			-55=>array('bgColor'=>'#b40f14','textColor'=>'#ffffff'),
			-56=>array('bgColor'=>'#b40f14','textColor'=>'#ffffff'),
			-57=>array('bgColor'=>'#ac0f13','textColor'=>'#ffffff'),
			-58=>array('bgColor'=>'#ac0f13','textColor'=>'#ffffff'),
			-59=>array('bgColor'=>'#a50e12','textColor'=>'#ffffff'),
			-60=>array('bgColor'=>'#a50e12','textColor'=>'#ffffff'),
			-61=>array('bgColor'=>'#9d0d11','textColor'=>'#ffffff'),
			-62=>array('bgColor'=>'#9d0d11','textColor'=>'#ffffff'),
			-63=>array('bgColor'=>'#960d10','textColor'=>'#ffffff'),
			-64=>array('bgColor'=>'#960d10','textColor'=>'#ffffff'),
			-65=>array('bgColor'=>'#8e0c0f','textColor'=>'#ffffff'),
			-66=>array('bgColor'=>'#8e0c0f','textColor'=>'#ffffff'),
			-67=>array('bgColor'=>'#870b0f','textColor'=>'#ffffff'),
			-68=>array('bgColor'=>'#870b0f','textColor'=>'#ffffff'),
			-69=>array('bgColor'=>'#7f0b0e','textColor'=>'#ffffff'),
			-70=>array('bgColor'=>'#7f0b0e','textColor'=>'#ffffff'),
			-71=>array('bgColor'=>'#780a0d','textColor'=>'#ffffff'),
			-72=>array('bgColor'=>'#780a0d','textColor'=>'#ffffff'),
			-73=>array('bgColor'=>'#70090c','textColor'=>'#ffffff'),
			-74=>array('bgColor'=>'#70090c','textColor'=>'#ffffff'),
			-75=>array('bgColor'=>'#69090b','textColor'=>'#ffffff'),
			-76=>array('bgColor'=>'#69090b','textColor'=>'#ffffff'),
			-77=>array('bgColor'=>'#61080a','textColor'=>'#ffffff'),
			-78=>array('bgColor'=>'#61080a','textColor'=>'#ffffff'),
			-79=>array('bgColor'=>'#5a070a','textColor'=>'#ffffff'),
			-80=>array('bgColor'=>'#5a070a','textColor'=>'#ffffff'),
			-81=>array('bgColor'=>'#520709','textColor'=>'#ffffff'),
			-82=>array('bgColor'=>'#520709','textColor'=>'#ffffff'),
			-83=>array('bgColor'=>'#4b0608','textColor'=>'#ffffff'),
			-84=>array('bgColor'=>'#4b0608','textColor'=>'#ffffff'),
			-85=>array('bgColor'=>'#430507','textColor'=>'#ffffff'),
			-86=>array('bgColor'=>'#430507','textColor'=>'#ffffff'),
			-87=>array('bgColor'=>'#3c0506','textColor'=>'#ffffff'),
			-88=>array('bgColor'=>'#3c0506','textColor'=>'#ffffff'),
			-89=>array('bgColor'=>'#340405','textColor'=>'#ffffff'),
			-90=>array('bgColor'=>'#340405','textColor'=>'#ffffff'),
			-91=>array('bgColor'=>'#2d0305','textColor'=>'#ffffff'),
			-92=>array('bgColor'=>'#2d0305','textColor'=>'#ffffff'),
			-93=>array('bgColor'=>'#250304','textColor'=>'#ffffff'),
			-94=>array('bgColor'=>'#250304','textColor'=>'#ffffff'),
			-95=>array('bgColor'=>'#1e0203','textColor'=>'#ffffff'),
			-96=>array('bgColor'=>'#1e0203','textColor'=>'#ffffff'),
			-97=>array('bgColor'=>'#160102','textColor'=>'#ffffff'),
			-98=>array('bgColor'=>'#160102','textColor'=>'#ffffff'),
			-99=>array('bgColor'=>'#0f0101','textColor'=>'#ffffff')
			);
		if($val >= 99)
			return $changePerColorCode[99];
		elseif($val <= -99)
			return $changePerColorCode[-99];
		else
			return $changePerColorCode[round($val)];		
	}
?>
