//
// Bubblehelp infoboxes, (C) 2002 Klaus Knopper <infobox@knopper.net>
// You can copy/modify and distribute this code under the conditions
// of the GNU GENERAL PUBLIC LICENSE Version 2.
//
var IWIDTH=250  // Tip box width
var ie5         // Are we using Internet Explorer Version 5 and up?
var kon         // Are we using KDE Konqueror?
var x,y,winW,winH  // Current help position and main window size
var idiv=null   // Pointer to infodiv container

function rebrowse(){window.location.reload();}

function infoinit(){
 ie5=(document.all&&(navigator.userAgent.indexOf('MSIE')>0)&&!(navigator.userAgent.indexOf('Opera')>0))?true:false;
 kon=(navigator.userAgent.indexOf('konqueror')>0)?true:false;
 x=0;y=0;winW=800;winH=600;
 idiv=null;
 document.onmousemove = mousemove;
 // Workaround for just another netscape bug: Fix browser confusion on resize
 // obviously konqueror has a similar problem :-(
 if(kon){ setTimeout("window.onresize = rebrowse", 2000); }
}

function untip(){
 if(idiv) idiv.visibility='hidden';
 idiv=null;
}

// Prepare tip boxes, but don't show them yet
function maketip(name,title,text){
  document.write('<div id="'+name+'" name="'+name+'" style="position:absolute; visibility:hidden; z-index:20; top:0px; left:0px;" width='+IWIDTH+'><div class="helphead">'+title+'</div><div class="helpcontent">'+text+'</div></div>'+"\n");
}

function tip(name){
	if(idiv) untip();
  idiv=(document.layers&&document.layers[name])?document.layers[name]:(document.all&&document.all[name]&&document.all[name].style)?document.all[name].style:document[name]?document[name]:(document.getElementById(name)?document.getElementById(name).style:0);
  if(idiv){
   winW=(window.innerWidth)? window.innerWidth+window.pageXOffset-20:document.body.offsetWidth-24;
   winH=(window.innerHeight)?window.innerHeight+window.pageYOffset  :document.body.offsetHeight;
   if(x<=0||y<=0){ // konqueror can't get mouse position
    x=(winW-IWIDTH)/2+(window.pageXOffset?window.pageXOffset:0);
    y=(winH-50)/2+(window.pageYOffset?window.pageYOffset:0); // middle of window
   }
   showtip();
  }
}

function showtip(){
  idiv.left=(((x+260)<winW)?x:x-255)+"px";
  idiv.top=(((y+90)<winH)?y+12:y-90)+"px";
  idiv.visibility='visible';
}

function mousemove(e){
 if(e) {
  x=e.pageX ? e.pageX : e.clientX ? e.clientX : 0;
  y=e.pageY ? e.pageY : e.clientY ? e.clientY : 0;
 } else if(event) {
  x=event.clientX;
  y=event.clientY;
 } else {x=0; y=0;}
 if(ie5 && document.documentElement) {
  x+=document.documentElement.scrollLeft;
  y+=document.documentElement.scrollTop;
 }
 if(idiv) showtip();
}

// Initialize after loading the page
window.onload=infoinit;


function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=400');");
}         
function popUp2(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=150');");
}         


function frameout()
{
  if (top.location != location) {
    top.location.href = self.location.href ;
  }
 if (window != top )
	top.location.href = selft.location.href;
// -->
}


// Title: Tigra Calendar
// URL: http://www.softcomplex.com/products/tigra_calendar/
// Version: 3.3 (European date format)
// Date: 09/01/2005 (mm/dd/yyyy)
// Note: Permission given to use this script in ANY kind of applications if
//    header lines are left unchanged.
// Note: Script consists of two files: calendar?.js and calendar.html

// if two digit year input dates after this year considered 20 century.
var NUM_CENTYEAR = 30;
// is time input control required by default
var BUL_TIMECOMPONENT = false;
// are year scrolling buttons required by default
var BUL_YEARSCROLL = true;

