Tuesday, November 29, 2011

SVG Edit : Saving files to server


SVG-edit is a fast, web-based, Javascript-driven SVG editor that works in any modern browser. To learn more about SVG-edit, click here . By default, while clicking on the save link given in the menu, the image is opening in new window and user has to manually save the image to user's machine. SVG-edit (version 2.5.1) has given an extension to download the files to user's machine.

To download the file

Open svg-editor.js

In curConfig object, to the extensions array add 'ext-server_opensave.js' to the end. Make sure that ext-server_opensave.js , fileopen.php and filesave.php exist in the svg/extensions directory

To save the file to server

Do the above steps.

Open the extensions/filesave.php and comment out below code

header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=" . $file);
header("Content-Type: " . $mime);
header("Content-Transfer-Encoding: binary");
echo $contents;

And add the following code at the end

define('DIR_PATH', 'path to the directory with trailing slash');
$fp = fopen(DIR_PATH . $file, 'w+');
fwrite($fp, $contents);
fclose($fp);


Give proper directory path to DIR_PATH constant and give necessary permission to the folder

Friday, May 30, 2008

Usefull Links

Bookmarks




amazon



Class: Amazon API PHP


Sign In
Amazon API : css
Amazon.com Associates Central
Amazon Web Services Developer Connection : Introduction to AWS for PHP Developers

Amazon.com Checkout Sign In
Amazon.com: Homepage: Amazon Web Services
Amazon Web Services provides open APIs for developers that are robust, reliable, scalable, inexpensive, and easy-to-integrate. Developer Forum and Developer Tools.
Amazon.com
Find, shop for and buy at Amazon.com
Amazon.com Associates: The web's most popular and successful Affiliate Program
Online shopping from a great selection of Help; Explore Associates, Compensation, Online Reporting, Link Types, Web Services, Current Associates, Publishers & Vendors & more at everyday low prices.
Amazon Web Services Developer Connection : Amazon Associates Web Service (formerly Amazon ECS)

Amazon Web Services Developer Connection : Search
Amazon Web Services Developer Connection : Getting Started With PHP ...
Amazon Web Services Developer Connection : PHP Question about web services ...
Amazon Web Services Developer Connection : Articles and Tutorials
Amazon Web Services Developer Connection : A2S Simple Store in PHP
Amazon Web Services Developer Connection : Making Money with A2S, the Associates Program, and PHP

Amazon.com Associates Central
Amazon.com: Amazon Associates Web Service, Build an E-Commerce Website: Amazon Web Services
Amazon Associates Web Service allows developers to build an online store using Amazon's product descriptions, images, promotions, and more.
Amazon.com Web Services: Part One
Amazon Web Services Developer Connection : Articles and Tutorials
Amazon Web Services Developer Connection : Community Code
Amazon Web Services: Amazon E-Commerce Service

Amazon Response Group
ItemLookup Operation
Amazon Web Services: Amazon E-Commerce Service
amazon.class.phps
http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=1N8GCDGSN4Y4PQE60182&Operation=ItemLookup&ItemId=0471774979

ECS Cart Alternatives
Amazon Associates Web Service
Amazon.com
Find, shop for and buy at Amazon.com
Amazon Web Services Developer Connection : Return from shopping cart ...
Amazon Web Services Developer Connection : Return from shopping cart ...
Amazon Web Services Developer Connection : Making Money with the Associates Program, and PHP


Personal Toolbar Folder




PHP

PHP DevCenter
The O'Reilly Network's PHP DevCenter Articles and Weblogs
PHP Kerala

Redlista
PHPBuilder
PHP Help, PHP Programming, PHP Code, PHP Tutorials
Drawing line graph by taking data from MySQL table by GD in PHP
Script to 3D pie chart with PHP

drag drop example
Cookbook :: 1.2 Collection :: The Manual :: Common Tasks With CakePHP :: Data Validation
I Talk. You Talk. We Talk Together.
DZOIC Forums - Powered by vBulletin
Large Response Group
The Best Web Tools To Help Your Know Everything About Websites

MySQL AB :: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Payflow Pro - verisign payment module help - osCommerce and osCMax shopping cart software forums
Payflow Pro - verisign payment module help - osCommerce and osCMax shopping cart software forums

House Painting: The Old House Web
alpaha.php
full
API Reference Guide - Google Calendar APIs and Tools - Google Code
API Reference Guide - Google Calendar APIs and Tools - Google Code
Zend Framework: Documentation

Common Elements: "Kinds" - Google Data APIs - Google Code
Google Auth For Web Apps
1.4. Using Google Calendar
Smashing Magazine
we smash you with the information that will make your life easier. really.



Paypal



API Credentials
All API communication between you and PayPal occurs over a secure connection using SSL encryption. You will use two certificates during your integration: one for testing in the Sandbox and one for live transactions. This page describes how to generate your API Certificates and how to use them.
API Reference
Browse documentation on all PayPal Web Service API calls, parameters and types.


wordpress




Graphic Design Blog » Wordpress as a CMS - Content Management System
Wordpress as a CMS - Content Management System
Semiologic
Notice: WP 2.3 users should grab the [bleeding edge version->/res/semiologic-bleeding.zip] (Semiologic 5.0 beta). (...)
User:Lastnode/Wordpress CMS « WordPress Codex
WordPress › WordPress Navigation Tool (NAVT) « WordPress Plugins
WordPress › bSuite « WordPress Plugins
User:Lastnode/Wordpress CMS « WordPress Codex

Bos89.nl » Wordpress as CMS in five steps
Plugins « WordPress Codex


Ffmpeg



FFmpeg
ffmpeg installation - Google Search

General Documentation
Ffmpeg install instructions - Gemin-Wiki
[How-To] Install FFMPEG to your account - Site5 Web Hosting Forums
[How-To] Install FFMPEG to your account How To: Tutorials
[ffmpeg] Index of /trunk
Ffmpeg 1
FFmpeg 2

[How-To] Install FFMPEG to your account How To: Tutorials
Ffmpeg 3
Page 2-How to install FFMPEG How To: Tutorials
Ffmpeg 4
QuickTime: Sample files
Windows Media Player multimedia file formats
This article discusses the multimedia file types that Microsoft Windows Media Player supports and provides a sample of most of these file types. If problems occur when you play a supported file type from another source, Microsoft recommends that you...
Video Samples to download
Samples to download from Gordon Monro, Australian computer music composer and electronic artist.
SourceForge.net: Files

The world's largest development and download repository of Open Source code and applications
Ffmpeg Forum
Windows Media Player multimedia file formats
This article discusses the multimedia file types that Microsoft Windows Media Player supports and provides a sample of most of these file types. If problems occur when you play a supported file type from another source, Microsoft recommends that you...
Microsoft® Expression®
File Formats
Describes the different audio file formats and codecs available on Windows computers. Includes samples of each audio format including WAV, MP3, VOX, RAW, WMA, RA and RAM.
Sweep Audio Demos
Metadecks Project
Flac files

Ffmpeg php code
FFmpeg-svn_20070606


Php



phpBB • Knowledge Base
ARB

fValidator - With iMask
PHP regular expressions examples
Various PHP regular expression examples to help your application validate, compare, compute or decide
PHP: Classes and Objects (PHP 5) - Manual
PHP Session Management With Cookies
Xforms
Browse the XML technical library view for technical articles and tips, tutorials, standards, and IBM Redbooks. View the list by product, title, topic, or keyword and sort your results.
Imap

