<?php
	if(!current_user_can('manage_options'))
	{
		die('Access Denied');
	}
	global $wpdb;
	$tsc_ids_table  = $wpdb->prefix . "totalsoft_cal_ids";
	$tsc_events_table  = $wpdb->prefix . "totalsoft_cal_events";
	$tsc_event_settings_table  = $wpdb->prefix . "totalsoft_cal_events_p2";
	$tsc_event_rec_table = $wpdb->prefix . "totalsoft_cal_events_p3";
	$tsc_types_table  = $wpdb->prefix . "totalsoft_cal_types";
	$tsc_event_calendar_table  = $wpdb->prefix . "totalsoft_cal_1";
	$tsc_simple_calendar_table  = $wpdb->prefix . "totalsoft_cal_2";
	$tsc_flexible_calendar_table  = $wpdb->prefix . "totalsoft_cal_3";
	$tsc_timeline_calendar_table  = $wpdb->prefix . "totalsoft_cal_4";
	$tsc_settings_table  = $wpdb->prefix . "totalsoft_cal_part";
	require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
	$tsc_event_calendar_table_create = 'CREATE TABLE IF NOT EXISTS ' .$tsc_event_calendar_table . '( id INTEGER(10) UNSIGNED AUTO_INCREMENT, TotalSoftCal_ID VARCHAR(255) NOT NULL, TotalSoftCal_Name VARCHAR(255) NOT NULL, TotalSoftCal_Type VARCHAR(255) NOT NULL, TotalSoftCal_BgCol VARCHAR(255) NOT NULL, TotalSoftCal_GrCol VARCHAR(255) NOT NULL, TotalSoftCal_GW VARCHAR(255) NOT NULL, TotalSoftCal_BW VARCHAR(255) NOT NULL, TotalSoftCal_BStyle VARCHAR(255) NOT NULL, TotalSoftCal_BCol VARCHAR(255) NOT NULL, TotalSoftCal_BSCol VARCHAR(255) NOT NULL, TotalSoftCal_MW VARCHAR(255) NOT NULL, TotalSoftCal_HBgCol VARCHAR(255) NOT NULL, TotalSoftCal_HCol VARCHAR(255) NOT NULL, TotalSoftCal_HFS VARCHAR(255) NOT NULL, TotalSoftCal_HFF VARCHAR(255) NOT NULL, TotalSoftCal_WBgCol VARCHAR(255) NOT NULL, TotalSoftCal_WCol VARCHAR(255) NOT NULL, TotalSoftCal_WFS VARCHAR(255) NOT NULL, TotalSoftCal_WFF VARCHAR(255) NOT NULL, TotalSoftCal_LAW VARCHAR(255) NOT NULL, TotalSoftCal_LAWS VARCHAR(255) NOT NULL, TotalSoftCal_LAWC VARCHAR(255) NOT NULL, TotalSoftCal_DBgCol VARCHAR(255) NOT NULL, TotalSoftCal_DCol VARCHAR(255) NOT NULL, TotalSoftCal_DFS VARCHAR(255) NOT NULL, TotalSoftCal_TBgCol VARCHAR(255) NOT NULL, TotalSoftCal_TCol VARCHAR(255) NOT NULL, TotalSoftCal_TFS VARCHAR(255) NOT NULL, TotalSoftCal_TNBgCol VARCHAR(255) NOT NULL, TotalSoftCal_HovBgCol VARCHAR(255) NOT NULL, TotalSoftCal_HovCol VARCHAR(255) NOT NULL, TotalSoftCal_NumPos VARCHAR(255) NOT NULL, TotalSoftCal_WDStart VARCHAR(255) NOT NULL, TotalSoftCal_RefIcCol VARCHAR(255) NOT NULL, TotalSoftCal_RefIcSize VARCHAR(255) NOT NULL, TotalSoftCal_ArrowType VARCHAR(255) NOT NULL, TotalSoftCal_ArrowLeft VARCHAR(255) NOT NULL, TotalSoftCal_ArrowRight VARCHAR(255) NOT NULL, TotalSoftCal_ArrowCol VARCHAR(255) NOT NULL, TotalSoftCal_ArrowSize VARCHAR(255) NOT NULL, PRIMARY KEY (id))';
	$tsc_ids_table_create = 'CREATE TABLE IF NOT EXISTS ' .$tsc_ids_table . '( id INTEGER(10) UNSIGNED AUTO_INCREMENT, Cal_ID VARCHAR(255) NOT NULL, PRIMARY KEY (id))';
	$tsc_events_table_create = 'CREATE TABLE IF NOT EXISTS ' .$tsc_events_table . '( id INTEGER(10) UNSIGNED AUTO_INCREMENT, TotalSoftCal_EvName VARCHAR(255) NOT NULL, TotalSoftCal_EvCal VARCHAR(255) NOT NULL, TotalSoftCal_EvStartDate VARCHAR(255) NOT NULL, TotalSoftCal_EvEndDate VARCHAR(255) NOT NULL, TotalSoftCal_EvURL VARCHAR(255) NOT NULL, TotalSoftCal_EvURLNewTab VARCHAR(255) NOT NULL, TotalSoftCal_EvStartTime VARCHAR(255) NOT NULL, TotalSoftCal_EvEndTime VARCHAR(255) NOT NULL, TotalSoftCal_EvColor VARCHAR(255) NOT NULL, PRIMARY KEY (id))';
	$tsc_types_table_create = 'CREATE TABLE IF NOT EXISTS ' .$tsc_types_table . '( id INTEGER(10) UNSIGNED AUTO_INCREMENT, TotalSoftCal_Name VARCHAR(255) NOT NULL, TotalSoftCal_Type VARCHAR(255) NOT NULL, PRIMARY KEY (id))';
	$tsc_simple_calendar_table_create = 'CREATE TABLE IF NOT EXISTS ' .$tsc_simple_calendar_table . '( id INTEGER(10) UNSIGNED AUTO_INCREMENT, TotalSoftCal_ID VARCHAR(255) NOT NULL, TotalSoftCal_Name VARCHAR(255) NOT NULL, TotalSoftCal_Type VARCHAR(255) NOT NULL, TotalSoftCal2_WDStart VARCHAR(255) NOT NULL, TotalSoftCal2_BW VARCHAR(255) NOT NULL, TotalSoftCal2_BS VARCHAR(255) NOT NULL, TotalSoftCal2_BC VARCHAR(255) NOT NULL, TotalSoftCal2_W VARCHAR(255) NOT NULL, TotalSoftCal2_H VARCHAR(255) NOT NULL, TotalSoftCal2_BxShShow VARCHAR(255) NOT NULL, TotalSoftCal2_BxShType VARCHAR(255) NOT NULL, TotalSoftCal2_BxSh VARCHAR(255) NOT NULL, TotalSoftCal2_BxShC VARCHAR(255) NOT NULL, TotalSoftCal2_MBgC VARCHAR(255) NOT NULL, TotalSoftCal2_MC VARCHAR(255) NOT NULL, TotalSoftCal2_MFS VARCHAR(255) NOT NULL, TotalSoftCal2_MFF VARCHAR(255) NOT NULL, TotalSoftCal2_WBgC VARCHAR(255) NOT NULL, TotalSoftCal2_WC VARCHAR(255) NOT NULL, TotalSoftCal2_WFS VARCHAR(255) NOT NULL, TotalSoftCal2_WFF VARCHAR(255) NOT NULL, TotalSoftCal2_LAW_W VARCHAR(255) NOT NULL, TotalSoftCal2_LAW_S VARCHAR(255) NOT NULL, TotalSoftCal2_LAW_C VARCHAR(255) NOT NULL, TotalSoftCal2_DBgC VARCHAR(255) NOT NULL, TotalSoftCal2_DC VARCHAR(255) NOT NULL, TotalSoftCal2_DFS VARCHAR(255) NOT NULL, TotalSoftCal2_TdBgC VARCHAR(255) NOT NULL, TotalSoftCal2_TdC VARCHAR(255) NOT NULL, TotalSoftCal2_TdFS VARCHAR(255) NOT NULL, TotalSoftCal2_EdBgC VARCHAR(255) NOT NULL, TotalSoftCal2_EdC VARCHAR(255) NOT NULL, TotalSoftCal2_EdFS VARCHAR(255) NOT NULL, TotalSoftCal2_HBgC VARCHAR(255) NOT NULL, TotalSoftCal2_HC VARCHAR(255) NOT NULL, TotalSoftCal2_ArrType VARCHAR(255) NOT NULL, TotalSoftCal2_ArrFS VARCHAR(255) NOT NULL, TotalSoftCal2_ArrC VARCHAR(255) NOT NULL, TotalSoftCal2_OmBgC VARCHAR(255) NOT NULL, TotalSoftCal2_OmC VARCHAR(255) NOT NULL, TotalSoftCal2_OmFS VARCHAR(255) NOT NULL, TotalSoftCal2_Ev_HBgC VARCHAR(255) NOT NULL, TotalSoftCal2_Ev_HC VARCHAR(255) NOT NULL, TotalSoftCal2_Ev_HFS VARCHAR(255) NOT NULL, TotalSoftCal2_Ev_HFF VARCHAR(255) NOT NULL, TotalSoftCal2_Ev_HText VARCHAR(255) NOT NULL, TotalSoftCal2_Ev_BBgC VARCHAR(255) NOT NULL, TotalSoftCal2_Ev_TC VARCHAR(255) NOT NULL, TotalSoftCal2_Ev_TFF VARCHAR(255) NOT NULL, TotalSoftCal2_Ev_TFS VARCHAR(255) NOT NULL, PRIMARY KEY (id))';
	$tsc_event_settings_table_create = 'CREATE TABLE IF NOT EXISTS ' .$tsc_event_settings_table . '( id INTEGER(10) UNSIGNED AUTO_INCREMENT, TotalSoftCal_EvDesc LONGTEXT NOT NULL, TotalSoftCal_EvImg VARCHAR(255) NOT NULL, TotalSoftCal_EvVid_Src VARCHAR(255) NOT NULL, TotalSoftCal_EvVid_Iframe VARCHAR(255) NOT NULL, TotalSoftCal_EvCal VARCHAR(255) NOT NULL, PRIMARY KEY (id))';
	$tsc_flexible_calendar_table_create = 'CREATE TABLE IF NOT EXISTS ' .$tsc_flexible_calendar_table . '( id INTEGER(10) UNSIGNED AUTO_INCREMENT, TotalSoftCal_ID VARCHAR(255) NOT NULL, TotalSoftCal_Name VARCHAR(255) NOT NULL, TotalSoftCal_Type VARCHAR(255) NOT NULL, TotalSoftCal3_MW VARCHAR(255) NOT NULL, TotalSoftCal3_WDStart VARCHAR(255) NOT NULL, TotalSoftCal3_BgC VARCHAR(255) NOT NULL, TotalSoftCal3_GrC VARCHAR(255) NOT NULL, TotalSoftCal3_BBC VARCHAR(255) NOT NULL, TotalSoftCal3_BoxShShow VARCHAR(255) NOT NULL, TotalSoftCal3_BoxShType VARCHAR(255) NOT NULL, TotalSoftCal3_BoxSh VARCHAR(255) NOT NULL, TotalSoftCal3_BoxShC VARCHAR(255) NOT NULL, TotalSoftCal3_H_BgC VARCHAR(255) NOT NULL, TotalSoftCal3_H_BTW VARCHAR(255) NOT NULL, TotalSoftCal3_H_BTC VARCHAR(255) NOT NULL, TotalSoftCal3_H_FF VARCHAR(255) NOT NULL, TotalSoftCal3_H_MFS VARCHAR(255) NOT NULL, TotalSoftCal3_H_MC VARCHAR(255) NOT NULL, TotalSoftCal3_H_YFS VARCHAR(255) NOT NULL, TotalSoftCal3_H_YC VARCHAR(255) NOT NULL, TotalSoftCal3_H_Format VARCHAR(255) NOT NULL, TotalSoftCal3_Arr_Type VARCHAR(255) NOT NULL, TotalSoftCal3_Arr_C VARCHAR(255) NOT NULL, TotalSoftCal3_Arr_S VARCHAR(255) NOT NULL, TotalSoftCal3_Arr_HC VARCHAR(255) NOT NULL, TotalSoftCal3_LAH_W VARCHAR(255) NOT NULL, TotalSoftCal3_LAH_C VARCHAR(255) NOT NULL, TotalSoftCal3_WD_BgC VARCHAR(255) NOT NULL, TotalSoftCal3_WD_C VARCHAR(255) NOT NULL, TotalSoftCal3_WD_FS VARCHAR(255) NOT NULL, TotalSoftCal3_WD_FF VARCHAR(255) NOT NULL, TotalSoftCal3_D_BgC VARCHAR(255) NOT NULL, TotalSoftCal3_D_C VARCHAR(255) NOT NULL, TotalSoftCal3_TD_BgC VARCHAR(255) NOT NULL, TotalSoftCal3_TD_C VARCHAR(255) NOT NULL, TotalSoftCal3_HD_BgC VARCHAR(255) NOT NULL, TotalSoftCal3_HD_C VARCHAR(255) NOT NULL, TotalSoftCal3_ED_C VARCHAR(255) NOT NULL, TotalSoftCal3_ED_HC VARCHAR(255) NOT NULL, TotalSoftCal3_Ev_Format VARCHAR(255) NOT NULL, TotalSoftCal3_Ev_BTW VARCHAR(255) NOT NULL, TotalSoftCal3_Ev_BTC VARCHAR(255) NOT NULL, TotalSoftCal3_Ev_BgC VARCHAR(255) NOT NULL, TotalSoftCal3_Ev_C VARCHAR(255) NOT NULL, TotalSoftCal3_Ev_FS VARCHAR(255) NOT NULL, TotalSoftCal3_Ev_FF VARCHAR(255) NOT NULL, PRIMARY KEY (id))';
	$tsc_settings_table_create = 'CREATE TABLE IF NOT EXISTS ' .$tsc_settings_table . '( id INTEGER(10) UNSIGNED AUTO_INCREMENT, TotalSoftCal_ID VARCHAR(255) NOT NULL, TotalSoftCal_Name VARCHAR(255) NOT NULL, TotalSoftCal_Type VARCHAR(255) NOT NULL, TotalSoftCal_01 VARCHAR(255) NOT NULL, TotalSoftCal_02 VARCHAR(255) NOT NULL, TotalSoftCal_03 VARCHAR(255) NOT NULL, TotalSoftCal_04 VARCHAR(255) NOT NULL, TotalSoftCal_05 VARCHAR(255) NOT NULL, TotalSoftCal_06 VARCHAR(255) NOT NULL, TotalSoftCal_07 VARCHAR(255) NOT NULL, TotalSoftCal_08 VARCHAR(255) NOT NULL, TotalSoftCal_09 VARCHAR(255) NOT NULL, TotalSoftCal_10 VARCHAR(255) NOT NULL, TotalSoftCal_11 VARCHAR(255) NOT NULL, TotalSoftCal_12 VARCHAR(255) NOT NULL, TotalSoftCal_13 VARCHAR(255) NOT NULL, TotalSoftCal_14 VARCHAR(255) NOT NULL, TotalSoftCal_15 VARCHAR(255) NOT NULL, TotalSoftCal_16 VARCHAR(255) NOT NULL, TotalSoftCal_17 VARCHAR(255) NOT NULL, TotalSoftCal_18 VARCHAR(255) NOT NULL, TotalSoftCal_19 VARCHAR(255) NOT NULL, TotalSoftCal_20 VARCHAR(255) NOT NULL, TotalSoftCal_21 VARCHAR(255) NOT NULL, TotalSoftCal_22 VARCHAR(255) NOT NULL, TotalSoftCal_23 VARCHAR(255) NOT NULL, TotalSoftCal_24 VARCHAR(255) NOT NULL, TotalSoftCal_25 VARCHAR(255) NOT NULL, TotalSoftCal_26 VARCHAR(255) NOT NULL, TotalSoftCal_27 VARCHAR(255) NOT NULL, TotalSoftCal_28 VARCHAR(255) NOT NULL, TotalSoftCal_29 VARCHAR(255) NOT NULL, TotalSoftCal_30 VARCHAR(255) NOT NULL, PRIMARY KEY (id))';
	$tsc_timeline_calendar_table_create = 'CREATE TABLE IF NOT EXISTS ' .$tsc_timeline_calendar_table . '( id INTEGER(10) UNSIGNED AUTO_INCREMENT, TotalSoftCal_ID VARCHAR(255) NOT NULL, TotalSoftCal_Name VARCHAR(255) NOT NULL, TotalSoftCal_Type VARCHAR(255) NOT NULL, TotalSoftCal4_01 VARCHAR(255) NOT NULL, TotalSoftCal4_02 VARCHAR(255) NOT NULL, TotalSoftCal4_03 VARCHAR(255) NOT NULL, TotalSoftCal4_04 VARCHAR(255) NOT NULL, TotalSoftCal4_05 VARCHAR(255) NOT NULL, TotalSoftCal4_06 VARCHAR(255) NOT NULL, TotalSoftCal4_07 VARCHAR(255) NOT NULL, TotalSoftCal4_08 VARCHAR(255) NOT NULL, TotalSoftCal4_09 VARCHAR(255) NOT NULL, TotalSoftCal4_10 VARCHAR(255) NOT NULL, TotalSoftCal4_11 VARCHAR(255) NOT NULL, TotalSoftCal4_12 VARCHAR(255) NOT NULL, TotalSoftCal4_13 VARCHAR(255) NOT NULL, TotalSoftCal4_14 VARCHAR(255) NOT NULL, TotalSoftCal4_15 VARCHAR(255) NOT NULL, TotalSoftCal4_16 VARCHAR(255) NOT NULL, TotalSoftCal4_17 VARCHAR(255) NOT NULL, TotalSoftCal4_18 VARCHAR(255) NOT NULL, TotalSoftCal4_19 VARCHAR(255) NOT NULL, TotalSoftCal4_20 VARCHAR(255) NOT NULL, TotalSoftCal4_21 VARCHAR(255) NOT NULL, TotalSoftCal4_22 VARCHAR(255) NOT NULL, TotalSoftCal4_23 VARCHAR(255) NOT NULL, TotalSoftCal4_24 VARCHAR(255) NOT NULL, TotalSoftCal4_25 VARCHAR(255) NOT NULL, TotalSoftCal4_26 VARCHAR(255) NOT NULL, TotalSoftCal4_27 VARCHAR(255) NOT NULL, TotalSoftCal4_28 VARCHAR(255) NOT NULL, TotalSoftCal4_29 VARCHAR(255) NOT NULL, TotalSoftCal4_30 VARCHAR(255) NOT NULL, TotalSoftCal4_31 VARCHAR(255) NOT NULL, TotalSoftCal4_32 VARCHAR(255) NOT NULL, TotalSoftCal4_33 VARCHAR(255) NOT NULL, TotalSoftCal4_34 VARCHAR(255) NOT NULL, TotalSoftCal4_35 VARCHAR(255) NOT NULL, TotalSoftCal4_36 VARCHAR(255) NOT NULL, TotalSoftCal4_37 VARCHAR(255) NOT NULL, TotalSoftCal4_38 VARCHAR(255) NOT NULL, TotalSoftCal4_39 VARCHAR(255) NOT NULL, PRIMARY KEY (id))';
	$tsc_event_rec_table_create = 'CREATE TABLE IF NOT EXISTS ' .$tsc_event_rec_table . '( id INTEGER(10) UNSIGNED AUTO_INCREMENT, TotalSoftCal_EvCal VARCHAR(255) NOT NULL, TotalSoftCal_EvRec VARCHAR(255) NOT NULL, TotalSoftCal_Ev_01 VARCHAR(255) NOT NULL, TotalSoftCal_Ev_02 VARCHAR(255) NOT NULL, TotalSoftCal_Ev_03 VARCHAR(255) NOT NULL, TotalSoftCal_Ev_04 VARCHAR(255) NOT NULL, TotalSoftCal_Ev_05 VARCHAR(255) NOT NULL, TotalSoftCal_Ev_06 VARCHAR(255) NOT NULL, TotalSoftCal_Ev_07 VARCHAR(255) NOT NULL, TotalSoftCal_Ev_08 VARCHAR(255) NOT NULL, TotalSoftCal_Ev_09 VARCHAR(255) NOT NULL, TotalSoftCal_Ev_10 VARCHAR(255) NOT NULL, TotalSoftCal_Ev_11 VARCHAR(255) NOT NULL, TotalSoftCal_Ev_12 VARCHAR(255) NOT NULL, TotalSoftCal_Ev_13 VARCHAR(255) NOT NULL, TotalSoftCal_Ev_14 VARCHAR(255) NOT NULL, TotalSoftCal_Ev_15 VARCHAR(255) NOT NULL, TotalSoftCal_Ev_16 VARCHAR(255) NOT NULL, TotalSoftCal_Ev_17 VARCHAR(255) NOT NULL, TotalSoftCal_Ev_18 VARCHAR(255) NOT NULL, TotalSoftCal_Ev_19 VARCHAR(255) NOT NULL, TotalSoftCal_Ev_20 VARCHAR(255) NOT NULL, PRIMARY KEY (id))';
	dbDelta($tsc_event_calendar_table_create);
	dbDelta($tsc_ids_table_create);
	dbDelta($tsc_events_table_create);
	dbDelta($tsc_types_table_create);
	dbDelta($tsc_simple_calendar_table_create);
	dbDelta($tsc_event_settings_table_create);
	dbDelta($tsc_flexible_calendar_table_create);
	dbDelta($tsc_settings_table_create);
	dbDelta($tsc_timeline_calendar_table_create);
	dbDelta($tsc_event_rec_table_create);
	$tsc_event_calendar_table_convert = 'ALTER TABLE ' . $tsc_event_calendar_table . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci';
	$tsc_ids_table_convert = 'ALTER TABLE ' . $tsc_ids_table . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci';
	$tsc_events_table_convert = 'ALTER TABLE ' . $tsc_events_table . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci';
	$tsc_types_table_convert = 'ALTER TABLE ' . $tsc_types_table . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci';
	$tsc_simple_calendar_table_convert = 'ALTER TABLE ' . $tsc_simple_calendar_table . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci';
	$tsc_event_settings_table_convert = 'ALTER TABLE ' . $tsc_event_settings_table . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci';
	$tsc_flexible_calendar_table_convert = 'ALTER TABLE ' . $tsc_flexible_calendar_table . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci';
	$tsc_settings_table_convert = 'ALTER TABLE ' . $tsc_settings_table . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci';
	$tsc_timeline_calendar_table_convert = 'ALTER TABLE ' . $tsc_timeline_calendar_table . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci';
	$tsc_event_rec_table_convert = 'ALTER TABLE ' . $tsc_event_rec_table . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci';
	$wpdb->query($tsc_event_calendar_table_convert);
	$wpdb->query($tsc_ids_table_convert);
	$wpdb->query($tsc_events_table_convert);
	$wpdb->query($tsc_types_table_convert);
	$wpdb->query($tsc_simple_calendar_table_convert);
	$wpdb->query($tsc_event_settings_table_convert);
	$wpdb->query($tsc_flexible_calendar_table_convert);
	$wpdb->query($tsc_settings_table_convert);
	$wpdb->query($tsc_timeline_calendar_table_convert);
	$wpdb->query($tsc_event_rec_table_convert);
	$tsc_event_calendar_records=$wpdb->get_results($wpdb->prepare("SELECT * FROM $tsc_event_calendar_table WHERE id>%d",0));
	$tsc_check_column_count = $wpdb->get_results("SHOW COLUMNS FROM $tsc_event_calendar_table");
	if (count($tsc_check_column_count) < 42) {
		$wpdb->query('ALTER TABLE ' . $tsc_event_calendar_table .' ADD TotalSoftCal_BackIconType VARCHAR(255) NOT NULL');
		$wpdb->query($wpdb->prepare("UPDATE $tsc_event_calendar_table set TotalSoftCal_BackIconType = %s WHERE TotalSoftCal_Name = %s",'7', 'Total Soft Calendar'));
		$wpdb->query($wpdb->prepare("UPDATE $tsc_event_calendar_table set TotalSoftCal_BackIconType = %s WHERE TotalSoftCal_Name = %s",'7', 'Total Soft Calendar 1'));
		$wpdb->query($wpdb->prepare("UPDATE $tsc_event_calendar_table set TotalSoftCal_BackIconType = %s WHERE TotalSoftCal_Name = %s",'7', 'Total Soft Calendar 2'));
		$wpdb->query($wpdb->prepare("UPDATE $tsc_event_calendar_table set TotalSoftCal_BackIconType = %s WHERE TotalSoftCal_Name = %s",'7', 'Total Soft Calendar 3'));
	}
	$tsc_check_column_count=$wpdb->get_results("SHOW COLUMNS FROM $tsc_event_calendar_table");
	if (count($tsc_check_column_count) < 43) {
		$wpdb->query('ALTER TABLE ' . $tsc_event_calendar_table .' ADD TotalSoftCal_DFF VARCHAR(255) NOT NULL');
		$wpdb->query($wpdb->prepare("UPDATE $tsc_event_calendar_table set TotalSoftCal_DFF = %s WHERE TotalSoftCal_Name = %s",'Arial', 'Total Soft Calendar'));
		$wpdb->query($wpdb->prepare("UPDATE $tsc_event_calendar_table set TotalSoftCal_DFF = %s WHERE TotalSoftCal_Name = %s",'Arial', 'Total Soft Calendar 1'));
		$wpdb->query($wpdb->prepare("UPDATE $tsc_event_calendar_table set TotalSoftCal_DFF = %s WHERE TotalSoftCal_Name = %s",'Arial', 'Total Soft Calendar 2'));
		$wpdb->query($wpdb->prepare("UPDATE $tsc_event_calendar_table set TotalSoftCal_DFF = %s WHERE TotalSoftCal_Name = %s",'Arial', 'Total Soft Calendar 3'));
	}
	if(count($tsc_event_calendar_records) == 0) {
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_types_table (id, TotalSoftCal_Name, TotalSoftCal_Type) VALUES (%d, %s, %s)", '', 'Total Soft Calendar', 'Event Calendar'));
		$tsc_insert_id = $wpdb->insert_id;
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_ids_table (id, Cal_ID) VALUES (%d, %s)", '', $tsc_insert_id));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_event_calendar_table (id, TotalSoftCal_ID, TotalSoftCal_Name, TotalSoftCal_Type, TotalSoftCal_BgCol, TotalSoftCal_GrCol, TotalSoftCal_GW, TotalSoftCal_BW, TotalSoftCal_BStyle, TotalSoftCal_BCol, TotalSoftCal_BSCol, TotalSoftCal_MW, TotalSoftCal_HBgCol, TotalSoftCal_HCol, TotalSoftCal_HFS, TotalSoftCal_HFF, TotalSoftCal_WBgCol, TotalSoftCal_WCol, TotalSoftCal_WFS, TotalSoftCal_WFF, TotalSoftCal_LAW, TotalSoftCal_LAWS, TotalSoftCal_LAWC, TotalSoftCal_DBgCol, TotalSoftCal_DCol, TotalSoftCal_DFS, TotalSoftCal_TBgCol, TotalSoftCal_TCol, TotalSoftCal_TFS, TotalSoftCal_TNBgCol, TotalSoftCal_HovBgCol, TotalSoftCal_HovCol, TotalSoftCal_NumPos, TotalSoftCal_WDStart, TotalSoftCal_RefIcCol, TotalSoftCal_RefIcSize, TotalSoftCal_ArrowType, TotalSoftCal_ArrowLeft, TotalSoftCal_ArrowRight, TotalSoftCal_ArrowCol, TotalSoftCal_ArrowSize, TotalSoftCal_BackIconType, TotalSoftCal_DFF) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", '', $tsc_insert_id, 'Total Soft Calendar', 'Event Calendar', '#efefef', '#009491', '1', '2', 'solid', '#009491', '#009491', '700', '#ffffff', '#009491', '15', 'Arial', '#009491', '#ffffff', '11', 'Arial', '0', 'none', '#ffffff', '#ffffff', '#009491', '15', '#009491', '#009491', '15', '#ffffff', '#009491', '#ffffff', 'left', 'Mon', '#009491', '20', '7' , 'totalsoft totalsoft-caret-square-o-left', 'totalsoft totalsoft-caret-square-o-right', '#009491', '17', '2', 'Arial'));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_settings_table (id, TotalSoftCal_ID, TotalSoftCal_Name, TotalSoftCal_Type, TotalSoftCal_01, TotalSoftCal_02, TotalSoftCal_03, TotalSoftCal_04, TotalSoftCal_05, TotalSoftCal_06, TotalSoftCal_07, TotalSoftCal_08, TotalSoftCal_09, TotalSoftCal_10, TotalSoftCal_11, TotalSoftCal_12, TotalSoftCal_13, TotalSoftCal_14, TotalSoftCal_15, TotalSoftCal_16, TotalSoftCal_17, TotalSoftCal_18, TotalSoftCal_19, TotalSoftCal_20, TotalSoftCal_21, TotalSoftCal_22, TotalSoftCal_23, TotalSoftCal_24, TotalSoftCal_25, TotalSoftCal_26, TotalSoftCal_27, TotalSoftCal_28, TotalSoftCal_29, TotalSoftCal_30) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", '', $tsc_insert_id, 'Total Soft Calendar', 'Event Calendar', '14', 'Arial', '#ffffff', 'left', '24', '', '', '', '70', 'after', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_types_table (id, TotalSoftCal_Name, TotalSoftCal_Type) VALUES (%d, %s, %s)", '', 'Total Soft Calendar 1', 'Event Calendar'));
		$tsc_insert_id = $wpdb->insert_id;
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_ids_table (id, Cal_ID) VALUES (%d, %s)", '', $tsc_insert_id));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_event_calendar_table (id, TotalSoftCal_ID, TotalSoftCal_Name, TotalSoftCal_Type, TotalSoftCal_BgCol, TotalSoftCal_GrCol, TotalSoftCal_GW, TotalSoftCal_BW, TotalSoftCal_BStyle, TotalSoftCal_BCol, TotalSoftCal_BSCol, TotalSoftCal_MW, TotalSoftCal_HBgCol, TotalSoftCal_HCol, TotalSoftCal_HFS, TotalSoftCal_HFF, TotalSoftCal_WBgCol, TotalSoftCal_WCol, TotalSoftCal_WFS, TotalSoftCal_WFF, TotalSoftCal_LAW, TotalSoftCal_LAWS, TotalSoftCal_LAWC, TotalSoftCal_DBgCol, TotalSoftCal_DCol, TotalSoftCal_DFS, TotalSoftCal_TBgCol, TotalSoftCal_TCol, TotalSoftCal_TFS, TotalSoftCal_TNBgCol, TotalSoftCal_HovBgCol, TotalSoftCal_HovCol, TotalSoftCal_NumPos, TotalSoftCal_WDStart, TotalSoftCal_RefIcCol, TotalSoftCal_RefIcSize, TotalSoftCal_ArrowType, TotalSoftCal_ArrowLeft, TotalSoftCal_ArrowRight, TotalSoftCal_ArrowCol, TotalSoftCal_ArrowSize, TotalSoftCal_BackIconType, TotalSoftCal_DFF) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", '', $tsc_insert_id, 'Total Soft Calendar 1', 'Event Calendar', '#efefef', '#ffffff', '1', '2', 'solid', '#ffffff', '#ffffff', '700', '#009491', '#ffffff', '14', 'Arial', '#ffffff', '#009491', '10', 'Arial', '0', 'none', '#009491', '#009491', '#ffffff', '14', '#ffffff', '#ffffff', '15', '#009491', '#ffffff', '#009491', 'left', 'Mon', '#ffffff', '20', '7' , 'totalsoft totalsoft-caret-square-o-left', 'totalsoft totalsoft-caret-square-o-right', '#ffffff', '17', '2', 'Arial'));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_settings_table (id, TotalSoftCal_ID, TotalSoftCal_Name, TotalSoftCal_Type, TotalSoftCal_01, TotalSoftCal_02, TotalSoftCal_03, TotalSoftCal_04, TotalSoftCal_05, TotalSoftCal_06, TotalSoftCal_07, TotalSoftCal_08, TotalSoftCal_09, TotalSoftCal_10, TotalSoftCal_11, TotalSoftCal_12, TotalSoftCal_13, TotalSoftCal_14, TotalSoftCal_15, TotalSoftCal_16, TotalSoftCal_17, TotalSoftCal_18, TotalSoftCal_19, TotalSoftCal_20, TotalSoftCal_21, TotalSoftCal_22, TotalSoftCal_23, TotalSoftCal_24, TotalSoftCal_25, TotalSoftCal_26, TotalSoftCal_27, TotalSoftCal_28, TotalSoftCal_29, TotalSoftCal_30) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", '', $tsc_insert_id, 'Total Soft Calendar 1', 'Event Calendar', '14', 'Arial', '#ffffff', 'left', '24', '', '', '', '70', 'after', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_types_table (id, TotalSoftCal_Name, TotalSoftCal_Type) VALUES (%d, %s, %s)", '', 'Total Soft Calendar 2', 'Event Calendar'));
		$tsc_insert_id = $wpdb->insert_id;
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_ids_table (id, Cal_ID) VALUES (%d, %s)", '', $tsc_insert_id));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_event_calendar_table (id, TotalSoftCal_ID, TotalSoftCal_Name, TotalSoftCal_Type, TotalSoftCal_BgCol, TotalSoftCal_GrCol, TotalSoftCal_GW, TotalSoftCal_BW, TotalSoftCal_BStyle, TotalSoftCal_BCol, TotalSoftCal_BSCol, TotalSoftCal_MW, TotalSoftCal_HBgCol, TotalSoftCal_HCol, TotalSoftCal_HFS, TotalSoftCal_HFF, TotalSoftCal_WBgCol, TotalSoftCal_WCol, TotalSoftCal_WFS, TotalSoftCal_WFF, TotalSoftCal_LAW, TotalSoftCal_LAWS, TotalSoftCal_LAWC, TotalSoftCal_DBgCol, TotalSoftCal_DCol, TotalSoftCal_DFS, TotalSoftCal_TBgCol, TotalSoftCal_TCol, TotalSoftCal_TFS, TotalSoftCal_TNBgCol, TotalSoftCal_HovBgCol, TotalSoftCal_HovCol, TotalSoftCal_NumPos, TotalSoftCal_WDStart, TotalSoftCal_RefIcCol, TotalSoftCal_RefIcSize, TotalSoftCal_ArrowType, TotalSoftCal_ArrowLeft, TotalSoftCal_ArrowRight, TotalSoftCal_ArrowCol, TotalSoftCal_ArrowSize, TotalSoftCal_BackIconType, TotalSoftCal_DFF) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", '', $tsc_insert_id, 'Total Soft Calendar 2', 'Event Calendar', '#efefef', '#ffffff', '1', '2', 'solid', '#ffffff', '#ffffff', '700', '#00c603', '#ffffff', '14', 'Arial', '#ffffff', '#00c603', '10', 'Arial', '0', 'none', '#00c603', '#00c603', '#ffffff', '14', '#ffffff', '#ffffff', '15', '#00c603', '#ffffff', '#00c603', 'left', 'Mon', '#ffffff', '20', '7' , 'totalsoft totalsoft-caret-square-o-left', 'totalsoft totalsoft-caret-square-o-right', '#ffffff', '17', '2', 'Arial'));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_settings_table (id, TotalSoftCal_ID, TotalSoftCal_Name, TotalSoftCal_Type, TotalSoftCal_01, TotalSoftCal_02, TotalSoftCal_03, TotalSoftCal_04, TotalSoftCal_05, TotalSoftCal_06, TotalSoftCal_07, TotalSoftCal_08, TotalSoftCal_09, TotalSoftCal_10, TotalSoftCal_11, TotalSoftCal_12, TotalSoftCal_13, TotalSoftCal_14, TotalSoftCal_15, TotalSoftCal_16, TotalSoftCal_17, TotalSoftCal_18, TotalSoftCal_19, TotalSoftCal_20, TotalSoftCal_21, TotalSoftCal_22, TotalSoftCal_23, TotalSoftCal_24, TotalSoftCal_25, TotalSoftCal_26, TotalSoftCal_27, TotalSoftCal_28, TotalSoftCal_29, TotalSoftCal_30) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", '', $tsc_insert_id, 'Total Soft Calendar 2', 'Event Calendar', '14', 'Arial', '#ffffff', 'left', '24', '', '', '', '70', 'after', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_types_table (id, TotalSoftCal_Name, TotalSoftCal_Type) VALUES (%d, %s, %s)", '', 'Total Soft Calendar 3', 'Event Calendar'));
		$tsc_insert_id = $wpdb->insert_id;
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_ids_table (id, Cal_ID) VALUES (%d, %s)", '', $tsc_insert_id));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_event_calendar_table (id, TotalSoftCal_ID, TotalSoftCal_Name, TotalSoftCal_Type, TotalSoftCal_BgCol, TotalSoftCal_GrCol, TotalSoftCal_GW, TotalSoftCal_BW, TotalSoftCal_BStyle, TotalSoftCal_BCol, TotalSoftCal_BSCol, TotalSoftCal_MW, TotalSoftCal_HBgCol, TotalSoftCal_HCol, TotalSoftCal_HFS, TotalSoftCal_HFF, TotalSoftCal_WBgCol, TotalSoftCal_WCol, TotalSoftCal_WFS, TotalSoftCal_WFF, TotalSoftCal_LAW, TotalSoftCal_LAWS, TotalSoftCal_LAWC, TotalSoftCal_DBgCol, TotalSoftCal_DCol, TotalSoftCal_DFS, TotalSoftCal_TBgCol, TotalSoftCal_TCol, TotalSoftCal_TFS, TotalSoftCal_TNBgCol, TotalSoftCal_HovBgCol, TotalSoftCal_HovCol, TotalSoftCal_NumPos, TotalSoftCal_WDStart, TotalSoftCal_RefIcCol, TotalSoftCal_RefIcSize, TotalSoftCal_ArrowType, TotalSoftCal_ArrowLeft, TotalSoftCal_ArrowRight, TotalSoftCal_ArrowCol, TotalSoftCal_ArrowSize, TotalSoftCal_BackIconType, TotalSoftCal_DFF) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", '', $tsc_insert_id, 'Total Soft Calendar 3', 'Event Calendar', '#efefef', '#00c603', '1', '2', 'solid', '#00c603', '#00c603', '700', '#ffffff', '#00c603', '14', 'Arial', '#00c603', '#ffffff', '10', 'Arial', '0', 'none', '#ffffff', '#ffffff', '#00c603', '14', '#00c603', '#00c603', '15', '#ffffff', '#00c603', '#ffffff', 'left', 'Mon', '#00c603', '20', '7' , 'totalsoft totalsoft-caret-square-o-left', 'totalsoft totalsoft-caret-square-o-right', '#00c603', '17', '2', 'Arial'));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_settings_table (id, TotalSoftCal_ID, TotalSoftCal_Name, TotalSoftCal_Type, TotalSoftCal_01, TotalSoftCal_02, TotalSoftCal_03, TotalSoftCal_04, TotalSoftCal_05, TotalSoftCal_06, TotalSoftCal_07, TotalSoftCal_08, TotalSoftCal_09, TotalSoftCal_10, TotalSoftCal_11, TotalSoftCal_12, TotalSoftCal_13, TotalSoftCal_14, TotalSoftCal_15, TotalSoftCal_16, TotalSoftCal_17, TotalSoftCal_18, TotalSoftCal_19, TotalSoftCal_20, TotalSoftCal_21, TotalSoftCal_22, TotalSoftCal_23, TotalSoftCal_24, TotalSoftCal_25, TotalSoftCal_26, TotalSoftCal_27, TotalSoftCal_28, TotalSoftCal_29, TotalSoftCal_30) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", '', $tsc_insert_id, 'Total Soft Calendar 3', 'Event Calendar', '14', 'Arial', '#ffffff', 'left', '24', '', '', '', '70', 'after', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''));
	}
	$tsc_simple_calendar_records = $wpdb->get_results($wpdb->prepare("SELECT * FROM $tsc_simple_calendar_table WHERE id>%d",0));
	if(count($tsc_simple_calendar_records)==0) {
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_types_table (id, TotalSoftCal_Name, TotalSoftCal_Type) VALUES (%d, %s, %s)", '', 'Simple Calendar', 'Simple Calendar'));
		$tsc_insert_id = $wpdb->insert_id;
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_ids_table (id, Cal_ID) VALUES (%d, %s)", '', $tsc_insert_id));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_simple_calendar_table (id, TotalSoftCal_ID, TotalSoftCal_Name, TotalSoftCal_Type, TotalSoftCal2_WDStart, TotalSoftCal2_BW, TotalSoftCal2_BS, TotalSoftCal2_BC, TotalSoftCal2_W, TotalSoftCal2_H, TotalSoftCal2_BxShShow, TotalSoftCal2_BxShType, TotalSoftCal2_BxSh, TotalSoftCal2_BxShC, TotalSoftCal2_MBgC, TotalSoftCal2_MC, TotalSoftCal2_MFS, TotalSoftCal2_MFF, TotalSoftCal2_WBgC, TotalSoftCal2_WC, TotalSoftCal2_WFS, TotalSoftCal2_WFF, TotalSoftCal2_LAW_W, TotalSoftCal2_LAW_S, TotalSoftCal2_LAW_C, TotalSoftCal2_DBgC, TotalSoftCal2_DC, TotalSoftCal2_DFS, TotalSoftCal2_TdBgC, TotalSoftCal2_TdC, TotalSoftCal2_TdFS, TotalSoftCal2_EdBgC, TotalSoftCal2_EdC, TotalSoftCal2_EdFS, TotalSoftCal2_HBgC, TotalSoftCal2_HC, TotalSoftCal2_ArrType, TotalSoftCal2_ArrFS, TotalSoftCal2_ArrC, TotalSoftCal2_OmBgC, TotalSoftCal2_OmC, TotalSoftCal2_OmFS, TotalSoftCal2_Ev_HBgC, TotalSoftCal2_Ev_HC, TotalSoftCal2_Ev_HFS, TotalSoftCal2_Ev_HFF, TotalSoftCal2_Ev_HText, TotalSoftCal2_Ev_BBgC, TotalSoftCal2_Ev_TC, TotalSoftCal2_Ev_TFF, TotalSoftCal2_Ev_TFS) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", '', $tsc_insert_id, 'Simple Calendar', 'Simple Calendar', '0', '5', 'solid', '#ffffff', '600', '600', 'Yes', '2', '25', '#009491', '#009491', '#ffffff', '27', 'Gabriola', '#ffffff', '#009491', '19', 'Gabriola', '1', 'solid', '#009491', '#ffffff', '#009491', '17', '#009491', '#ffffff', '18', '#e2e2e2', '#ffffff', '18', '#ffffff', '#009491', 'angle', '21', '#ffffff', '#ffffff', '#a0a0a0', '10', '#009491', '#ffffff', '27', 'Gabriola', 'Events', '#ffffff', '#009491', 'Gabriola', '23'));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_settings_table (id, TotalSoftCal_ID, TotalSoftCal_Name, TotalSoftCal_Type, TotalSoftCal_01, TotalSoftCal_02, TotalSoftCal_03, TotalSoftCal_04, TotalSoftCal_05, TotalSoftCal_06, TotalSoftCal_07, TotalSoftCal_08, TotalSoftCal_09, TotalSoftCal_10, TotalSoftCal_11, TotalSoftCal_12, TotalSoftCal_13, TotalSoftCal_14, TotalSoftCal_15, TotalSoftCal_16, TotalSoftCal_17, TotalSoftCal_18, TotalSoftCal_19, TotalSoftCal_20, TotalSoftCal_21, TotalSoftCal_22, TotalSoftCal_23, TotalSoftCal_24, TotalSoftCal_25, TotalSoftCal_26, TotalSoftCal_27, TotalSoftCal_28, TotalSoftCal_29, TotalSoftCal_30) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", '', $tsc_insert_id, 'Simple Calendar', 'Simple Calendar', 'left', '70', 'after', '24', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_types_table (id, TotalSoftCal_Name, TotalSoftCal_Type) VALUES (%d, %s, %s)", '', 'Simple Calendar 2', 'Simple Calendar'));
		$tsc_insert_id = $wpdb->insert_id;
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_ids_table (id, Cal_ID) VALUES (%d, %s)", '', $tsc_insert_id));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_simple_calendar_table (id, TotalSoftCal_ID, TotalSoftCal_Name, TotalSoftCal_Type, TotalSoftCal2_WDStart, TotalSoftCal2_BW, TotalSoftCal2_BS, TotalSoftCal2_BC, TotalSoftCal2_W, TotalSoftCal2_H, TotalSoftCal2_BxShShow, TotalSoftCal2_BxShType, TotalSoftCal2_BxSh, TotalSoftCal2_BxShC, TotalSoftCal2_MBgC, TotalSoftCal2_MC, TotalSoftCal2_MFS, TotalSoftCal2_MFF, TotalSoftCal2_WBgC, TotalSoftCal2_WC, TotalSoftCal2_WFS, TotalSoftCal2_WFF, TotalSoftCal2_LAW_W, TotalSoftCal2_LAW_S, TotalSoftCal2_LAW_C, TotalSoftCal2_DBgC, TotalSoftCal2_DC, TotalSoftCal2_DFS, TotalSoftCal2_TdBgC, TotalSoftCal2_TdC, TotalSoftCal2_TdFS, TotalSoftCal2_EdBgC, TotalSoftCal2_EdC, TotalSoftCal2_EdFS, TotalSoftCal2_HBgC, TotalSoftCal2_HC, TotalSoftCal2_ArrType, TotalSoftCal2_ArrFS, TotalSoftCal2_ArrC, TotalSoftCal2_OmBgC, TotalSoftCal2_OmC, TotalSoftCal2_OmFS, TotalSoftCal2_Ev_HBgC, TotalSoftCal2_Ev_HC, TotalSoftCal2_Ev_HFS, TotalSoftCal2_Ev_HFF, TotalSoftCal2_Ev_HText, TotalSoftCal2_Ev_BBgC, TotalSoftCal2_Ev_TC, TotalSoftCal2_Ev_TFF, TotalSoftCal2_Ev_TFS) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", '', $tsc_insert_id, 'Simple Calendar 2', 'Simple Calendar', '0', '5', 'solid', '#ffffff', '600', '600', 'Yes', '1', '25', '#000000', '#ffffff', '#009491', '25', 'Gabriola', '#009491', '#ffffff', '21', 'Gabriola', '1', 'solid', '#009491', '#ffffff', '#009491', '17', '#009491', '#ffffff', '18', '#e2e2e2', '#ffffff', '18', '#ffffff', '#009491', 'angle', '21', '#009491', '#ffffff', '#a0a0a0', '14', '#ffffff', '#009491', '25', 'Gabriola', 'Events', '#009491', '#ffffff', 'Gabriola', '23'));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_settings_table (id, TotalSoftCal_ID, TotalSoftCal_Name, TotalSoftCal_Type, TotalSoftCal_01, TotalSoftCal_02, TotalSoftCal_03, TotalSoftCal_04, TotalSoftCal_05, TotalSoftCal_06, TotalSoftCal_07, TotalSoftCal_08, TotalSoftCal_09, TotalSoftCal_10, TotalSoftCal_11, TotalSoftCal_12, TotalSoftCal_13, TotalSoftCal_14, TotalSoftCal_15, TotalSoftCal_16, TotalSoftCal_17, TotalSoftCal_18, TotalSoftCal_19, TotalSoftCal_20, TotalSoftCal_21, TotalSoftCal_22, TotalSoftCal_23, TotalSoftCal_24, TotalSoftCal_25, TotalSoftCal_26, TotalSoftCal_27, TotalSoftCal_28, TotalSoftCal_29, TotalSoftCal_30) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", '', $tsc_insert_id, 'Simple Calendar 2', 'Simple Calendar', 'left', '70', 'after', '24', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''));
	}
	$tsc_flexible_calendar_records=$wpdb->get_results($wpdb->prepare("SELECT * FROM $tsc_flexible_calendar_table WHERE id>%d",0));
	if(count($tsc_flexible_calendar_records)==0)
	{
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_types_table (id, TotalSoftCal_Name, TotalSoftCal_Type) VALUES (%d, %s, %s)", '', 'Flexible Calendar', 'Flexible Calendar'));
		$tsc_insert_id = $wpdb->insert_id;
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_ids_table (id, Cal_ID) VALUES (%d, %s)", '', $tsc_insert_id));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_flexible_calendar_table (id, TotalSoftCal_ID, TotalSoftCal_Name, TotalSoftCal_Type, TotalSoftCal3_MW, TotalSoftCal3_WDStart, TotalSoftCal3_BgC, TotalSoftCal3_GrC, TotalSoftCal3_BBC, TotalSoftCal3_BoxShShow, TotalSoftCal3_BoxShType, TotalSoftCal3_BoxSh, TotalSoftCal3_BoxShC, TotalSoftCal3_H_BgC, TotalSoftCal3_H_BTW, TotalSoftCal3_H_BTC, TotalSoftCal3_H_FF, TotalSoftCal3_H_MFS, TotalSoftCal3_H_MC, TotalSoftCal3_H_YFS, TotalSoftCal3_H_YC, TotalSoftCal3_H_Format, TotalSoftCal3_Arr_Type, TotalSoftCal3_Arr_C, TotalSoftCal3_Arr_S, TotalSoftCal3_Arr_HC, TotalSoftCal3_LAH_W, TotalSoftCal3_LAH_C, TotalSoftCal3_WD_BgC, TotalSoftCal3_WD_C, TotalSoftCal3_WD_FS, TotalSoftCal3_WD_FF, TotalSoftCal3_D_BgC, TotalSoftCal3_D_C, TotalSoftCal3_TD_BgC, TotalSoftCal3_TD_C, TotalSoftCal3_HD_BgC, TotalSoftCal3_HD_C, TotalSoftCal3_ED_C, TotalSoftCal3_ED_HC, TotalSoftCal3_Ev_Format, TotalSoftCal3_Ev_BTW, TotalSoftCal3_Ev_BTC, TotalSoftCal3_Ev_BgC, TotalSoftCal3_Ev_C, TotalSoftCal3_Ev_FS, TotalSoftCal3_Ev_FF) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", '', $tsc_insert_id, 'Flexible Calendar', 'Flexible Calendar', '700', '1', '#ffffff', '#000000', '#000000', 'No', '1', '22', '#000000', '#ffffff', '3', '#dd3333', 'Gabriola', '22', '#000000', '24', '#dd3333', '1', 'caret', '#000000', '20', '#606060', '2', '#dd3333', '#000000', '#ffffff', '17', 'Gabriola', '#ffffff', '#dd3333', '#dd3333', '#ffffff', '#ffffff', '#000000', '#dd3333', '#000000', '3', '3', '#dd3333', '#dd3333', '#ffffff', '26', 'Gabriola'));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_settings_table (id, TotalSoftCal_ID, TotalSoftCal_Name, TotalSoftCal_Type, TotalSoftCal_01, TotalSoftCal_02, TotalSoftCal_03, TotalSoftCal_04, TotalSoftCal_05, TotalSoftCal_06, TotalSoftCal_07, TotalSoftCal_08, TotalSoftCal_09, TotalSoftCal_10, TotalSoftCal_11, TotalSoftCal_12, TotalSoftCal_13, TotalSoftCal_14, TotalSoftCal_15, TotalSoftCal_16, TotalSoftCal_17, TotalSoftCal_18, TotalSoftCal_19, TotalSoftCal_20, TotalSoftCal_21, TotalSoftCal_22, TotalSoftCal_23, TotalSoftCal_24, TotalSoftCal_25, TotalSoftCal_26, TotalSoftCal_27, TotalSoftCal_28, TotalSoftCal_29, TotalSoftCal_30) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", '', $tsc_insert_id, 'Flexible Calendar', 'Flexible Calendar', '24', 'times-circle', '#ffffff', '#d6d6d6', '21', '3', '#000000', '#ffffff', '#dd3333', '20', 'Gabriola', '#000000', '#ffffff', 'center', '48', '3', '#000000', '#4f4f4f', '4', 'View More', '2', '#000000', '17', 'Cairo', '1', '#000000', '25', '', '', ''));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_types_table (id, TotalSoftCal_Name, TotalSoftCal_Type) VALUES (%d, %s, %s)", '', 'Flexible Calendar 2', 'Flexible Calendar'));
		$tsc_insert_id = $wpdb->insert_id;
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_ids_table (id, Cal_ID) VALUES (%d, %s)", '', $tsc_insert_id));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_flexible_calendar_table (id, TotalSoftCal_ID, TotalSoftCal_Name, TotalSoftCal_Type, TotalSoftCal3_MW, TotalSoftCal3_WDStart, TotalSoftCal3_BgC, TotalSoftCal3_GrC, TotalSoftCal3_BBC, TotalSoftCal3_BoxShShow, TotalSoftCal3_BoxShType, TotalSoftCal3_BoxSh, TotalSoftCal3_BoxShC, TotalSoftCal3_H_BgC, TotalSoftCal3_H_BTW, TotalSoftCal3_H_BTC, TotalSoftCal3_H_FF, TotalSoftCal3_H_MFS, TotalSoftCal3_H_MC, TotalSoftCal3_H_YFS, TotalSoftCal3_H_YC, TotalSoftCal3_H_Format, TotalSoftCal3_Arr_Type, TotalSoftCal3_Arr_C, TotalSoftCal3_Arr_S, TotalSoftCal3_Arr_HC, TotalSoftCal3_LAH_W, TotalSoftCal3_LAH_C, TotalSoftCal3_WD_BgC, TotalSoftCal3_WD_C, TotalSoftCal3_WD_FS, TotalSoftCal3_WD_FF, TotalSoftCal3_D_BgC, TotalSoftCal3_D_C, TotalSoftCal3_TD_BgC, TotalSoftCal3_TD_C, TotalSoftCal3_HD_BgC, TotalSoftCal3_HD_C, TotalSoftCal3_ED_C, TotalSoftCal3_ED_HC, TotalSoftCal3_Ev_Format, TotalSoftCal3_Ev_BTW, TotalSoftCal3_Ev_BTC, TotalSoftCal3_Ev_BgC, TotalSoftCal3_Ev_C, TotalSoftCal3_Ev_FS, TotalSoftCal3_Ev_FF) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", '', $tsc_insert_id, 'Flexible Calendar 2', 'Flexible Calendar', '700', '1', '#ffffff', '#009491', '#009491', 'No', '1', '22', '#000000', '#009491', '3', '#ffffff', 'Gabriola', '22', '#d3d3d3', '24', '#ffffff', '2', 'caret', '#ffffff', '20', '#606060', '2', '#ffffff', '#009491', '#ffffff', '17', 'Gabriola', '#ffffff', '#000000', '#009491', '#ffffff', '#ffffff', '#000000', '#000000', '#aaaaaa', '3', '0', '#ffffff', '#009491', '#ffffff', '26', 'Gabriola'));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_settings_table (id, TotalSoftCal_ID, TotalSoftCal_Name, TotalSoftCal_Type, TotalSoftCal_01, TotalSoftCal_02, TotalSoftCal_03, TotalSoftCal_04, TotalSoftCal_05, TotalSoftCal_06, TotalSoftCal_07, TotalSoftCal_08, TotalSoftCal_09, TotalSoftCal_10, TotalSoftCal_11, TotalSoftCal_12, TotalSoftCal_13, TotalSoftCal_14, TotalSoftCal_15, TotalSoftCal_16, TotalSoftCal_17, TotalSoftCal_18, TotalSoftCal_19, TotalSoftCal_20, TotalSoftCal_21, TotalSoftCal_22, TotalSoftCal_23, TotalSoftCal_24, TotalSoftCal_25, TotalSoftCal_26, TotalSoftCal_27, TotalSoftCal_28, TotalSoftCal_29, TotalSoftCal_30) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", '', $tsc_insert_id, 'Flexible Calendar 2', 'Flexible Calendar', '24', 'times', '#ffffff', '#d6d6d6', '21', '3', '#000000', '#ffffff', '#009491', '20', 'Gabriola', '#009491', '#ffffff', 'center', '80', '3', '#919191', '#4f4f4f', '5', 'View More', '2', '#878787', '17', 'Cairo', '1', '#919191', '25', '', '', ''));
	}
	$tsc_timeline_calendar_records=$wpdb->get_results($wpdb->prepare("SELECT * FROM $tsc_timeline_calendar_table WHERE id>%d",0));
	if(count($tsc_timeline_calendar_records)==0)
	{
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_types_table (id, TotalSoftCal_Name, TotalSoftCal_Type) VALUES (%d, %s, %s)", '', 'TimeLine Calendar', 'TimeLine Calendar'));
		$tsc_insert_id = $wpdb->insert_id;
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_ids_table (id, Cal_ID) VALUES (%d, %s)", '', $tsc_insert_id));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_timeline_calendar_table (id, TotalSoftCal_ID, TotalSoftCal_Name, TotalSoftCal_Type, TotalSoftCal4_01, TotalSoftCal4_02, TotalSoftCal4_03, TotalSoftCal4_04, TotalSoftCal4_05, TotalSoftCal4_06, TotalSoftCal4_07, TotalSoftCal4_08, TotalSoftCal4_09, TotalSoftCal4_10, TotalSoftCal4_11, TotalSoftCal4_12, TotalSoftCal4_13, TotalSoftCal4_14, TotalSoftCal4_15, TotalSoftCal4_16, TotalSoftCal4_17, TotalSoftCal4_18, TotalSoftCal4_19, TotalSoftCal4_20, TotalSoftCal4_21, TotalSoftCal4_22, TotalSoftCal4_23, TotalSoftCal4_24, TotalSoftCal4_25, TotalSoftCal4_26, TotalSoftCal4_27, TotalSoftCal4_28, TotalSoftCal4_29, TotalSoftCal4_30, TotalSoftCal4_31, TotalSoftCal4_32, TotalSoftCal4_33, TotalSoftCal4_34, TotalSoftCal4_35, TotalSoftCal4_36, TotalSoftCal4_37, TotalSoftCal4_38, TotalSoftCal4_39) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", '', $tsc_insert_id, 'TimeLine Calendar', 'TimeLine Calendar', '800', 'type8', '#000000', 'none', '0', '#dd3333', 'color', '#dd0000', '#ffffff', '18', 'Cairo', 'format1', '#ffffff', 'long-arrow', '23', '#ffffff', '#e5e5e5', '#ffffff', '#ffffff', '75', '0', 'color', '#ffffff', '#dd0000', '#c9c9c9', '21', '#000000', '14', '#dd0000', '#000000', '#000000', 'caret', '20', '#5e5e5e', '#000000', '#c9c9c9', '100', '1', 'color'));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_settings_table (id, TotalSoftCal_ID, TotalSoftCal_Name, TotalSoftCal_Type, TotalSoftCal_01, TotalSoftCal_02, TotalSoftCal_03, TotalSoftCal_04, TotalSoftCal_05, TotalSoftCal_06, TotalSoftCal_07, TotalSoftCal_08, TotalSoftCal_09, TotalSoftCal_10, TotalSoftCal_11, TotalSoftCal_12, TotalSoftCal_13, TotalSoftCal_14, TotalSoftCal_15, TotalSoftCal_16, TotalSoftCal_17, TotalSoftCal_18, TotalSoftCal_19, TotalSoftCal_20, TotalSoftCal_21, TotalSoftCal_22, TotalSoftCal_23, TotalSoftCal_24, TotalSoftCal_25, TotalSoftCal_26, TotalSoftCal_27, TotalSoftCal_28, TotalSoftCal_29, TotalSoftCal_30) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", '', $tsc_insert_id, 'TimeLine Calendar', 'TimeLine Calendar', '#ffffff', '#000000', 'yy-mm-dd', '12', '19', 'Cairo', '#dd3333', '#ffffff', 'center', '80', '1', '#dd0000', '#dd0000', '4', 'View More', '14', 'Cairo', '#dd0000', '1', '1', '#c1c1c1', '75', '1', '#ffffff', '16', 'Cairo', 'calendar', '22', '#ffffff', ''));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_types_table (id, TotalSoftCal_Name, TotalSoftCal_Type) VALUES (%d, %s, %s)", '', 'TimeLine Calendar 2', 'TimeLine Calendar'));
		$tsc_insert_id = $wpdb->insert_id;
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_ids_table (id, Cal_ID) VALUES (%d, %s)", '', $tsc_insert_id));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_timeline_calendar_table (id, TotalSoftCal_ID, TotalSoftCal_Name, TotalSoftCal_Type, TotalSoftCal4_01, TotalSoftCal4_02, TotalSoftCal4_03, TotalSoftCal4_04, TotalSoftCal4_05, TotalSoftCal4_06, TotalSoftCal4_07, TotalSoftCal4_08, TotalSoftCal4_09, TotalSoftCal4_10, TotalSoftCal4_11, TotalSoftCal4_12, TotalSoftCal4_13, TotalSoftCal4_14, TotalSoftCal4_15, TotalSoftCal4_16, TotalSoftCal4_17, TotalSoftCal4_18, TotalSoftCal4_19, TotalSoftCal4_20, TotalSoftCal4_21, TotalSoftCal4_22, TotalSoftCal4_23, TotalSoftCal4_24, TotalSoftCal4_25, TotalSoftCal4_26, TotalSoftCal4_27, TotalSoftCal4_28, TotalSoftCal4_29, TotalSoftCal4_30, TotalSoftCal4_31, TotalSoftCal4_32, TotalSoftCal4_33, TotalSoftCal4_34, TotalSoftCal4_35, TotalSoftCal4_36, TotalSoftCal4_37, TotalSoftCal4_38, TotalSoftCal4_39) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", '', $tsc_insert_id, 'TimeLine Calendar 2', 'TimeLine Calendar', '800', 'type1', '#606060', 'none', '0', '#dd3333', 'color', '#ffffff', '#1ea5ce', '18', 'Cairo', 'format1', '#000000', 'caret', '23', '#000000', '#000000', '#000000', '#ffffff', '75', '0', 'gradient5', '#ffffff', '#1ea5ce', '#ffffff', '21', '#008eba', '14', '#008eba', '#ffffff', '#008eba', 'caret', '20', '#5e5e5e', '#000000', '#c9c9c9', '100', '1', 'color'));
		$wpdb->query($wpdb->prepare("INSERT INTO $tsc_settings_table (id, TotalSoftCal_ID, TotalSoftCal_Name, TotalSoftCal_Type, TotalSoftCal_01, TotalSoftCal_02, TotalSoftCal_03, TotalSoftCal_04, TotalSoftCal_05, TotalSoftCal_06, TotalSoftCal_07, TotalSoftCal_08, TotalSoftCal_09, TotalSoftCal_10, TotalSoftCal_11, TotalSoftCal_12, TotalSoftCal_13, TotalSoftCal_14, TotalSoftCal_15, TotalSoftCal_16, TotalSoftCal_17, TotalSoftCal_18, TotalSoftCal_19, TotalSoftCal_20, TotalSoftCal_21, TotalSoftCal_22, TotalSoftCal_23, TotalSoftCal_24, TotalSoftCal_25, TotalSoftCal_26, TotalSoftCal_27, TotalSoftCal_28, TotalSoftCal_29, TotalSoftCal_30) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", '', $tsc_insert_id, 'TimeLine Calendar 2', 'TimeLine Calendar', '#ffffff', '#1ea5ce', 'yy-mm-dd', '12', '19', 'Cairo', '#1ea5ce', '#ffffff', 'center', '80', '1', '#1ea5ce', '#1ea5ce', '4', 'View More', '14', 'Cairo', '#1ea5ce', '1', '6', '#c1c1c1', '75', '1', '#ffffff', '16', 'Cairo', 'calendar', '22', '#ffffff', ''));
	}
?>