var calendars = [];
var RE_NUM = /^\-?\d+$/;

function calendar1(obj_target) {

	// assigning methods
	this.gen_date = cal_gen_date1;
	this.gen_time = cal_gen_time1;
	this.gen_tsmp = cal_gen_tsmp1;
	this.prs_date = cal_prs_date1;
	this.prs_time = cal_prs_time1;
	this.prs_tsmp = cal_prs_tsmp1;
	this.popup    = cal_popup1;

	// validate input parameters
	if (!obj_target)
		return cal_error("Error calling the calendar: no target control specified");
	if (obj_target.value == null)
		return cal_error("Error calling the calendar: parameter specified is not valid target control");
	this.target = obj_target;
	this.time_comp = BUL_TIMECOMPONENT;
	this.year_scroll = BUL_YEARSCROLL;
	
	// register in global collections
	this.id = calendars.length;
	calendars[this.id] = this;
}

function cal_popup1 (str_datetime) {
	if (str_datetime) {
		this.dt_current = this.prs_tsmp(str_datetime);
	}
	else {
		this.dt_current = this.prs_tsmp(this.target.value);
		this.dt_selected = this.dt_current;
	}
	if (!this.dt_current) return;

	var obj_calwindow = window.open(
		'/images/cal/cal.html?datetime=' + this.dt_current.valueOf()+ '&id=' + this.id,
		'Calendar', 'width=200,height='+(this.time_comp ? 215 : 190)+
		',status=no,resizable=no,top=200,left=200,dependent=yes,alwaysRaised=yes'
	);
	obj_calwindow.opener = window;
	obj_calwindow.focus();
}

// timestamp generating function
function cal_gen_tsmp1 (dt_datetime) {
	return(this.gen_date(dt_datetime) + ' ' + this.gen_time(dt_datetime));
}

// date generating function
function cal_gen_date1 (dt_datetime) {
	return (

		dt_datetime.getFullYear() + "-"
		+ (dt_datetime.getMonth() < 9 ? '0' : '') + (dt_datetime.getMonth() + 1) + "-"
		+ (dt_datetime.getDate() < 10 ? '0' : '') + dt_datetime.getDate()
	);
}
// time generating function
function cal_gen_time1 (dt_datetime) {
	return (
		(dt_datetime.getHours() < 10 ? '0' : '') + dt_datetime.getHours() + ":"
		+ (dt_datetime.getMinutes() < 10 ? '0' : '') + (dt_datetime.getMinutes()) + ":"
		+ (dt_datetime.getSeconds() < 10 ? '0' : '') + (dt_datetime.getSeconds())
	);
}

// timestamp parsing function
function cal_prs_tsmp1 (str_datetime) {
	// if no parameter specified return current timestamp
	if (!str_datetime)
		return (new Date());

	// if positive integer treat as milliseconds from epoch
	if (RE_NUM.exec(str_datetime))
		return new Date(str_datetime);
		
	// else treat as date in string format
	var arr_datetime = str_datetime.split(' ');
	return this.prs_time(arr_datetime[1], this.prs_date(arr_datetime[0]));
}