Get ready for XForms
Traditional HTML forms violate many of the tenets of good markup language design, frequently mixing presentation and data. In this article, Joel Rivera and Len Taing introduce you to XForms, an extension of XHTML that represents the next generation of Web forms. Though XForms is still in an embryonic state, it holds great promise: For instance, a form written with XForms can be written once and displayed in an optimal ways on several different platforms. Once you finish reading this article, you'll have a head start on this important emerging XML technology.f

GDATA : how to get an other calendar than the default one ? - Zend Framework Forum
hello everything is in the title i need to get events from another cal than the default one.
Google cal php IBM
Google Calendar and other online calendaring applications provide simple centralized systems where online communities can maintain event calendars and community members can get information about upcoming events. But many organizations prefer to display event calendars on their community portals, forums, or blogs. They often copy event calendar information from online calendaring applications onto their Web sites, reducing the effectiveness of centrally managing events online. Google Calendar provides an integration application program interface (API) that provides a good solution to this problem. Find out how to use XPath to extract and display Google Calendar data on your PHP Web site.
PHPreg.com - Mastering Regular Expressions in PHP
PHPreg.com - a regular php resource with php mysql tutorials, articles tips and support, Mastering Regular Expressions in PHP
Compare file contents and render the output with PHP and PEAR
The Text_Diff PEAR class makes it possible to compare file contents in the PHP environment and render the output in various formats. This tutorial will demonstrate this class in action, illustrating how you can use it to dynamically compare file contents with PHP and render the results as a Web page.
The Show : The Show for CakePHP


Mambo-Joomla



Mambo - Manual
Mambo - the dynamic portal engine and content management system


Cake




CakePHP tutorial no. 1 from IBM
Baker
cakebaker » bake
CakeForge: Snippet Library
CakePHP : Screencasts
Bake Cake

CakePHPDecorate
CakePHPは、WEB開発用 PHP4/PHP5/PHP6のRADフレームワークです。日々、発展を遂げる各種フレームワークの動向を見極めつつ、日本発のCakePHP応援ブログとして、最新情報をお届けします。
CodeIgniter vs. CakePHP - Snook.ca
Snook.ca - Web Design, Development and Consulting Services
The CakePHP Framework: Your First Bite
CakePHP is a mature framework for PHP developers who want the structure and time-saving benefits of Ruby on Rails, without having to leave their comfort zone. As Fabio explains, CakePHP's scaffolding lets us build a prototype application quickly, using minimal code. Cake also offers many helper classes to extend and customize your application while retaining a sensible and easily maintainable architecture.
10 confusions with their solutions before you start using CakePHP | The Bakery, Everything CakePHP : Articles


Google

Hutch
Load your phone with your favourite ringtones, caller tunes, wallpapers, themes, logos, pictures and more. Or learn more about Fun Cards – the easiest way to get your favourite downloads at a shop near you.
InformIT: Free Ebooks
Way2SMS
way2sms Bulk SMS Gateway India provides Bulk SMS India, SMS Bulk, Sending Bulk SMS or SMS Bulk Messaging & Bulk SMS Services. FREE SMS India. Send Free SMS in India. Bulk SMS India, Group SMS India, SMS India, SMS in India, SMS India Free. We are a Leading Bulk SMS Providers, Bulk SMS Provider & Provide Bulk SMS Sender & Cheap Bulk SMS. To Send Bulk SMS, Bulk SMS Messages, Bulk SMS Sending, Bulk SMS Service, Bulk SMS messaging, we provide Bulk SMS Software.
vtunnel another

SMS collection
Entertainment Unlimited Zone. Collection of funny, naughty, friendship, romantic, shayari, santa banta SMS. Send Free SMS to any CDMA, GSM mobile phone in India. Funny Pictures & E-cards, Forums, Chat Room, News & more
sms
Latest/new Good Morning SMS, urdu Good Morning SMS, english Good Morning SMS, Good Morning SMS messages, Good Morning SMS collection, funny Good Morning SMS, Good Morning SMS messages collection
Talk English
Learn how to speak English fluently- totally free!
Mathrubhumi
Ajax Toolbox

Caller Tunes
A JavaScipt Timer
Ascii Table - ASCII character codes and html, octal, hex and decimal chart conversion
Ascii character table - ascii ascii ascii ascii and ascii...conversions
http://www.fedexfreight.fedex.com/XMLRating.jsp?as_shipterms=prepaid&as_shzip=32043&as_shcntry=US&as_cnzip=56009&as_cncntry=US&as_iamthe=shipper&as_class1=050&as_weight1=1&as_pcs1=1&as_haz1=1&as_freezable1=1&as_class2=050&as_weight2=1&as_pcs2=1&as_haz2=1&as_freezable2=1&as_class3=050&as_weight3=1&as_pcs3=1&as_haz3=1&as_freezable3=1&as_class4=050&as_weight4=4&as_pcs4=1&as_haz4=1&as_freezable4=1

Ajax (programming) - Wikipedia, the free encyclopedia

Ruby



Agile Web Development _ Ruby
A site for Rails developers. Home of the Rails plugin directory.
Ruby for Perl programmers
Ruby on Rails - SlideShow

Geting Really Started with Ruby on Rails, Install & Update Rails with RubyGems
try ruby! (in your browser)
Ruby on Rails Official site
All Pages in Ruby on Rails
TutorialStepThree in Ruby on Rails
Top 12 Ruby on Rails Tutorials

Learning Ruby
Ruby On Rails - Getting Started | Menekali
Ruby on Rails is an open source web application framework. It is written in Ruby and follows the MVC or Model-View-Controller architecture. Developers using RoR
ONLamp.com -- Rolling with Ruby on Rails
Curt Hibbs shows off Ruby on Rails by building a simple application that requires almost no Ruby experience.
ONLamp.com -- Rolling with Ruby on Rails
Curt Hibbs shows off Ruby on Rails by building a simple application that requires almost no Ruby experience.
Ruby on Rails API | count
Programming Ruby: The Pragmatic Programmer's Guide

Documentation for Ruby on Rails
Ruby on Rails Simplest tutorial
Ruby on Rails Installation - Learn Ruby on Rails in simple and easy steps. You will learn its installation, framework, strengths with examples and you will learn about actionpack, actionview, activerecord, Heinemeier, Scaffolding, Controller, Heinemeier, Hansson etc.
A complete turbogears spoliation: howto build a wiki in 20 minutes (well I did not time it)
Rails 1.1 Cheat Sheet -
Ruby on Rails in practice. Rails development tips, Rails Testing and Rails Hosting.
Array loop, find:Control array : Two dimension array : Array « Language Basics « JavaScript DHTML
Array loop, find:Control array : Two dimension array : Array « Language Basics « JavaScript DHTML
Rake

Your description goes here...


Club osCommerce
Oscommerce Modules Installation and Customization
Description of Oscommerce modules and what they do. We do Oscommerce modules customization and installation.
osCommerce Fedex module
Model-view-controller - Wikipedia, the free encyclopedia

Oscommerce




osCommerce Knowledge Base
osCommerce Help Links
Offering osCommerce Help Links
osCommerce Knowledge Base
Multiple-Shipping-Addresses - osCommerce Community Support Forums
Multiple-Shipping-Addresses 2 - osCommerce Community Support Forums

Multiple-Shipping-Addresses 2 - osCommerce Community Support Forums
Multiple-Shipping-Addresses - osCommerce Community Support Forums
Search Results


Multiple-Shipping-Addresses 2 - osCommerce Community Support Forums
Multiple-Shipping-Addresses 2 - osCommerce Community Support Forums