// date parsing function
function cal_prs_date1 (str_date) {

	var arr_date = str_date.split('-');

	if (arr_date.length != 3) return cal_error ("Invalid date format: '" + str_date + "'.\nFormat accepted is yyyy-mm-dd.");
	if (!arr_date[0]) return cal_error ("Invalid date format: '" + str_date + "'.\nNo year value can be found.");
	if (!RE_NUM.exec(arr_date[0])) return cal_error ("Invalid year value: '" + arr_date[0] + "'.\nAllowed values are unsigned integers.");
	if (!arr_date[1]) return cal_error ("Invalid date format: '" + str_date + "'.\nNo month value can be found.");
	if (!RE_NUM.exec(arr_date[1])) return cal_error ("Invalid month value: '" + arr_date[1] + "'.\nAllowed values are unsigned integers.");
	if (!arr_date[2]) return cal_error ("Invalid date format: '" + str_date + "'.\nNo day of month value can be found.");
	if (!RE_NUM.exec(arr_date[2])) return cal_error ("Invalid day of month value: '" + arr_date[2] + "'.\nAllowed values are unsigned integers.");

	var dt_date = new Date();
	dt_date.setDate(1);

	if (arr_date[1] < 1 || arr_date[1] > 12) return cal_error ("Invalid month value: '" + arr_date[1] + "'.\nAllowed range is 01-12.");
	dt_date.setMonth(arr_date[1]-1);
	 
	if (arr_date[0] < 100) arr_date[0] = Number(arr_date[0]) + (arr_date[0] < NUM_CENTYEAR ? 2000 : 1900);
	dt_date.setFullYear(arr_date[0]);

	var dt_numdays = new Date(arr_date[0], arr_date[1], 0);
	dt_date.setDate(arr_date[2]);
	if (dt_date.getMonth() != (arr_date[1]-1)) return cal_error ("Invalid day of month value: '" + arr_date[2] + "'.\nAllowed range is 01-"+dt_numdays.getDate()+".");

	return (dt_date)
}

// time parsing function
function cal_prs_time1 (str_time, dt_date) {

	if (!dt_date) return null;
	var arr_time = String(str_time ? str_time : '').split(':');

	if (!arr_time[0]) dt_date.setHours(0);
	else if (RE_NUM.exec(arr_time[0]))
		if (arr_time[0] < 24) dt_date.setHours(arr_time[0]);
		else return cal_error ("Invalid hours value: '" + arr_time[0] + "'.\nAllowed range is 00-23.");
	else return cal_error ("Invalid hours value: '" + arr_time[0] + "'.\nAllowed values are unsigned integers.");
	
	if (!arr_time[1]) dt_date.setMinutes(0);
	else if (RE_NUM.exec(arr_time[1]))
		if (arr_time[1] < 60) dt_date.setMinutes(arr_time[1]);
		else return cal_error ("Invalid minutes value: '" + arr_time[1] + "'.\nAllowed range is 00-59.");
	else return cal_error ("Invalid minutes value: '" + arr_time[1] + "'.\nAllowed values are unsigned integers.");

	if (!arr_time[2]) dt_date.setSeconds(0);
	else if (RE_NUM.exec(arr_time[2]))
		if (arr_time[2] < 60) dt_date.setSeconds(arr_time[2]);
		else return cal_error ("Invalid seconds value: '" + arr_time[2] + "'.\nAllowed range is 00-59.");
	else return cal_error ("Invalid seconds value: '" + arr_time[2] + "'.\nAllowed values are unsigned integers.");

	dt_date.setMilliseconds(0);
	return dt_date;
}