Handshakes Mods . com ::Welcome
Handshakes mods is a site that will be hosting and showing off handshakes modifications and themes.
Handshakes::Welcome
This site is powered by DZOIC Handshakes Professional - the best social networking portal in PHP.
Useful links for web developer by Sonal Patel
DZOIC - Powered By Kayako SupportSuite
How to create submenu + page - DZOIC Forums
How to create submenu Themes and Templates
Create a New Page with Advertisements - DZOIC Forums

Create a New Page with Advertisements Themes and Templates
HOW TO: Create a new page - Powered By Kayako SupportSuite
HOW TO:Make a new page authenticate for logged in members only - Powered By Kayako SupportSuite
DZOIC - Powered By Kayako SupportSuite
Smarty : Resources
How can I create a new form? - DZOIC Forums
How can I create a new form? How To Questions
Smarty Templating [Archive] - DZOIC Forums

[Archive] Smarty Templating How To Questions
adding php calls to your page [Archive] - DZOIC Forums
[Archive] adding php calls to your page How To Questions
Tutorials DZOIC Forums
[Archive] Tutorials needed urgently How To Questions
Form Options - DZOIC Forums
Form Options How To Questions
New in PHP 5
Page 4 - What's New in PHP 5
MySQL Table Types
John Horns shows how important Table Types are, especially at design time.
Javascript Toolbox: Reusable Libraries And Scripts Plus Information

JavaScript Cake Tutorials and Scripts
JavaScript » Objects » Form - DevGuru Quick Reference
The DevGuru JavaScript Quick Reference is the definitive JavaScript reference and tutorial resource on the web, with hundreds of ready to use examples for you to include in your projects.
How to use Image_Graph
php interview question,perl question: php interview questoins
PHP 5
Protecting PHP 5 Class Data with Member Visibility

Friday, November 10, 2006

Common Javascript validation functions

function func_popup_close()
{
    if(opener!=null)
    {
        opener.focus();
    }
    window.close();
}
function func_is_longer_than_max_length(param_text,param_num)
{
    var i_length;
    var str_text=new String(func_trim(param_text));
    i_length=func_len(str_text);
    if (i_length>param_num)
    {
        return true;
    }
    else
    {
        return false;
    }
}
function func_is_shorter_than_min_length(param_text,param_num)
{
    var i_length;
    var str_text=new String(param_text);
    i_length = func_len(str_text);
    if (i_length < param_num)
    {
        return true;
    }
    else
    {
        return false;
    }
}

function func_trim(param_text)
{
    var str_text=new String(param_text);
    var str_return_text;
    str_return_text="";
    b_non_blank_started=false;
    b_non_blank_ended=false;
    str_intermediate_blank_chunk="";
    var i_loop;
    for(i_loop=0;i_loop    {
        if(str_text.charCodeAt(i_loop)!=32)
        {
        if(!b_non_blank_started)
        {
                b_non_blank_started=true;
            }
        if(b_non_blank_started && !b_non_blank_ended)
            {
                str_return_text+=str_text.charAt(i_loop);
            }
            if(b_non_blank_ended)
            {
                str_return_text+=(str_intermediate_blank_chunk+str_text.charAt(i_loop));
                b_non_blank_ended=false;
                str_intermediate_blank_chunk="";
            }
        }
        else
        {
            if(b_non_blank_started)
            {
                b_non_blank_ended=true;
                str_intermediate_blank_chunk+=" ";
            }
        }
    }
    return str_return_text;
}

function func_is_max_length(param_text,param_num)
{
    var i_length;
    var str_text=new String(func_trim(param_text));
    i_length=func_len(str_text);
    if (i_length>param_num)
    {
        return false;
    }
    else
    {
        return true;
    }
}

function func_len(param_text)
{
    var str_text=new String(func_trim(param_text));
    return str_text.length;
}

function func_is_numeric(param_text)
{
    if(!isNaN(param_text))
    {
        return true;
    }
    else
    {
        return false;
    }
}

function func_is_positive_integer(param_text)
{
var b_is_positive_integer=true;
var str_text=new String(func_trim(param_text));
var i_loop;
for(i_loop=0;i_loop    {
if(!(str_text.charAt(i_loop)>="0" && str_text.charAt(i_loop)<="9"))
{
b_is_positive_integer=false;
break;
}
}
if(b_is_positive_integer)
    {
var i_integer=new Number(str_text);
if(i_integer.valueOf()<=0)
{
b_is_positive_integer=false;
}
    }
return b_is_positive_integer;
}

function func_is_non_negative_integer(param_text)
{
var i_length;
var b_is_non_negative_integer=true;
var str_text=new String(func_trim(param_text));
var i_loop;
for(i_loop=0;i_loop    {
if(!(str_text.charAt(i_loop)>="0" && str_text.charAt(i_loop)<="9"))
{
b_is_non_negative_integer=false;
break;
}
    }
if(b_is_non_negative_integer)
    {
var i_integer=new Number(param_text);
if(i_integer.valueOf()<0)
{
b_is_non_negative_integer=false;
}
    }
return b_is_non_negative_integer;
}

function func_is_integer(param_text)
{
var i_length;
var b_is_integer=true;
var str_text=new String(func_trim(param_text));
var i_loop;
for(i_loop=0;i_loop    {
if(!(str_text.charAt(i_loop)>="0" && str_text.charAt(i_loop)<="9"))
{
b_is_integer=false;
break;
}
    }
return b_is_integer;
}

function func_is_real_number(param_text)
{
var i_length;
var b_is_real_number=true;
var str_text=new String(func_trim(param_text));
var i_loop;
for(i_loop=0;i_loop    {
if(!((str_text.charAt(i_loop)>="0" && str_text.charAt(i_loop)<="9") || (str_text.charAt(i_loop)==".") || (str_text.charAt(i_loop)=="+") || (str_text.charAt(i_loop)=="-") || (str_text.charAt(i_loop)=="e") || (str_text.charAt(i_loop)=="E")))
{
b_is_real_number=false;
break;
}
    }
return b_is_real_number;
}

function func_is_positive_real_number(param_text)
{
var i_length;
var b_is_positive_real_number=true;
var str_text=new String(func_trim(param_text));
var i_loop;
for(i_loop=0;i_loop    {
if(!((str_text.charAt(i_loop)>="0" && str_text.charAt(i_loop)<="9") || (str_text.charAt(i_loop)==".") || (str_text.charAt(i_loop)=="+") || (str_text.charAt(i_loop)=="-") || (str_text.charAt(i_loop)=="e") || (str_text.charAt(i_loop)=="E")))
{
b_is_positive_real_number=false;
break;
}
    }
if(b_is_positive_real_number)
    {
var i_real_number=new Number(str_text);
if(i_real_number.valueOf()<=0.0)
{
b_is_positive_real_number=false;
}
    }
return b_is_positive_real_number;
}

function func_is_non_negative_real_number(param_text)
{
var i_length;
var b_is_non_negative_real_number=true;
var str_text=new String(func_trim(param_text));
var i_loop;
for(i_loop=0;i_loop    {
if(!((str_text.charAt(i_loop)>="0" && str_text.charAt(i_loop)<="9") || (str_text.charAt(i_loop)==".") || (str_text.charAt(i_loop)=="+") || (str_text.charAt(i_loop)=="-") || (str_text.charAt(i_loop)=="e") || (str_text.charAt(i_loop)=="E")))
{
b_is_non_negative_real_number=false;
break;
}
    }
if(b_is_non_negative_real_number)
    {
var i_real_number=new Number(str_text);
if(i_real_number.valueOf()<0.0)
{
b_is_non_negative_real_number=false;
}
    }
return b_is_non_negative_real_number;
}

function func_is_email(param_email)
{
var str_current_character;
var b_valid_email,b_period_present;
var i_last_position_of_period,b_correct_length_extension;
var i_num_at_symbol=0;
var i_pos_at_symbol;
var i_length_of_server_name=1;
var i_pos_consecutive_dots;
var str_email=new String(func_trim(param_email));
i_length=str_email.length;
b_period_present=1;
b_correct_length_extension=1;
i_last_position_of_period=0;

if(i_length==0)
    {
return true;
    }

for(i_loop=0; i_loop {
if(!((str_email.charCodeAt(i_loop)>=65 && str_email.charCodeAt(i_loop)<=90)
|| (str_email.charCodeAt(i_loop)>=97 && str_email.charCodeAt(i_loop)<=122)
|| (str_email.charCodeAt(i_loop)>=48 && str_email.charCodeAt(i_loop)<=57)
|| (str_email.charAt(i_loop)=="@")
|| (str_email.charAt(i_loop)=="_")
|| (str_email.charAt(i_loop)=="-")
|| (str_email.charAt(i_loop)==".")))
{
return false;
}
    }

i_pos_consecutive_dots=str_email.indexOf('..');
if(i_pos_consecutive_dots!=-1)
    {
return false;
    }

var i_pos_space;
i_pos_space = str_email.indexOf(' ');
if(i_pos_space!=-1)
    {
return false;
    }

i_last_position_of_period = str_email.lastIndexOf('.');
if(i_last_position_of_period<=0)
    {
b_period_present=0;
    }
if(((i_length-i_last_position_of_period)>5) || ((i_length-i_last_position_of_period)<3))
    {
b_correct_length_extension=0;
    }

for(i_loop=0;i_loop<=i_length;i_loop++)
    {
str_current_character=str_email.charAt(i_loop);
if (str_current_character=='@')
{
i_num_at_symbol=i_num_at_symbol + 1;
}
    }

if(i_num_at_symbol!=1)
    {
return false;
    }

i_pos_at_symbol = str_email.indexOf('@');
if(str_email.charAt(i_pos_at_symbol+1) == '.')
    {
i_length_of_server_name=0;
    }

if((i_num_at_symbol==1) && (b_period_present==1) && (b_correct_length_extension==1) && (i_length_of_server_name==1))
    {
b_valid_email=1;
    }
else
    {
b_valid_email=0;
    }

if(b_valid_email==0)
    {
return false;
    }
else
    {
return true;
    }
}

function func_is_min_length(param_text,param_num)
{
var i_length;
var str_text=new String(param_text);
i_length = func_len(str_text);
if (i_length    {
return false;
    }
else
    {
return true;
    }
}

//isTelephoneNumber -returns true if it is valid Telephone or Fax Number.allowing +-.()
function func_is_telephone_number(param_text)
{
var b_is_telephone_number=true;
if(func_trim(param_text)!="")
    {
var str_text=new String(func_trim(param_text));
var i_length=func_len(str_text);
var i_loop;
for (i_loop=0;i_loop {
if (!((str_text.charCodeAt(i_loop) >= 48 && str_text.charCodeAt(i_loop) <= 57) || (str_text.charAt(i_loop) == "-")|| (str_text.charAt(i_loop) == "(")|| (str_text.charAt(i_loop) == ")") || (str_text.charAt(i_loop) == "+") || (str_text.charCodeAt(i_loop) ==32) || (str_text.charAt(i_loop) == ".")))
{
b_is_telephone_number=false;
}
}
    }
return b_is_telephone_number;
}

function func_is_us_phone(phonenumber)
{
if((phonenumber.match(/^[ ]*[(]{0,1}[ ]*[0-9]{3,3}[ ]*[)]{0,1}[-]{0,1}[ ]*[0-9]{3,3}[ ]*[-]{0,1}[ ]*[0-9]{4,4}[ ]*$/)==null) && (phonenumber.match(/^[ ]*[0-9]{3,3}[ ]*[-]{0,1}[ ]*[0-9]{4,4}[ ]*$/)==null)) return false;
else
return true;
}


function func_is_fax_number(param_text)
{
var b_is_fax_number=true;
if(func_trim(param_text)!="")
    {
var str_text=new String(func_trim(param_text));
var i_length=func_len(str_text);
var i_loop;
for (i_loop=0; i_loop {
if (!((str_text.charCodeAt(i_loop)>=48 && str_text.charCodeAt(i_loop)<=57) || (str_text.charAt(i_loop)=="-") || (str_text.charAt(i_loop)=="(") || (str_text.charAt(i_loop)==")") || (str_text.charAt(i_loop)=="+") || (str_text.charCodeAt(i_loop)==32) || (str_text.charAt(i_loop)==".")))
{
b_is_fax_number=false;
}
}
    }
return b_is_fax_number;
}

function func_is_zip(field)
{
var valid = "0123456789-";
var hyphencount = 0;
var b_correct = true;
if (field.length!=5 && field.length!=10)
    {
b_correct = false;
    }
if(b_correct)
    {
for (var i=0; i < field.length; i++)
{
temp = "" + field.substring(i, i+1);
if (temp == "-") hyphencount++;
if (valid.indexOf(temp) == "-1")
{
b_correct = false;
}
if(b_correct)
{
if ((hyphencount > 1) || ((field.length==10) && ""+field.charAt(5)!="-"))
{
b_correct = false;
}
}
}
    }
return b_correct;
}


function func_is_zip2(param_text)
{
var b_is_zip=true;
if(func_trim(param_text)!="")
    {
var str_text=new String(func_trim(param_text));
var i_length=func_len(str_text);
var i_loop;
if(i_length <5)
b_is_zip=false;
else
{
for (i_loop=0; i_loop {
if (!((str_text.charCodeAt(i_loop)>=48 && str_text.charCodeAt(i_loop)<=57) || (str_text.charAt(i_loop)=="-") || (str_text.charAt(i_loop)=="(") || (str_text.charAt(i_loop)==")") || (str_text.charCodeAt(i_loop)==32)))
{
b_is_zip=false;
}
}
}
    }
return b_is_zip;
}

function func_is_alpha_numeric(param_text)
{
var str_text=new String(func_trim(param_text));
var i_loop;
var b_is_alpha_numeric=true;
for (i_loop=0;i_loop    {
if (!((str_text.charCodeAt(i_loop)>=65 && str_text.charCodeAt(i_loop)<=90) || (str_text.charCodeAt(i_loop)>=97 && str_text.charCodeAt(i_loop)<=122) || (str_text.charCodeAt(i_loop)>=48 && str_text.charCodeAt(i_loop)<=57)))
{
b_is_alpha_numeric=false;
}
}
return b_is_alpha_numeric;
}

function func_is_alphabet(param_text)
{
var str_text=new String(func_trim(param_text));
var i_loop;
var b_is_alphabet=true;
for(i_loop=0;i_loop    {
if (!((str_text.charCodeAt(i_loop)>=65 && str_text.charCodeAt(i_loop)<=90) || (str_text.charCodeAt(i_loop)>=97 && str_text.charCodeAt(i_loop)<=122)))
{
b_is_alphabet=false;
}
    }
return b_is_alphabet;
}

function func_is_date(i_date,i_month,i_year)
{
var b_correct_date;
var dt_date=new Array(3);
b_correct_date=4;
dt_date[0]=i_date;
dt_date[1]=i_month;
dt_date[2]=i_year;
if(b_correct_date==4 && (dt_date[0]>31 || dt_date[0]<1))
    {
b_correct_date=1;
alert("Illegal value for date" );
    }
if(b_correct_date==4 && (dt_date[1]>12 || dt_date[1]<1))
    {
b_correct_date=2;
alert('Illegal value for month');
    }
if(b_correct_date==4 && dt_date[2]<=0)
    {
b_correct_date=3;
alert('Illegal value for year');
    }
if(b_correct_date==4 && ((dt_date[1]==1 || dt_date[1]==3 || dt_date[1]==5 || dt_date[1]==7 || dt_date[1]==8 || dt_date[1]==10 ||dt_date[1]==12) && (dt_date[0]>31 || dt_date[0]<1)))
    {
b_correct_date=1;
alert('Illegal value for date.MonthName and date mismatch');
    }
if(b_correct_date==4 && ((dt_date[1]==4 || dt_date[1]==6 || dt_date[1]==9 || dt_date[1]==11) && (dt_date[0]>30 || dt_date[0]<1)))
    {
b_correct_date=1;
alert('Illegal value for date.Monthname and date mismatch');
    }
var i_year;
i_year=dt_date[2];
if((i_year % 400)>0)
    {
if((i_year % 100)>0 && (i_year % 4)==0) //leap year
{
if(b_correct_date==4 && dt_date[1]==2 && dt_date[0]>29)
{
b_correct_date=1;
alert('Illegal value for date.In that year, February cannot have that day.');
}
}
else
{
if(b_correct_date==4 && dt_date[1]==2 && dt_date[0]>28)
{
b_correct_date=1;
alert('Illegal value for date.In that year, February cannot have that day.');
}
}
    }
else
    {
if(b_correct_date==4 && dt_date[1]==2 && dt_date[0]>29)
{
b_correct_date=1;
alert('Illegal value for date.In that year, February cannot have that day.');
}
    }
return b_correct_date;
}

function func_is_url(param_url)
{
var str_url=new String(func_trim(param_url));
b_correct_length_extension=1;
var i_length=str_url.length;
var str_prefix=str_url.slice(7);
b_period_present=1;
b_correct_length_extension=1;
var i_loop;
if(str_prefix.toLowerCase()=="http://" && str_url.length==7)
    {
return false;
    }

for(i_loop=0; i_loop    {
if(!((str_url.charCodeAt(i_loop)>=65 && str_url.charCodeAt(i_loop)<=90)
|| (str_url.charCodeAt(i_loop)>=97 && str_url.charCodeAt(i_loop)<=122)
|| (str_url.charCodeAt(i_loop)>=48 && str_url.charCodeAt(i_loop)<=57)
|| (str_url.charAt(i_loop)=="/")
|| (str_url.charAt(i_loop)==":")
|| (str_url.charAt(i_loop)=="_")
|| (str_url.charAt(i_loop)=="-")
|| (str_url.charAt(i_loop)==".")))
{
return false;
}
    }

var i_pos_consecutive_dots=str_url.indexOf('..');
if(i_pos_consecutive_dots!=-1)
    {
return false;
    }

var i_pos_space;
i_pos_space = str_url.indexOf(' ');
if(i_pos_space!=-1)
    {
return false;
    }

var i_last_position_of_period = str_url.lastIndexOf('.');
if(i_last_position_of_period<=0)
    {
b_period_present=0;
    }

if(((i_length-i_last_position_of_period)>4) || ((i_length-i_last_position_of_period)<3))
    {
b_correct_length_extension=0;
    }

if((b_period_present==0) || (b_correct_length_extension==0))
    {
return false;
    }

return true;
}

function func_is_combo_selected(obj_combo)
{
var i_loop;
if(obj_combo.selectedIndex>0 && obj_combo.options[obj_combo.selectedIndex].value!="")
    {
return true;
    }
else
    {
return false;
    }
}

function func_is_option_selected(obj_radio)
{
var i_loop;
for (i_loop=0; i_loop    {
if ((obj_radio[i_loop].checked) && (obj_radio[i_loop].value != ""))
{
return true;
}
    }
return false;
}

function func_start()
{

}

//select All checkboxes starting with..
function func_select_all_checkboxes(str_form_name,str_search_chars,str_select_all)
{
var obj_form=eval("document." + str_form_name);
for(var i=0; i    {
if(obj_form.elements[i].type == "checkbox")
{
var str_checkbox_name = new String(obj_form.elements[i].name);
if(str_checkbox_name.indexOf(str_search_chars) != -1)
{
var obj_checkbox = eval("document." + str_form_name + "." + str_checkbox_name);
if(eval("document." + str_form_name + "." + str_select_all + ".checked")==true)
obj_checkbox.checked = true;
else
obj_checkbox.checked = false;
}
}
    }
}

//unselect the checkbox named "ALL" when any one of the other checkboxe(s) unselected.
function func_unselect_checkbox(str_form_name,str_search_chars,str_select_all)
{
var b_correct=true;
var obj_form=eval("document." + str_form_name);
for(var i=0; i    {
if(obj_form.elements[i].type == "checkbox")
{
var str_checkbox_name = new String(obj_form.elements[i].name);
if(str_checkbox_name.indexOf(str_search_chars) != -1)
{
var obj_checkbox = eval("document." + str_form_name + "." + str_checkbox_name);
if(obj_checkbox.checked==false)
b_correct=false;
}
}
    }
var obj_checkbox_all=eval("document." + str_form_name + "." + str_select_all);
if (obj_checkbox_all != null)
    {
if(b_correct)
obj_checkbox_all.checked=true;
else
obj_checkbox_all.checked=false;
    }
}

//selected checkbox values are stored in the hidden field with "," as delimiter
function func_store_selected_checkboxes(str_form_name,str_hidden_name,str_search_chars)
{
var obj_form=eval("document." + str_form_name);
var obj_hidden=eval("document." + str_form_name + "." + str_hidden_name);
var i_length=str_search_chars.length;
eval("document." + str_form_name + "." + str_hidden_name).value="";
for(var iLoop=0;iLoop    {
if(obj_form.elements[iLoop].type=="checkbox")
{
var str_checkbox_name=new String(obj_form.elements[iLoop].name);
if(str_checkbox_name.slice(0,i_length)==str_search_chars)
{
if(obj_form.elements[iLoop].checked==true)
{
obj_hidden.value+=(obj_hidden.value=="") ? str_checkbox_name.slice(i_length) : ("," + str_checkbox_name.slice(i_length));
}
}
}
    }
//alert(obj_hidden.value);
}

function func_is_checkbox_selected(obj_form,str_checkbox_prefix)
{
var b_correct=false;
for(var i=0; i    {
var str_name=obj_form.elements[i].name;
var str_type=obj_form.elements[i].type;
if((str_type=="checkbox") && (str_name.indexOf(str_checkbox_prefix)!=-1))
{
var b_checked=obj_form.elements[i].checked;
if(b_checked==true)
{
b_correct = true;
break;
}
}
    }
return b_correct;
}

function invalidemail(y)
{
var len = y.length;
if (len < 1)
    {
return true;
    }
var i = 0;
for (i=0; i    {
if (!((y.charCodeAt(i) >= 65 && y.charCodeAt(i) <= 90)
|| (y.charCodeAt(i) >= 97 && y.charCodeAt(i) <= 122)
|| (y.charCodeAt(i) >= 48 && y.charCodeAt(i) <= 57)
|| (y.charAt(i) == "@")
|| (y.charAt(i) == "_")
|| (y.charAt(i) == ".")))
{
return true;
}
    }
var at = y.indexOf("@");
if (at < 0)
    {
return true;
    }
i = 0;
var dot;
dot = y.indexOf(".", at);
if (!(dot > 1))
    {
return true;
    }
return false;
}

function isValidURL(strText)
{
var bcorrect=true;
if(bcorrect && isNull(strText))
    {
return true;
    }
if(bcorrect && strText.indexOf("/")!=-1)
    {
strText=strText.substring(0,strText.indexOf("/"));
    }

var len = strText.length;

//validate the characters allowed
if(bcorrect)
    {
var i = 0;
for (i=0; i {
if (!((strText.charCodeAt(i) >= 65 && strText.charCodeAt(i) <= 90)
|| (strText.charCodeAt(i) >= 97 && strText.charCodeAt(i) <= 122)
|| (strText.charCodeAt(i) >= 48 && strText.charCodeAt(i) <= 57)
|| (strText.charAt(i) == "-")
|| (strText.charAt(i) == "_")
|| (strText.charAt(i) == ".")))
{
bcorrect=false;
}
}
    }

if(bcorrect && strText.indexOf("..")!=-1)
bcorrect=false;
if(bcorrect && strText.indexOf("-")==0)
bcorrect=false;
if(bcorrect && strText.indexOf("_")==0)
bcorrect=false;
if(bcorrect && strText.indexOf(".")==0)
bcorrect=false;
if(bcorrect && strText.indexOf(".")==-1)
bcorrect=false;

//validate last index of '.' and number of chars next to that
if(bcorrect)
    {
var iLastPos=strText.lastIndexOf('.');
var iMinChar=len - iLastPos;
if(iMinChar<3 || iMinChar>5)
bcorrect=false;
    }

//validate extension
if(bcorrect)
    {
var strExtension=strText.substring(strText.lastIndexOf('.')+1);
if(!isAlphaNumeric(strExtension))
bcorrect=false;
    }
return bcorrect;
}

function isNotNumeric(n)
{
if (n == "")
    {
return true;
    }
var len = n.length;
var i = 0;
for (i=0; i    {
if (!((n.charCodeAt(i) >= 48) && (n.charCodeAt(i) <= 57)))
{
return true;
}
    }
return false;
}

function containsBlank(s)
{
var len = s.length;
for (i=0; i    {
if (s.charAt(i) == " ")
{
return true;
}
    }
return false;
}

function isBlank(StrText)
{
if (StrText.length < 0)
    {
return true;
    }
for (var i=0; i    {
if (StrText.charAt(i) != " ")
{
return false;
}
    }
return true;
}

function getSelectedOption(OItem)
{
var optionValue = "";
for (var i=0; i    {
if (OItem.options[i].selected == true)
{
optionValue = OItem.options[i].value;
return optionValue;
}
    }
}

function optionSelected(OItem)
{
for (var i=0; i    {
if ((OItem.options[i].selected == true) && (OItem.options[i].value != ""))
{
return true;
}
    }
return false;
}

function isValidDate(iYear, iMonth, iDay)
{
if (isNaN(iYear) || isNaN(iMonth) || isNaN(iDay))
    {
return false;
    }
var dtNewDate = new Date(iYear, (iMonth-1), iDay);
if ((parseInt(dtNewDate.getFullYear()) == iYear)
&& (parseInt(dtNewDate.getMonth()) == (iMonth-1))
&& (parseInt(dtNewDate.getDate()) == iDay))
{
return true;
}
return false;
}

//Returns true if "text" is alphanumeric
function isAlphaNumeric(text)
{
var str = new String(text);
for (var i=0;i    {
if (!((str.charCodeAt(i)>=65 && str.charCodeAt(i)<=90) || (str.charCodeAt(i)>=97 && str.charCodeAt(i)<=122) || (str.charCodeAt(i)>=48 && str.charCodeAt(i)<=57)))
{
return false;
}
}
return true;
}

// returns true if the given text is Null
function isNull(text)
{
if((trim(text) == "") || (text == null))
    {
//alert("Must not be Null Sring");
return true;
    }
else
    {
return false;
    }
}

// returns true if length of the text is greater than given num.
function isMaxLength(text,num)
{
var strlen;
var text=new String(text);
strlen = len(text);
if (strlen > num)
    {
//alert(" Must not be greater than maximum " + num + " characters ");
return true;
    }
else
    {
return false;
    }
}

// returns true if length of the text is less than given value.
function isMinLength(text,num)
{
var strlen;
var text=new String(text);
strlen = len(text);
if (strlen < num)
    {
//alert(" Must not be Less than minimum " + num + " characters ");
return true;
    }
else
    {
return false;
    }
}

// returns true if the text is Number and false if it is not a number.
function isNumber(text)
{
var ilen;
var bflagNum=true;
var text=new String(text);
if (isNaN(text))
    {
return false;
    }
else
    {
return true;
    }
}

// returns true if valid Email.
function isEmail(emailval)
{
var tempStr,icount;
var blnmail,blnperiod;
var lastoccofperiod,maxthree;
var ampicount=0;
var amppos;
var servername = 1;
var dots;
icount=emailval.length;
blnperiod = 1;
maxthree = 1;
specialchar = 0
lastoccofperiod = 0;
if (icount==0)
    {
return true;
    }
for(i=0;i    {
tempStr = emailval.charAt(i);
if ((tempStr >='a')&&(tempStr <='z'))
{
specialchar=specialchar+1;
}
else
    {
if ((tempStr >='A')&&(tempStr <='Z'))
{
specialchar=specialchar+1;
}
else
{
if ((tempStr >= 0)&&(tempStr<=9))
{
specialchar=specialchar+1;
}
else
{
if ((tempStr=='_')||(tempStr=='-')||(tempStr=='.')||(tempStr=='@'))
{
specialchar=specialchar+1;
}
else
{
return false;
}
}
}
}
    }
dots = emailval.indexOf('..');
if (dots != -1)
    {
return false;
    }
espace = emailval.indexOf(' ');
if (espace != -1)
    {
return false;
    }
lastoccofperiod = emailval.lastIndexOf('.');
if (lastoccofperiod <= 0)
    {
blnperiod = 0;
    }
if (((icount - lastoccofperiod) > 4)||((icount - lastoccofperiod) < 3))
    {
maxthree = 0;
    }
for(i=0;i<=icount;i++)
    {
tempStr = emailval.charAt(i)
if (tempStr=='@')
ampicount=ampicount + 1;
    }
amppos = emailval.indexOf('@');
if (emailval.charAt(amppos+1) == '.')
servername = 0;
if(icount - emailval.charAt(amppos)< 5)
servername = 0;
if ((ampicount==1)&&(blnperiod==1)&&(maxthree==1)&&(servername==1))
    {
blnmail=1;
    }
else
    {
blnmail=0;
    }
//return blnmail;
if (blnmail==0)
    {
//alert('Please enter a valid email address');
return false;
    }
else
    {
return true;
    }
}

//returns true if the text carries only alphabets.
function isAlphabetic(textval)
{
var text=new String(textval);
var ilen;
var bflag=true;
for(ilen=0;ilen<=text.length;ilen++)
    {
if(text.charCodeAt(ilen) < 65 || text.charCodeAt(ilen) > 90 && text.charCodeAt(ilen) < 97 || text.charCodeAt(ilen) > 122)
{
bflag=false;
}
    }
return bflag;
}

function isCurrency(text)
{
var bflag=true;
if(text != "")
    {
var k = len(text);
var i;
for (i=0; i {
if (!((text.charCodeAt(i) >= 48 && text.charCodeAt(i) <= 57) || (text.charAt(i) == ".")))
{
bflag=false;
}
}
    }
return bflag;
}
//isTelephoneNumber -returns true if it is valid Telephone or Fax Number.allowing +-.()
function isTelephoneNumber(text)
{
var bflag=true;
if(text != "")
    {
var k = len(text);
var i;
for (i=0; i {
if (!((text.charCodeAt(i) >= 48 && text.charCodeAt(i) <= 57) || (text.charAt(i) == "-")|| (text.charAt(i) == "(")|| (text.charAt(i) == ")") || (text.charAt(i) == "+") || (text.charAt(i) == ".")|| (text.charAt(i) == " ")))
{
bflag=false;
}
}
    }
return bflag;
}

//returns true if it is valid date.
function isDate(date,month,year)
{
var bflag=true;
if (isNaN(year) || isNaN(month) || isNaN(date))
    {
bflag=false;
    }
if(bflag)
    {
var dtnew = new Date(year,month-1,date);
if ((parseInt(dtnew.getFullYear()) == year) && (parseInt(dtnew.getMonth()) == (month-1)) && (parseInt(dtnew.getDate()) == date))
{
bflag=true;
}
else
{
bflag=false;
}
    }
return bflag;
}

//returns string by removing whitespaces from both the ends.
function trim(text)
{
var stext = new String(text);
var sresult = "";
//Remove leading spaces
for (var i=0; i    {
if (stext.charAt(i) != " ")
{
sresult = stext.substr(i, (stext.length - i));
break;
}
    }
stext = sresult;
//Remove trailing spaces
for (var j=(stext.length - 1); j>=0; j--)
    {
if (stext.charAt(j) != " ")
{
sresult = stext.substr(0, (j + 1));
break;
}
    }
return sresult;
}

// returns length of the text
function len(text)
{
var strText=new String(text);
return strText.length;
}

// selecting & focusing on the element that holds incorrect value
function selectFocus(element)
{
element.select();
element.focus();
return true;
}

//returns true if a radio button is checked
function IsRadioChecked(objForm,strName)
{
var bcorrect;
bcorrect=false;
for(i=0; i    {
var name=objForm.elements[i].name;
var type=objForm.elements[i].type;
if((type=="radio") && (name.indexOf(strName)!=-1))
{
var val=objForm.elements[i].checked;
if(val==true)
{
bcorrect=true;
break;
}
}
    }
return bcorrect;
}

//returns true if atleast one check box is selected
function IsCheckboxSelected(objForm,strName)
{
var bcorrect=false;
for(var i=0; i    {
var name=objForm.elements[i].name;
var type=objForm.elements[i].type;
if((type=="checkbox") && (name.indexOf(strName)!=-1))
{
var val=objForm.elements[i].checked;
if(val==true)
{
bcorrect = true;
break;
}
}
    }
return bcorrect;
}

/* Validation functions ends here. */






/* HTML Element Validation functions starts here..... */

//HTML Element "Text box" validations (includes text area also.)
function ValidateTextBox(strName,obj,bZeroLength,iMaxChars,bAlphabet,bNumeric,bAlphanumeric,bEmail,bTelNumber,bURL,bFile,strFileType,bCurrency)
{
var bCorrect=true;

//Zerolength validation is optional, if bZeroLength is true then textbox value is checked for zerolength.
if(bCorrect && bZeroLength)
    {
if(isNull(obj.value))
{
bCorrect=false;
alert("Please enter the " + strName);
selectFocus(obj);
}
    }

//MaxLength is not optional
if(bCorrect)
    {
if(isMaxLength(obj.value,iMaxChars))
{
bCorrect=false;
alert(strName + " is greater than " + iMaxChars + " characters.");
selectFocus(obj);
}
    }

//Alphabet validation is optional, if bAlphabet is true then textbox value is checked for Alphabets.
if(bCorrect && bAlphabet)
    {
if(!isAlphabetic(obj.value))
{
bCorrect=false;
alert(strName + " must have only alphabets.");
selectFocus(obj);
}
    }

//Numeric validation is optional, if bNumeric is true then textbox value is checked for Numeric.
if(bCorrect && bNumeric)
    {
if(!isNumber(obj.value))
{
bCorrect=false;
alert(strName + " must have only numbers.");
selectFocus(obj);
}
    }

//Alphanumeric validation is optional, if bAlphanumeric is true then textbox value is checked for Alphanumeric.
if(bCorrect && bAlphanumeric)
    {
if(!isAlphaNumeric(obj.value))
{
bCorrect=false;
alert(strName + " must have only alphanumeric characters.");
selectFocus(obj);
}
    }

//Email validation is optional, if bEmail is true then textbox value is checked for Email.
if(bCorrect && bEmail)
    {
if(!isEmail(obj.value))
{
bCorrect=false;
alert(strName + " entered is not a valid email address.");
selectFocus(obj);
}
    }

//TelNumber validation is optional, if bTelNumber is true then textbox value is checked for TelNumber.
if(bCorrect && bTelNumber)
    {
if(!isTelephoneNumber(obj.value))
{
bCorrect=false;
alert(strName + " is not a valid telephone/fax number.");
selectFocus(obj);
}
    }

//URL validation is optional, if bURL is true then textbox value is checked for URL.
if(bCorrect && bURL)
    {
if(!isValidURL(obj.value))
{
bCorrect=false;
alert(strName + " is not a valid URL.");
selectFocus(obj);
}
    }
if(bCorrect && bFile)
    {
if(!isFile(obj.value,strFileType))
{
bCorrect=false;
alert(strName + " is not a valid File Type.");
selectFocus(obj);
}
    }
if(bCorrect && bCurrency)
    {
if(!isCurrency(obj.value))
{
bCorrect=false;
alert(strName + " is not a valid number.");
selectFocus(obj);
}
    }
return bCorrect;
}


//HTML Element "Drop-down list" validations
function ValidateDropdownList(strName,obj,bSelect,iMaxChars)
{
var bCorrect=true;

//Select validation is optional, if bSelect is true then textbox value is checked for Selection.
if(bCorrect && bSelect)
    {
if(getSelectedOption(obj)=="")
{
bCorrect=false;
alert(strName + " is not selected.");
obj.focus();
}
    }

//MaxLength is not optional
if(bCorrect)
    {
if(isMaxLength(getSelectedOption(obj),iMaxChars))
{
bCorrect=false;
alert(strName + " is greater than " + iMaxChars + " characters.");
obj.focus();
}
    }

return bCorrect;
}

//HTML Element "Radio button" validations
function ValidateRadioButton(strLabel,strRadioName,objForm,bChecked)
{
var bCorrect=true;

//Radio button validation is optional, if bChecked is true then it is checked for Selection.
if(bCorrect && bChecked)
    {
if(!IsRadioChecked(objForm,strRadioName))
{
bCorrect=false;
alert(strLabel + " is not selected.");
}
    }
return bCorrect;
}

//HTML Element "Check box" validations
function ValidateCheckBox(strLabel,strCheckBoxName,objForm,bChecked)
{
var bCorrect=true;

//Check box validation is optional, if bChecked is true then it is checked for Selection.
if(bCorrect && bChecked)
    {
if(!IsCheckboxSelected(objForm,strCheckBoxName))
{
bCorrect=false;
alert(strLabel + " is not selected.");
}
    }
return bCorrect;
}

// validate date box.
function ValidateDateBox(strLabel,obj,iMonth,iDay,iYear,bSelected,bFutureDate,bPastDate)
{
var bcorrect=true;
if(bSelected)
    {
if(bcorrect && !isDate(iDay,iMonth,iYear))
{
bcorrect=false;
alert("Please select a valid " + strLabel + ".");
obj.focus();
}
    }
if(iDay!="" && iMonth!="" && iYear!="")
    {
if(bcorrect && !isDate(iDay,iMonth,iYear))
{
bcorrect=false;
alert("Please select a valid " + strLabel + ".");
obj.focus();
}
    }
if (bFutureDate)
    {
if(bcorrect)
{
var dtnew = new Date(iYear,iMonth-1,iDay);
var dtnow = new Date();
if(dtnew {
bcorrect=false;
alert("Please select a valid future date.");
obj.focus();
}
}
    }
if(bPastDate)
    {
if(bcorrect)
{
var dtnew = new Date(iYear,iMonth-1,iDay);
var dtnow = new Date();
if(dtnew>dtnow)
{
bcorrect=false;
alert("Please select a valid past date.");
obj.focus();
}
}
    }
return bcorrect;
}


//select All checkboxes starting with..
function SelectAllCheckBoxes(strFormName,strSearchChars,strSelectAll)
{
var objForm=eval("document." + strFormName);
for(var i=0; i    {
if(objForm.elements[i].type == "checkbox")
{
var strCheckBoxName = new String(objForm.elements[i].name);
if(strCheckBoxName.indexOf(strSearchChars) != -1)
{
var objCheckBox = eval("document." + strFormName + "." + strCheckBoxName);
if(eval("document." + strFormName + "." + strSelectAll + ".checked")==true)
objCheckBox.checked = true;
else
objCheckBox.checked = false;
}
}
    }
}

//unselect the checkbox named "ALL" when any one of the other checkboxe(s) unselected.
function UnSelectCheckBox(strFormName,strSearchChars,strSelectAll)
{
var bcheckbox=true;
var objForm=eval("document." + strFormName);
for(var i=0; i    {
if(objForm.elements[i].type == "checkbox")
{
var strCheckBoxName = new String(objForm.elements[i].name);
if(strCheckBoxName.indexOf(strSearchChars) != -1)
{
var objCheckBox = eval("document." + strFormName + "." + strCheckBoxName);
if(objCheckBox.checked==false)
bcheckbox=false;
}
}
    }
var objCheckBoxAll=eval("document." + strFormName + "." + strSelectAll);
if (objCheckBoxAll != null)
    {
if(bcheckbox)
objCheckBoxAll.checked=true;
else
objCheckBoxAll.checked=false;
    }
}

//selected checkbox values are stored in the hidden field with "," as delimiter
function StoreSelectedCheckBoxes(strFormName,strHiddenName,strSearchChars)
{
var objForm=eval("document." + strFormName);
var objHidden=eval("document." + strFormName + "." + strHiddenName);
var iLen=strSearchChars.length;
eval("document." + strFormName + "." + strHiddenName).value="";
for(var iLoop=0;iLoop {
if(objForm.elements[iLoop].type=="checkbox")
{
var strCheckBoxName=new String(objForm.elements[iLoop].name);
if(strCheckBoxName.slice(0,iLen)==strSearchChars)
{
if(objForm.elements[iLoop].checked==true)
{
objHidden.value+=(objHidden.value=="") ? strCheckBoxName.slice(iLen) : ("," + strCheckBoxName.slice(iLen));
}
}
}
    }
//alert(objHidden.value);
}

//Checks whether file type is ends with specified extension or not

function isFile(strValue,strFileType)
{
var bCorrect=false;
strImage=new String(strValue);
var bHtml=false;
var bAll=false;
var bImage=false;
if(strValue.length==0)
    {
return true;
    }
if(strFileType.toLowerCase()=="htm" || strFileType.toLowerCase()=="html")
    {
bHtml=true;
    }
if(strFileType.toLowerCase()=="all")
    {
bAll=true;
    }
if(strFileType.toLowerCase()=="img")
    {
bImage=true;
    }
if(strImage.indexOf(".")!=-1)
    {
iIndex=strImage.indexOf(".");
if(bAll==true)
{
strFile=strImage.substring(iIndex+1);
if(strFile.length>=2)
{
bCorrect=true;
return bCorrect;

}
else
{
bCorrect=false;
return bCorrect;

}
}
else if(bImage==true)
{
if((strImage.substring(iIndex+1)).toLowerCase()=="gif" || (strImage.substring(iIndex+1)).toLowerCase()=="jpg" || (strImage.substring(iIndex+1)).toLowerCase()=="jpeg" || (strImage.substring(iIndex+1)).toLowerCase()=="bmp")
{
bCorrect=true;
return bCorrect;

}
else
{
bCorrect=false;
return bCorrect;

}
}
else if(bHtml==true)
{
if((strImage.substring(iIndex+1)).toLowerCase()=="htm" || (strImage.substring(iIndex+1)).toLowerCase()=="html")
{
bCorrect=true;
return bCorrect;

}
else
{
bCorrect=false;
return bCorrect;

}
}
else
{
if((strImage.substring(iIndex+1)).toLowerCase()==strFileType.toLowerCase())
{
bCorrect=true;
return bCorrect;

}
else
{
bCorrect=false;
return bCorrect;

}
}
    }
else
    {
bCorrect=false;
return bCorrect;
    }
}

function func_popup_open(url)
{
var win_popup = window.open(url, "window", "title=Order Details ,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=850,height=500,left=0,top=0");
}


function func_popup(url,i_width,i_height)
{
var winLeft;
var winTop;
winLeft = (screen.i_width-150)/2;
winTop = (screen.i_height-(-250+110))/2;

var win_popup = window.open(url, "window", "title=HoustonPets ,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width="+i_width+",height="+i_height+",left="+winLeft+",top="+winTop);
}



var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
var i;
for (i = 0; i < s.length; i++){
// Check that current character is number.
var c = s.charAt(i);
if (((c < "0") || (c > "9"))) return false;
}
// All characters are numbers.
return true;
}

function stripCharsInBag(s, bag){
var i;
var returnString = "";
// Search through string's characters one by one.
// If character is not in bag, append to returnString.
for (i = 0; i < s.length; i++){
var c = s.charAt(i);
if (bag.indexOf(c) == -1) returnString += c;
}
return returnString;
}

function daysInFebruary (year){
// February has 29 days in any year evenly divisible by four,
// EXCEPT for centurial years which are not also divisible by 400.
return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
for (var i = 1; i <= n; i++) {
this[i] = 31
if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
if (i==2) {this[i] = 29}
}
return this
}

function is_Date(dtStr)
{
var daysInMonth = DaysArray(12)
var pos1=dtStr.indexOf(dtCh)
var pos2=dtStr.indexOf(dtCh,pos1+1)
var strMonth=dtStr.substring(0,pos1)
var strDay=dtStr.substring(pos1+1,pos2)
var strYear=dtStr.substring(pos2+1)
strYr=strYear
if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
for (var i = 1; i <= 3; i++) {
if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
    }
month=parseInt(strMonth)
day=parseInt(strDay)
year=parseInt(strYr)
if (pos1==-1 || pos2==-1){
alert("The date format should be : mm/dd/yyyy")
return false
    }
if (strMonth.length<1 || month<1 || month>12){
alert("Please enter a valid month")
return false
    }
if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
alert("Please enter a valid day")
return false
    }
if (strYear.length != 4 || year==0 || yearmaxYear){
alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
return false
    }
if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
alert("Please enter a valid date")
return false
    }
return true
}