function HelpWindow(FileNameToOpen,width,height,tool)
{
document.getElementById('content_editor').value = content_editor_obj.getPageHtml(content_editor_obj.getActivePage()); 
	newWindow = window.open(FileNameToOpen,'siteindex','width='+width+',height='+height+',toolbar=no,scrollbars='+tool+', location=no')
	if (newWindow.open)
	{ 
		newWindow.focus()
	}
}
//maketip functions
maketip('typeh','General','Choose one option to register as a Company or as a Professional.<br>Your company/professional details are viewable by all users of Companiesinfo.com as a public profile.<br>Note: You have the option to choose Private/Public to maintain confidentiality of your contact information.<br>All companies will be verified by admin for authentication of information.<br>');
maketip('sub_type','Subscription','Select the Subsciption Type');
maketip('payment_type','Subscription','Select the Payment type for Subscription');
maketip('paypal_email','Subscription','Enter Your paypal E-mail ID');
maketip('credit_type','Subscription','Select the Credit Card Type');
maketip('credit_fname','Subscription','Enter the first name on your Card');
maketip('credit_lname','Subscription','Enter the last name on your Card');
maketip('credit_num','Subscription','Enter the Credit Card Number');
maketip('credit_year','Subscription','Select the Credit Card Expiry Month & Year');
/**************** Tips For Customer Registration ******************/
maketip('cusfname','Customer','First Name');
maketip('cuslname','Customer','Last Name');
maketip('cusphone','Customer','Phone Number');
maketip('cusemail','Customer','Email<br>your email will be your username');
maketip('cuscountry','Customer','Country');
maketip('cusstate','Customer','State');
maketip('cuscity','Customer','City');
maketip('cusaddress','Customer','Address');
maketip('cuscompany','Customer','Company');
maketip('cusdesignation','Customer','Designation');
maketip('cusindustry','Customer','Industry');
maketip('cuscategory','Customer','Category');
maketip('cussubcategory','Customer','Subcategory');
maketip('cuslogo','Customer','logo');
maketip('cusproin','Customer','Products keywords which are interested in');
maketip('cusserin','Customer','Services keywords which are interested in');
maketip('cusrefer','Customer','Where did you hear about us');
maketip('cusoverview','Customer','Overview');
maketip('custags','Customer','Tags are like custom keywords, they make it easy for people to find your content');
/**************** End of Tips For Customer Registration ******************/
/**************** Tips For Company Registration ******************/
maketip('cname','Company','You will be known by your Company name on the site.<br>Please do not include Inc, Pvt. Ltd, LLC, LTD company extensions');
maketip('ciurl','Company','Company URL which is avalable in the Companiesinfo Site.<br>You can make this URL to get your Company information in a Single Click.<br>Make sure the name in the URL not have Special Characters or Spaces.');
maketip('ctype','Company','Type');
maketip('cindustry','Company','Company Industry');
maketip('cat','Company','Company Category');
maketip('ctypeh','Company','Company Type');
maketip('home','Company','Company Home Page URL');
maketip('blogh','Company','Company Blog URL');
maketip('phoneh','Company','Company Phone Number');
maketip('emailh','Company','Please use a real email address as we need to email you for confirmation.<br>We will never share your email with anyone.<br>Your email address will not appear on your profile.');
maketip('address1h','Office','Address1 of the Office');
maketip('address2h','Office','Address2 ot the office');
maketip('ccountryh','Office','Company Located country');
maketip('cstates','Office','Company Located State');
maketip('cityh','Office','city name that the office located');
maketip('stateh','Office','State name that  the office is located');
maketip('zipcodeh','Office','Zipcode that the office is located');
maketip('noeh','Company','Number of Employees in Company');
maketip('foundingh','Company','Company Founded Date');
maketip('logoh','Company','You can upload the Company logo in any of the following formats (gif, jpg, png, jpeg)');
maketip('overviewh','Company','Company Overview');
maketip('tagsh','Company','Tags are like custom keywords, they make it easy for people to find your content');
maketip('subscript','Company','Select Subscription Type');
maketip('psecphone','Company','Select secondary email. Only one email id will be active at any time');
/**************** End of Tips For Company Registration ******************/
maketip('pservicename','Professional','Briefly Summarize the services you provide.');
maketip('pindustry','Professional','Industry');
maketip('pmaincat','Professional','Category');
maketip('fname','Professional','First Name');
maketip('lname','Professional','Last Name');
maketip('phome','Professional','Professional Home Page URL');
maketip('pblogh','Professional','Professional Blog URL');
maketip('pphoneh','Professional','Professional Phone Number');
maketip('pemailh','Professional','We will never share your email with anyone.<br>Your email address will not appear on your profile.');
maketip('pcountry','Professional','Professional Location');
maketip('pstate','Professional','Professional State');
maketip('pcity','Professional','Professional City');
maketip('pzipcode','Professional','Professional Zip code of the Location');
maketip('bplace','Professional','Professional Birth Place');
maketip('pcomp','Professional','Professional Company Details');
maketip('pcompname','Professional','Professional Company Name');
maketip('pjobtitle','Professional','Professional Job Title');
maketip('pfromdate','Professional','joining Date');
maketip('ptodate','Professional','Relieving Date');
maketip('pdetails','Professional','Other Details');
maketip('dobh','Professional','Professional Date of Birth');
maketip('imageh','Professional','You can upload logo in any of the following formats (gif, jpg, png, jpeg)');
maketip('poverviewh','Professional','Professional Overview');
maketip('ptagsh','Professional','Tags are like custom keywords, they make it easy for people to find your content');
maketip('pimage_line','Professional','The Headline tells about you on mouseover your image')

maketip('ocountry','Office','Office Located country');
maketip('cpasswordh','Change Password','Change Password for the current User');
maketip('ccpasswordh','Change Password','Confirm Password for the current User');
maketip('ntitle','News','Title fot this News');
maketip('ndesc','News','Description of the News');
maketip('btitle','Blogs','Title fot this Blog');
maketip('bdesc','Blogs','Description of the Blog');
maketip('atitle','Article','Title fot this Article');
maketip('adesc','Article','Description of the Article');
maketip('jtitle','Job','Job title');
maketip('jexp','Job','Job Experience');
maketip('jlocation','Job','Job Location');
maketip('jskills','Job','Job Primary skills');
maketip('jdesc','Job','Job Description');
maketip('jqual','Jobs','Please enter qualification for this job');
maketip('ntype','News','Type of the news , If type is public then news will display in public  if type is private the news will display only for company users');
maketip('btype','Blogs','Type of the Blog , If type is public then blog will display in public  if type is private the blog will display only for company users');
maketip('atype','Article','Type of the Article , If type is public then article will display in public  if type is private the article will display only for company users');
maketip('display','Display','To display details of this item to public');
maketip('pphoto','Photo','Photo of the employee');
maketip('pdesignationh','Designation','Designation of the employee');
maketip('hide','Hide','click to hide the form');
maketip('permissions','Permissions','Permissions to this user');
//products
maketip('cproducttitle','Product','Product Title');
maketip('cproductstage','Product','Product Develope Stage');
maketip('cproducthomepageurl','Product','Product Home page URL');
maketip('cproductblogurl','Product','Product Blog URL');
maketip('cproductlunchdate','Product','Product Launch Date');
maketip('cproductdeadpooldate','Product','Product DeadPool Date');
maketip('cproductdeadpoolurl','Product','Product DeadPool URL');
maketip('cproductinvesturl','Product','Product Investor URL');
maketip('cproductdescription','Product','Product Description');
maketip('mtodate','Milestones','Milestone Start Date');
maketip('mfromdate','Milestones','Milestone End Date');
maketip('sourcetitleh','Milestones','Milestone Source Title');
maketip('sourceurlh','Milestones','Milestone Source URL');
maketip('cdescriptionh','Milestones','Milestone Description');
//support
maketip('supporttype','Support','Select Category');
maketip('supportemail','Support','Email ');
maketip('supportsub','Support','Subject');
maketip('supportdesc','Support','Support Text');
//portfolio
maketip('porttitle','Portfolio','Project Title');
maketip('porttype','Portfolio','Project Type');
maketip('porttech','Portfolio','Technology used for the project');
maketip('porttags','Portfolio','Tags/Keywords for the project');
maketip('portimg','Portfolio','Image for the project');
maketip('portdesc','Portfolio','Project Description');
maketip('compsectag','Security Code','Please Enter the text in the below textbox which is shown on the image.It is for Validating the information and make it secure.');
maketip('pcodetags','Security Code','Please Enter the text in the below textbox which is shown on the image. It is for Validating the information and make it secure.');