اين حالتfade تو سايتهاي ناك چجوريه؟

mosi-online

Member
سلام بچه ها من يه سوالي داشتم كه اين حالت رو چجوري تو سايتهاي ناك درست ميكنند
كه موس ميره رو عكس بعد توضيحش مياد پايين به اين قشنگي :?: :arrow: ؟
يه توضيح خوب و دقيق بديد ممنون ميشم.
majidoffline.jpg

8O
 

izone

Active Member
اين پرسش قبلا از سوي آرا مطرح شده ولي پاسخ كاملي دريافت نشد (تا اونجا كه من ميدونم).

براي اينكار از جاوااسكريپت استفاده ميكنند.
 

pooyait

Member
اين اسكريپت جاواشه
فقط بايد اونو بين كدهاي اچ تي ام ال صفحه مورد نظر كپي كني و جاي عكس رو عوض كني


<SCRIPT language=javascript type=text/javascript>
function storeCaret(textEl) {
if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();

}
var lang = 1; // 1: Farsi, 0: English

// Farsi keyboard map based on ISIRI-2901
var farsikey = [
0x0020, 0x0021, 0x061B, 0x066B, 0x00A4, 0x066A, 0x060C, 0x06AF,
0x0029, 0x0028, 0x002A, 0x002B, 0x0648, 0x002D, 0x002E, 0x002F,
0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
0x0038, 0x0039, 0x003A, 0x0643, 0x003E, 0x003D, 0x003C, 0x061F,
0x066C, 0x0624, 0x200C, 0x0698, 0x0649, 0x064D, 0x0625, 0x0623,
0x0622, 0x0651, 0x0629, 0x00BB, 0x00AB, 0x0621, 0x004E, 0x005D,
0x005B, 0x0652, 0x064B, 0x0626, 0x064F, 0x064E, 0x0056, 0x064C,
0x0058, 0x0650, 0x0643, 0x062C, 0x005C, 0x0686, 0x00D7, 0x0640,
0x200D, 0x0634, 0x0630, 0x0632, 0x064A, 0x062B, 0x0628, 0x0644,
0x0627, 0x0647, 0x062A, 0x0646, 0x0645, 0x067E, 0x062F, 0x062E,
0x062D, 0x0636, 0x0642, 0x0633, 0x0641, 0x0639, 0x0631, 0x0635,
0x0637, 0x063A, 0x0638, 0x007D, 0x007C, 0x007B, 0x007E ];


function changeLang() {
if (lang == 0) {
lang = 1;
return true;
}
else {
lang = 0;
return true;
}
}

function FKeyDown (txtFrm){
var key = window.event.keyCode;
if (key == 145){
if (lang == 0) {
lang = 1;
return true;
}
else {
lang = 0;
return true;
}

}

}
function FKeyPress(txtFrm) {
var key = window.event.keyCode;

if (key == 13) { window.event.keyCode = 13; return true; }

if (lang == 1) { // If Farsi
if (key == 0x0020 && window.event.shiftKey) // Shift-space -> ZWNJ
window.event.keyCode = 0x200C;
else
window.event.keyCode = farsikey[key - 0x0020];
if (farsikey[key - 0x0020] == 92) {
window.event.keyCode = 0x0698;
}
if (farsikey[key - 0x0020] == 8205) {
window.event.keyCode = 0x067E;
}
}
return true;
}

function change(obj){
if (lang==0)
lang=1
else
lang=0;
obj.focus();
}
</SCRIPT>

<script language="JavaScript1.2">

//Gradual-Highlight image script- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use

function high(which2){
theobject=which2
highlighting=setInterval("highlightit(theobject)",100)
}
function low(which2){
clearInterval(highlighting)
if (which2.style.MozOpacity)
which2.style.MozOpacity=0.3
else if (which2.filters)
which2.filters.alpha.opacity=30
}

function highlightit(cur2){
if (cur2.style.MozOpacity<1)
cur2.style.MozOpacity=parseFloat(cur2.style.MozOpacity)+0.1
else if (cur2.filters&&cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=10
else if (window.highlighting)
clearInterval(highlighting)
}

</script>

<body>

<p align="center">
<span lang="FA" dir="RTL" style="font-family: Tahoma">
<font color="#FFFFFF"><span style="font-size: 12pt; font-weight: 700">
<a target="_top" href="file:///D:/Documents%20and%20Settings/S.M.Majidi/Desktop/pooya/Web%20Site/My%20Webpooya/connect.htm">
<img border="0" src="file:******************************" style="filter:alpha(opacity=30);-moz-opacity:0.3" onMouseover="high(this)" onMouseout="low(this)" width="439" height="225"></a></span></font></span></p>



به جاي * ها بايد لينك عكس رو بگذاري!
موفق باشي
 

izone

Active Member
Jasem گفت:
بچه ها ميشه اين رو با nuketools تبديل به يك بلوك كرد ؟؟؟

جاسم جان من اينكار را كردم ولي هنوز آزمايش نكردم.

کد:
<?php
#### Generated by Block Creator by Disipal Site ([url]www.disipal.net)[/url] ###
if (eregi("block-Block_Creator.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}
$content  =  "<SCRIPT language=javascript type=text/javascript> ";
$content  .= "function storeCaret(textEl) { ";
$content  .= "if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate(); ";
$content  .= "";
$content  .= "} ";
$content  .= "var lang = 1; // 1: Farsi, 0: English ";
$content  .= "";
$content  .= "// Farsi keyboard map based on ISIRI-2901 ";
$content  .= "var farsikey = [ ";
$content  .= "0x0020, 0x0021, 0x061B, 0x066B, 0x00A4, 0x066A, 0x060C, 0x06AF, ";
$content  .= "0x0029, 0x0028, 0x002A, 0x002B, 0x0648, 0x002D, 0x002E, 0x002F, ";
$content  .= "0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, ";
$content  .= "0x0038, 0x0039, 0x003A, 0x0643, 0x003E, 0x003D, 0x003C, 0x061F, ";
$content  .= "0x066C, 0x0624, 0x200C, 0x0698, 0x0649, 0x064D, 0x0625, 0x0623, ";
$content  .= "0x0622, 0x0651, 0x0629, 0x00BB, 0x00AB, 0x0621, 0x004E, 0x005D, ";
$content  .= "0x005B, 0x0652, 0x064B, 0x0626, 0x064F, 0x064E, 0x0056, 0x064C, ";
$content  .= "0x0058, 0x0650, 0x0643, 0x062C, 0x005C, 0x0686, 0x00D7, 0x0640, ";
$content  .= "0x200D, 0x0634, 0x0630, 0x0632, 0x064A, 0x062B, 0x0628, 0x0644, ";
$content  .= "0x0627, 0x0647, 0x062A, 0x0646, 0x0645, 0x067E, 0x062F, 0x062E, ";
$content  .= "0x062D, 0x0636, 0x0642, 0x0633, 0x0641, 0x0639, 0x0631, 0x0635, ";
$content  .= "0x0637, 0x063A, 0x0638, 0x007D, 0x007C, 0x007B, 0x007E ]; ";
$content  .= "";
$content  .= "";
$content  .= "function changeLang() { ";
$content  .= "if (lang == 0) { ";
$content  .= "lang = 1; ";
$content  .= "return true; ";
$content  .= "} ";
$content  .= "else { ";
$content  .= "lang = 0; ";
$content  .= "return true; ";
$content  .= "} ";
$content  .= "} ";
$content  .= "";
$content  .= "function FKeyDown (txtFrm){ ";
$content  .= "var key = window.event.keyCode; ";
$content  .= "if (key == 145){ ";
$content  .= "if (lang == 0) { ";
$content  .= "lang = 1; ";
$content  .= "return true; ";
$content  .= "} ";
$content  .= "else { ";
$content  .= "lang = 0; ";
$content  .= "return true; ";
$content  .= "} ";
$content  .= "";
$content  .= "} ";
$content  .= "";
$content  .= "} ";
$content  .= "function FKeyPress(txtFrm) { ";
$content  .= "var key = window.event.keyCode; ";
$content  .= "";
$content  .= "if (key == 13) { window.event.keyCode = 13; return true; } ";
$content  .= "";
$content  .= "if (lang == 1) { // If Farsi ";
$content  .= "if (key == 0x0020 && window.event.shiftKey) // Shift-space -> ZWNJ ";
$content  .= "window.event.keyCode = 0x200C; ";
$content  .= "else ";
$content  .= "window.event.keyCode = farsikey[key - 0x0020]; ";
$content  .= "if (farsikey[key - 0x0020] == 92) { ";
$content  .= "window.event.keyCode = 0x0698; ";
$content  .= "} ";
$content  .= "if (farsikey[key - 0x0020] == 8205) { ";
$content  .= "window.event.keyCode = 0x067E; ";
$content  .= "} ";
$content  .= "} ";
$content  .= "return true; ";
$content  .= "} ";
$content  .= "";
$content  .= "function change(obj){ ";
$content  .= "if (lang==0) ";
$content  .= "lang=1 ";
$content  .= "else ";
$content  .= "lang=0; ";
$content  .= "obj.focus(); ";
$content  .= "} ";
$content  .= "</SCRIPT> ";
$content  .= "";
$content  .= "<script language=\"JavaScript1.2\"> ";
$content  .= "";
$content  .= "//Gradual-Highlight image script- By Dynamic Drive ";
$content  .= "//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com ";
$content  .= "//This credit MUST stay intact for use ";
$content  .= "";
$content  .= "function high(which2){ ";
$content  .= "theobject=which2 ";
$content  .= "highlighting=setInterval(\"highlightit(theobject)\",100) ";
$content  .= "} ";
$content  .= "function low(which2){ ";
$content  .= "clearInterval(highlighting) ";
$content  .= "if (which2.style.MozOpacity) ";
$content  .= "which2.style.MozOpacity=0.3 ";
$content  .= "else if (which2.filters) ";
$content  .= "which2.filters.alpha.opacity=30 ";
$content  .= "} ";
$content  .= "";
$content  .= "function highlightit(cur2){ ";
$content  .= "if (cur2.style.MozOpacity<1) ";
$content  .= "cur2.style.MozOpacity=parseFloat(cur2.style.MozOpacity)+0.1 ";
$content  .= "else if (cur2.filters&&cur2.filters.alpha.opacity<100) ";
$content  .= "cur2.filters.alpha.opacity+=10 ";
$content  .= "else if (window.highlighting) ";
$content  .= "clearInterval(highlighting) ";
$content  .= "} ";
$content  .= "";
$content  .= "</script> ";
$content  .= "";
$content  .= "<body> ";
$content  .= "";
$content  .= "<p align=\"center\"> ";
$content  .= "<span lang=\"FA\" dir=\"RTL\" style=\"font-family: Tahoma\"> ";
$content  .= "<font color=\"#FFFFFF\"><span style=\"font-size: 12pt; font-weight: 700\"> ";
$content  .= "<a target=\"_top\" href=\"file:///D:/Documents%20and%20Settings/S.M.Majidi/Desktop/pooya/Web%20Site/My%20Webpooya/connect.htm\"> ";
$content  .= "<img border=\"0\" src=\"file:******************************\" style=\"filter:alpha(opacity=30);-moz-opacity:0.3\" onMouseover=\"high(this)\" onMouseout=\"low(this)\" width=\"439\" height=\"225\"></a></span></font></span></p> ";
$content  .= "
?>
 

Jasem

Member
ممنون الان امتحان مي كنم .
حتماْ مثل هميشه عاليه .
فقط از طرفي هم بايد بك قسمت مديريت براش گذاشت كه بشه آدرسها رو دستي وارد كرد .
فكر كنم مثل يك ماژول كاملتر كار كنه ؟؟؟؟
 

sambol

Active Member
من قبلا نمونه اين رو بچه ها خواسته بودن گزاشتم مثل همينه به صورت html هستش
 

ara

Member
من كه نتونستم با اين كد ها كار كنم
كسي تونسته ؟؟؟
اگه آره بگه ما هم چي كار كنيم تا درست بشه
 

mosi-online

Member
ميگما‌ارا من از كد pooyait استفاده كردم.
وقتي صفحه مقالت رو با html ميدي بالا تو ناك اون كد هم اضافه ميكني بهش البته تو جاي معين....
افتاد الان؟
تو كدش به جاي ******بايد لينك عكس رو بزاري...
 

pooyait

Member
ببين
اين كد فقط براي عكس به كار ميره و اگه منظورتون براي كل صفحات هست اين كد كار نميده
ولي شايد بشه اون كدي كه كل صفحه رو فيد ميكنه گير آورد
بايد بگردم
 

mosi-online

Member
آهان آقا ما ميخواستيم مثل مجيد آنلاين همين عكسي كه گزاشتم از صفحه اول بعد از فيد شدن توضيحش هم بياد زيرش چيكار كنيم؟
 

pooyait

Member
اگه يكم فرانت پيج كار كرده باشي ميتوني اين كارو انجام بدي
خواستي ميتوني با آيدي ياهوي من تماس بگيري
sm_majidi_esf
 

guilanict

Member
عزیز اگر می خوای کل صفحه را فید کنی در واقع بین صفحات ترنزیشن قرار بدی می تونی در فایل متا تغییر بدهی.
 

pooyait

Member
سلام
من اسكريپت هاي كد صفحه اول سايت مجيد آن لاين رو براتون گذاشتم



<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="fa">
</head>

<SCRIPT language=Javascript type=text/javascript>
/*******************************************************************
*
* File : AnimatedFader.js
*
* Created : 2000/05/28
*
* Author : Roy Whittle ([email protected]) www.Roy.Whittle.com
*
* Purpose : To create fading text descriptions
*
* History
* Date Version Description
*
* 2000-05-28 1.0 Initial version. Based on the State Transition
* Diagram created for animated rollovers I
* modified the code to fade text.
* 2000-05-29 1.1 I did not follow the STD correctly and introduced
* a bug that left objects in the ON state.
* This is now corrected.
* 2000-06-07 1.2 Introduced a start colour so that the script
* can be used on different backgrounds.
* Change the var AnimationRunning and FrameInterval
* so they don't conflict with animate2.js
* 2000-08-09 1.3 Added Gecko ( Netscape 6 Preview Release 1 ) support
* - Ken workman [email protected]
* 2000-10-15 1.4 Modified to make Netscpe 6 (PR3) more efficient
* by just changing the color instead of replacing
* the whole content of the DIV.
***********************************************************************/
/*** Create some global variables ***/
var FadingObject = new Array();
var FadeRunning=false;
var FadeInterval=30;

/*******************************************************************************/
/*** These are the simplest HEX/DEC conversion routines I could come up with ***/
/*** I have seen a lot of fade routines that seem to make this a ***/
/*** very complex task. I am sure somene else must've had this idea ***/
/*******************************************************************************/
var hexDigit=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");
function dec2hex(dec)
{
return(hexDigit[dec>>4]+hexDigit[dec&15]);
}
function hex2dec(hex)
{
return(parseInt(hex,16))
}
/******************************************************************************************/

/***********************************************************
* Function : createFaderObject
*
* Parameters : theDiv - The name of the DIV in which to fade the text
* numSteps - The number of steps to use in the fade.
* startColor - The background colour of the page.
*
* Description : Creates an object that can hold the current
* state of the fade animation for a particular DIV
***********************************************************/
function createFaderObject(theDiv, numSteps, startColor)
{
if(!startColor)
startColor = "000000";

this.name = theDiv;
this.text = null;
this.color = "FFFFFF";
this.next_text = null;
this.next_color = null;
this.state = "OFF";
this.index = 0;
this.steps = numSteps;
this.r = hex2dec(startColor.slice(0,2));
this.g = hex2dec(startColor.slice(2,4));
this.b = hex2dec(startColor.slice(4,6));
}

/***********************************************************
* Function : FadingText
*
* Parameters : theDiv - The name of the DIV in which to fade the text
* numSteps - The number of steps to use in the fade.
*
* Description : Library function to be called from the main HTML.
* Creates an object that can hold the current
* state of the fade animation for a particular DIV
***********************************************************/
function FadingText(theDiv, numSteps, startColor)
{
FadingObject[theDiv] = new createFaderObject(theDiv, numSteps, startColor);
}
/*****************************************************************
* Function : start_fading
*
* Description : If the FadeAnimation loop is not currently running
* then it is started.
*****************************************************************/
function start_fading()
{
if(!FadeRunning)
FadeAnimation();
}
/*****************************************************************
* Function : set_text
*
* Description : In the new W3C DOM model we need only set the text
* once, after that we can just change the colour
*****************************************************************/
function set_text(f)
{
if(navigator.appName.indexOf("Netscape") != -1
&& document.getElementById)
{
var theElement = document.getElementById(f.name);
var newRange = document.createRange();
newRange.setStartBefore(theElement);
var strFrag = newRange.createContextualFragment(f.text);

while (theElement.hasChildNodes())
theElement.removeChild(theElement.lastChild);
theElement.appendChild(strFrag);
theElement.style.color="#"+f.startColor;
}
}
/*****************************************************************
*
* Function : getColor
*
* Parameters : f - the fade object for which to calculate the colour.
*
* Description: Calculates the color of the link depending on
* how far through the fade we are.
*
*****************************************************************/
function getColor(f)
{
var r=hex2dec(f.color.slice(0,2));
var g=hex2dec(f.color.slice(2,4));
var b=hex2dec(f.color.slice(4,6));

r2= Math.floor(f.r+(f.index*(r-f.r))/(f.steps) + .5);
g2= Math.floor(f.g+(f.index*(g-f.g))/(f.steps) + .5);
b2= Math.floor(f.b+(f.index*(b-f.b))/(f.steps) + .5);

return("#" + dec2hex(r2) + dec2hex(g2) + dec2hex(b2));
}
/*****************************************************************
*
* Function : setColor
*
* Parameters : fadeObj - The TextFader object to set
*
* Description: Gets the color of the text and writes it to
* the DIV.
*
*****************************************************************/
function setColor(fadeObj)
{
var theColor=getColor(fadeObj);
var str="<FONT COLOR="+ theColor + ">" + fadeObj.text + "</FONT>";
var theDiv=fadeObj.name;

//if IE 4+
if(document.all)
{
document.all[theDiv].innerHTML=str;
}
//else if NS 4
else if(document.layers)
{
document.nscontainer.document.layers[theDiv].document.write(str);
document.nscontainer.document.layers[theDiv].document.close();
}
//else if NS 6 (supports new DOM, may work in IE5) - see Website Abstraction for more info.
//http://www.wsabstract.com/javatutors/dynamiccontent4.shtml
else if (document.getElementById)
{
theElement = document.getElementById(theDiv);
theElement.style.color=theColor;
}

}
/*****************************************************************
*
* Function : fade_up
*
* Parameters : theDiv - The div in which to display the text
* newText - The text to display when faded in
* newColor- The color the text will be.
*
* Description: Depending on the current "state" of the fade
* this function will determine the new state and
* if neccessary, start the fade effect.
*
*****************************************************************/
function fade_up(theDiv, newText, newColor)
{
var f=FadingObject[theDiv];

if(newColor == null)
newColor="FFFFFF";

if(f.state == "OFF")
{
f.text = newText;
f.color = newColor;
f.state = "FADE_UP";
set_text(f);
start_fading();
}
else if( f.state == "FADE_UP_DOWN"
|| f.state == "FADE_DOWN"
|| f.state == "FADE_DOWN_UP")
{
if(newText == f.text)
f.state = "FADE_UP";
else
{
f.next_text = newText;
f.next_color = newColor;
f.state = "FADE_DOWN_UP";
}
}
}
/*****************************************************************
*
* Function : fade_down
*
* Parameters : theDiv - The div in which to display the text
*
* Description: Depending on the current "state" of the fade
* this function will determine the new state and
* if neccessary, start the fade effect.
*
*****************************************************************/
function fade_down(theDiv)
{
var f=FadingObject[theDiv];

if(f.state=="ON")
{
f.state="FADE_DOWN";
start_fading();
}
else if(f.state=="FADE_DOWN_UP")
{
f.state="FADE_DOWN";
f.next_text = null;
}
else if(f.state == "FADE_UP")
{
f.state="FADE_UP_DOWN";
}
}
/*******************************************************************
*
* Function : Animate
*
* Description : This function is based on the Animate function
* of animate.js (animated rollovers).
* Each fade object has a state. This function
* modifies each object and changes its state.
*****************************************************************/
function FadeAnimation()
{
FadeRunning = false;
for (var d in FadingObject)
{
var f=FadingObject[d];

if(f.state == "FADE_UP")
{
if(f.index < f.steps)
f.index++;
else
f.index = f.steps;
setColor(f);

if(f.index == f.steps)
f.state="ON";
else
FadeRunning = true;
}
else if(f.state == "FADE_UP_DOWN")
{
if(f.index < f.steps)
f.index++;
else
f.index = f.steps;
setColor(f);

if(f.index == f.steps)
f.state="FADE_DOWN";
FadeRunning = true;
}
else if(f.state == "FADE_DOWN")
{
if(f.index > 0)
f.index--;
else
f.index = 0;
setColor(f);

if(f.index == 0)
f.state="OFF";
else
FadeRunning = true;
}
else if(f.state == "FADE_DOWN_UP")
{
if(f.index > 0)
f.index--;
else
f.index = 0;
setColor(f);

if(f.index == 0)
{
f.text = f.next_text;
f.color = f.next_color;
f.next_text = null;
f.state ="FADE_UP";
set_text(f);
}
FadeRunning = true;
}
}
/*** Check to see if we need to animate any more frames. ***/
if(FadeRunning)
setTimeout("FadeAnimation()", FadeInterval);

}
</SCRIPT>

<SCRIPT language=Javascript type=text/javascript>
// Pic Fader

nereidFadeObjects = new Object();
nereidFadeTimers = new Object();
function nereidFade(object, destOp, rate, delta) {
if (!document.all)
return
if (object != "[object]") {
setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")", 0);
return;
}
clearTimeout(nereidFadeTimers[object.sourceIndex]);
diff = destOp-object.filters.alpha.opacity;
direction = 1;
if (object.filters.alpha.opacity > destOp) {
direction = -1;
}
delta=Math.min(direction*diff,delta);
object.filters.alpha.opacity+=direction*delta;
if (object.filters.alpha.opacity != destOp) {
nereidFadeObjects[object.sourceIndex]=object;
nereidFadeTimers[object.sourceIndex]=setTimeout ("nereidFade(nereidFadeObjects["+object.sourceIndex+"], "+destOp+", "+rate+", "+delta+")", rate);
}
}


// Status Message

var msg = "[ P E R S I A N G R A P H I C F O R U M ] ";
var chars = msg.length + 1;
var updateStatus = "";
var i = 0;
function statusMessage() {
if (i < chars) setTimeout("nextLetter()", 100);
}
function nextLetter() {
updateStatus = msg.substring(0,i) ;
window.status = updateStatus;
i++;
statusMessage();
}




// By Babak Sateli
/* function disableselect(e){
return false
}
function reEnable(){
return true
}
//if IE4+
document.onselectstart=new Function ("return false")
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}*/


</SCRIPT>

<SCRIPT language=javascript type=text/javascript>

function validateForm(Frm, bConfirm, bDisable, bDisableR, groupError) {
var testOk = false;
if (groupError && fv['groupErrors'] < fv['switchToEbyE']) {
fv['groupError'] = 1;
errorData = new Array();
}
else
fv['groupError'] = 0;

for (var i=0; i<Frm.elements.length; i++) { // Loops through all the form's elements
if (Frm.elements.getAttribute(fv['code'])) { // Gets the validator attribute, if exists thus starting the validation
var validateType = Frm.elements.getAttribute(fv['code']);
var validateObj = Frm.elements;
testOk = false;
var params = validateType.split("|"); // Separates validation string into parameters
if (params[0] == 'money') { // Sets flags for money syntax
var dollarsign = (params[1].indexOf('$') != -1);
var grouping = (params[1].indexOf(',') != -1);
var decimal = (params[1].indexOf('.') != -1);
}

if (params[params.length-1] == 'bok') // Sets flag if field is allowed to be blank
fv['bok'] = true;

switch (params[0]) { // Calls appropriate validation function based on type
case 'blank' : if (validateBlank(validateObj)) testOk = true; break;
case 'equalto' : if (validateEqualTo(validateObj, params[1], Frm)) testOk = true; break;
case 'length' : if (validateLength(validateObj, params[1])) testOk = true; break;
case 'number' : if (validateNumber(validateObj, params[1], params[2], params[3])) testOk = true; break;
case 'numeric' : if (validateNumeric(validateObj, params[1])) testOk = true; break;
case 'alnum' : if (validateAlnum(validateObj, params[1], params[2], params[3], params[4], params[5] )) testOk = true; break;
case 'decimal' : if (validateDecimal(validateObj, params[1], params[2] )) testOk = true; break;
case 'decimalr' : if (validateDecimalR(validateObj, params[1], params[2], params[3], params[4] )) testOk = true; break;
case 'ip' : if (validateIP(validateObj, params[1], params[2])) testOk = true; break;
case 'ssn' : if (validateSSN(validateObj)) testOk = true; break;
case 'money' : if (validateMoney(validateObj, dollarsign, grouping, decimal)) testOk = true; break;
case 'zip' : if (validateZip(validateObj, params[1])) testOk = true; break;
case 'cazip' : if (validateCAzip(validateObj)) testOk = true; break;
case 'phone' : if (validatePhone(validateObj)) testOk = true; break;
case 'email' : if (validateEmail(validateObj)) testOk = true; break;
case 'date' : if (validateDate(validateObj, params[1], params[2], params[3], params[4])) testOk = true; break;
case 'cc' : if (validateCC(validateObj)) testOk = true; break;
case 'select' : if (validateSelect(validateObj)) testOk = true; break;
case 'selectm' : if (validateSelectM(validateObj, params[1], params[2])) testOk = true; break;
case 'selecti' : if (validateSelectI(validateObj, params[1])) testOk = true; break;
case 'checkbox' : if (validateCheckbox(validateObj, params[1], params[2])) testOk = true; break;
case 'radio' : if (validateRadio(validateObj)) testOk = true; break;
case 'eitheror' : if (validateEitherOr(validateObj, params[1], params[2])) testOk = true; break;
case 'atleast' : if (validateAtLeast(validateObj, params[1], params[2], params[3])) testOk = true; break;
case 'file' : if (validateFile(validateObj, params[1])) testOk = true; break;
case 'custom' : if (validateCustom(validateObj)) testOk = true; break;
// Add additional cases here
default : alert('Validation Type Not Found:\n'+params[0]);
}
if (!testOk && !fv['groupError']) return false;
}
}
// Begin group error routine
if (fv['groupError']) {
fv['groupErrors']++;
var alertStr = "The fields listed below have erroneous data or need to be filled in.\n\n";
for (var i in errorData) {
// fv['revertClass'] = errorData.className;
if (typeof errorData.type != 'undefined' && typeof errorData.name != 'undefined') {
errorData.className = fv['errorClass'];
alertStr += " -" + formatName(errorData) + "\n";
}
else {
var temp = errorData;
temp[0].className = fv['errorClass'];
alertStr += " -" + formatName(temp[0]) + "\n";
}
errorProcess(errorData[0],0,1);
}
if (errorData.length > 0) {
errorData[0].focus();
alert(alertStr);
return false;
}
}
/*******************************************************
* Any special conditions you have can be added here
********************************************************/

if (typeof bConfirm == 'undefined') bConfirm = 0; // Checks for submission flags
if (typeof bDisable == 'undefined') bDisable = 0;
if (typeof bDisableR == 'undefined') bDisableR = 0;
if (bConfirm) {
if(!confirm(fv['confirmMsg']))
{
if (fv['confirmAbortMsg'] != '') alert(fv['confirmAbortMsg']); // Displays confim if requested
return false;
}
}
if (bDisable) Frm.elements[fv['submitButton']].disabled=true; // Disables submit if requested
if (bDisableR) Frm.elements[fv['resetButton']].disabled=true; // Disables reset if requested
return true; // Form has been validated
}

/***************************************************************************/
function validateBlank(formObj) {
var objName = formatName(formObj);
if (fv['is'].ie5 || fv['is'].mac) {
if (formObj.value == "") {
return errorProcess2(formObj,0,1,'Please enter the '+objName);
}
}
else {
var regex = new RegExp(/\S/);
if (!regex.test(formObj.value)) {
return errorProcess2(formObj,1,1,'Please enter the '+objName);
}
}
return true;
}
/***************************************************************************/
// Special function used for bok
function checkBlank(formObj) {
if (formObj.value == "")
return true;
var regex = new RegExp(/^\s+$/);
if (regex.test(formObj.value))
return true;
return false;
}

/***************************************************************************/
function validateEqualTo(formObj, otherObjName, Frm) {
var objName = formatName(formObj);
var equalToValue = Frm.elements[otherObjName].value;

if (formObj.value != equalToValue) {
return errorProcess2(formObj,1,1,otherObjName+' must be the same as '+objName+'.\nPlease make sure the data you entered matches.');
}
return true;
}

/***************************************************************************/
function validateLength(formObj,len) {
var objName = formatName(formObj);
if (fv['bok'] && checkBlank(formObj))
{ fv['bok']=false; return true; }

if (formObj.value.length < parseInt(len)) {
return errorProcess2(formObj,1,1,'The '+objName+' must be at least '+len+' characters long');
}
return true;
}

/***************************************************************************/
function validateNumber(formObj, type, lb, ub) {
var objName = formatName(formObj);
if (fv['bok'] && checkBlank(formObj))
{ fv['bok']=false; return true; }

var num = formObj.value;
if (isNaN(num) || checkBlank(formObj)) {
return errorProcess2(formObj,1,1,'Please enter a valid number');
}
num = (parseInt(type) == 1) ? parseFloat(num) : parseInt(num) ;
if (num < lb || num > ub) {
return errorProcess2(formObj,1,1,'Please enter a number between ' + lb + ' and ' + ub);
}
return true;
}

/***************************************************************************/
function validateNumeric(formObj, len) {
if (fv['bok'] && checkBlank(formObj))
{ fv['bok']=false; return true; }
var objName = formatName(formObj);

if (len == '*') {
var regex = /^\d+$/;
if (!regex.test(formObj.value)) {
return errorProcess2(formObj,1,1,'Only numeric values are valid for the ' + objName);
}
}
else {
numReg = "^\\d{"+parseInt(len)+",}$"
var regex = new RegExp(numReg);
if (!regex.test(formObj.value)) {
return errorProcess2(formObj,1,1,'A minimum of '+len+' numeric values are required for the ' + objName);
}
}
return true;
}

/***************************************************************************/
function validateAlnum(formObj, minLen, tCase, numbers, spaces, puncs) {
var objName = formatName(formObj);
if (fv['bok'] && checkBlank(formObj))
{ fv['bok']=false; return true; }
var arrE = new Array();
arrE[0] = (minLen == "*") ? "None" : minLen;
var okChars = "";
switch (tCase.toUpperCase()) {
case 'U' : okChars = "A-Z"; arrE[1] = "UPPER"; break
case 'L' : okChars = "a-z"; arrE[1] = "lower"; break;
case 'C' : okChars = "A-Z][a-z"; if (minLen != "*") minLen--; arrE[1]="Initial capital"; break;
default : okChars = "a-zA-Z"; arrE[1]="Any"; break;
}
if (parseInt(numbers)) { okChars += "0-9"; arrE[2] = "Yes"; } else arrE[2] = "No";
if (parseInt(spaces)) { okChars += " "; arrE[3] = "Yes"; } else arrE[3] = "No";
if (puncs == "all") { okChars += "."; arrE[4] = "All"; }
if (puncs == "all") { okChars += puncStr("!@#$%^&*()_+-={}|[]:\";'<\\>?,.?~`"); arrE[4] = "All"; }
else if (puncs == "none") arrE[4] = "None";
else { okChars += puncStr(puncs); arrE[4] = puncStr(puncs).replace(/\\/g,""); }
var length = (minLen == "*") ? "+" : "{"+minLen+",}";
var alnumReg = "^["+okChars+"]"+length+"$";
var regex = new RegExp(alnumReg);
if (!regex.test(formObj.value) ) {
return errorProcess2(formObj,1,1,"The data you entered ("+formObj.value+") does not match the requested format for the "+objName+"\nMinimum Length: "+arrE[0]+"\nCase: "+arrE[1]+"\nNumbers allowed: "+arrE[2]+"\nSpaces allowed: "+arrE[3]+"\nPunctuation characters allowed: "+arrE[4]);
}
return true;
}
/***************************************************************************/
function validateDecimal(formObj, lval, rval) {
var objName = formatName(formObj);
if (fv['bok'] && checkBlank(formObj))
{ fv['bok']=false; return true; }

(lval == '*')? lval = '*': lval = parseInt(lval);
(rval == '*')? rval = '*': rval = parseInt(rval);
var decReg = "";
if (lval == 0)
decReg = "^\\.[0-9]{"+rval+"}$";
else if (lval == '*')
decReg = "^[0-9]"+lval+"\\.[0-9]{"+rval+"}$";
else if (rval == '*')
decReg = "^[0-9]{"+lval+"}\\.[0-9]"+rval+"$";
else
decReg = "^[0-9]{"+lval+"}\\.[0-9]{"+rval+"}$";
var regex = new RegExp(decReg);
if (!regex.test(formObj.value)) {
return errorProcess2(formObj,1,1,formObj.value+' is not a valid '+objName+'. Please re-enter the '+objName);
}
return true;
}

/***************************************************************************/
function validateDecimalR(formObj, lmin, lmax, rmin, rmax) {
var objName = formatName(formObj);
if (fv['bok'] && checkBlank(formObj))
{ fv['bok']=false; return true; }

(lmin == '*')? lmin = 0: lmin = parseInt(lmin);
(lmax == '*')? lmax = '': lmax = parseInt(lmax);
(rmin == '*')? rmin = 0: rmin = parseInt(rmin);
(rmax == '*')? rmax = '': rmax = parseInt(rmax);
var decReg = "^[0-9]{"+lmin+","+lmax+"}\\.[0-9]{"+rmin+","+rmax+"}$"
var regex = new RegExp(decReg);
if (!regex.test(formObj.value)) {
return errorProcess2(formObj,1,1,formObj.value+' is not a valid '+objName+'. Please re-enter the '+objName);
}
return true;
}
/***************************************************************************/
function validateIP(formObj, portMin, portMax) {
var objName = formatName(formObj);
if (fv['bok'] && checkBlank(formObj))
{ fv['bok']=false; return true; }
if (typeof portMin == 'undefined') portMin = 0;
if (typeof portMax == 'undefined') portMax = 99999;
var portOk = true;
var ipReg = "^((?:([2]{1}[0-5]{2})|([2]{1}[0-4]{1}[0-9]{1})|([1]?[0-9]{2})|([0-9]{1}))[\\.]){3}(?:([2]{1}[0-5]{2})|([2]{1}[0-4]{1}[0-9]{1})|([1]?[0-9]{2})|([0-9]{1}))(\\:[0-9]{1,5})?$"
var portLoc = formObj.value.indexOf(":");
if (portLoc != -1) {
var port = parseInt(formObj.value.substring(portLoc+1));
if (port < portMin || port > portMax) portOk = false;
}
var regex = new RegExp(ipReg);
if (!regex.test(formObj.value) || !portOk) {
var errorMessage = (regex.test(formObj.value) && !portOk) ?
"The port number you specified, "+port+", is out of range.\nIt must be between "+portMin+" and "+portMax :
formObj.value+' is not a valid IP address. Please re-enter';
return errorProcess2(formObj,1,1,errorMessage);
}
return true;
}
/***************************************************************************/
function validateSSN(formObj) {
var objName = formatName(formObj);
if (fv['bok'] && checkBlank(formObj))
{ fv['bok']=false; return true; }

var regex = new RegExp(/^\d{3}\-\d{2}\-\d{4}$/);
if (!regex.test(formObj.value)) {
return errorProcess2(formObj,1,1,formObj.value+' is not a valid Social Security Number.\nYour SSN must be entered in \'XXX-XX-XXXX\' format.');
}
return true;
}
/***************************************************************************/
function validateMoney(formObj, ds, grp, dml) {
var objName = formatName(formObj);
if (fv['bok'] && checkBlank(formObj))
{ fv['bok']=false; return true; }

var moneySyntax;
if (ds && grp && dml) // Dollar sign, grouping, and decimal
{ moneyReg = "^\\$(?:(?:[0-9]{1,3},)(?:[0-9]{3},)*[0-9]{3}|[0-9]{1,3})(\\.[0-9]{2})$"; moneySyntax = "$XX,XXX.XX"; }
if (ds && grp && !dml) // Dollar sign and grouping
{ moneyReg="^\\$(?:(?:[0-9]{1,3},)(?:[0-9]{3},)*[0-9]{3}|[0-9]{1,3})$"; moneySyntax="$XX,XXX"; }
if (ds && !grp && dml) // Dollar sign and decimal
{ moneyReg="^\\$[0-9]*(\\.[0-9]{2})$"; moneySyntax="$XXXXX.XX"; }
if (!ds && grp && dml) // Grouping and decimal
{ moneyReg="^(?:(?:[0-9]{1,3},)(?:[0-9]{3},)*[0-9]{3}|[0-9]{1,3})(\\.[0-9]{2})?$"; moneySyntax="XX,XXX.XX"; }
if (ds && !grp && !dml) // Dollar sign only
{ moneyReg="^\\$[0-9]*$"; moneySyntax="$XXXXX"; }
if (!ds && grp && !dml) // Grouping only
{ moneyReg="^(?:(?:[0-9]{1,3},)(?:[0-9]{3},)*[0-9]{3}|[0-9]{1,3})$"; moneySyntax="XX,XXX"; }
if (!ds && !grp && dml) // Decimal only
{ moneyReg="^[0-9]*(\\.[0-9]{2})$"; moneySyntax="XXXXX.XX"; }
if (!ds && !grp && !dml) // No params set, all special chars become optional
{ moneyReg="^\\$?(?:(?:[0-9]{1,3},?)(?:[0-9]{3},?)*[0-9]{3}|[0-9]{1,3})(\\.[0-9]{2})?$"; moneySyntax="[$]XX[,]XXX[.XX]"; }
var regex = new RegExp(moneyReg);
if (!regex.test(formObj.value)) {
return errorProcess2(formObj,1,1,formObj.value+' does not match the required format of '+moneySyntax+' for '+objName+'.');
}
return true;
}

/***************************************************************************/
function validateSelect(formObj) {
var objName = formatName(formObj);
if (formObj.selectedIndex == 0) {
return errorProcess2(formObj,0,1,"Please select the "+objName);
}
return true;
}

/***************************************************************************/
function validateSelectM(formObj, minS, maxS) {
var objName = formatName(formObj);
var selectCount = 0;
if (maxS == 999) maxS = formObj.length;
for (var i=0; i<formObj.length; i++)
{
if (formObj.options.selected)
selectCount++;
}
if (selectCount < minS || selectCount > maxS) {
return errorProcess2(formObj,0,1,'Please select between '+minS+' and '+maxS+' '+objName+'.\nYou currently have '+selectCount+' selected');
}
return true;
}

/***************************************************************************/
function validateSelectI(formObj, indexes) {
var objName = formatName(formObj);
var arrIndexes =indexes.split(/[,]/);
var selectOK = true;
for (var i=0; i<arrIndexes.length; i++)
if (formObj.selectedIndex == arrIndexes)
selectOK = false;
if (!selectOK) {
return errorProcess2(formObj,0,1,"Please select a valid option for "+objName);
}
return true;
}

/***************************************************************************/
function validateZip(formObj, sep) {
if (typeof sep == 'undefined')
sep = "- ";
var objName = formatName(formObj);
if (fv['bok'] && checkBlank(formObj))
{ fv['bok']=false; return true; }
zipReg = "^[0-9]{5}(|["+puncStr(sep)+"]?[0-9]{4})$"
var regex = new RegExp(zipReg);
if (!regex.test(formObj.value)) {
return errorProcess2(formObj,1,1,"Please enter a valid 5 or 9 digit Zip code.");
}
return true;
}

/***************************************************************************/
function validateCAzip(formObj) {
var objName = formatName(formObj);
if (fv['bok'] && checkBlank(formObj))
{ fv['bok']=false; return true; }

zipReg = "^[A-Z][0-9][A-Z] [0-9][A-Z][0-9]$"
var regex = new RegExp(zipReg);
if (!regex.test(formObj.value)) {
return errorProcess2(formObj,1,1,"Please enter a valid postal code.");
}
return true;
}

/***************************************************************************/
function validateEmail(formObj) {
if (fv['bok'] && checkBlank(formObj))
{ fv['bok']=false; return true; }

var emailStr = formObj.value;
var emailReg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
var emailReg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,6}|[0-9]{1,3})(\]?)$/; // valid
if (!(!emailReg1.test(emailStr) && emailReg2.test(emailStr))) {// if syntax is valid
return errorProcess2(formObj,1,1,"Please enter a valid Email address.");
}
return true;
}

/***************************************************************************/
function validateDate(formObj, dateStr, delim, code, specDate) {
var objName = formatName(formObj);
if (fv['bok'] && checkBlank(formObj))
{ fv['bok']=false; return true; }

var months = ['January','February','March','April','May','June','July','August','September','October','November','December'];
var vDate = formObj.value;
var mPlace = dateStr.indexOf("m");
var dPlace = dateStr.indexOf("d");
var yPlace = dateStr.indexOf("y");
var yLength = dateStr.lastIndexOf("y") - yPlace + 1;
var dateReg = dateStr.replace(/\w/g,"\\d");
delim = puncStr(delim);
dateReg = dateReg.replace(/-/g,"[" + delim + "]");
dateReg = "^" + dateReg + "$";
var day = vDate.substring(dPlace, dPlace+2);
var month = vDate.substring(mPlace, mPlace+2);
var year = vDate.substring(yPlace, yPlace + yLength);
var regex = new RegExp(dateReg);
var d = new Date(months[month-1] + " " + day + ", " + year);
var today = (specDate == 'today') ? new Date() : new Date(specDate);
today.setHours(0);
today.setMinutes(0);
today.setSeconds(0);
today.setMilliseconds(0);
var timeDiff = today.getTime() - d.getTime();
var dateOk = false;
switch (parseInt(code)) {
case 1 : // Before specDate
dateOk = (timeDiff > 0);
break;
case 2 : // Before or on specDate
dateOk = ((timeDiff + 86400000) > 0);
break;
case 3 : // After specDate
dateOk = (timeDiff < 0);
break;
case 4 : // After or on specDate
dateOk = ((timeDiff - 86400000) < 0);
break;
default : dateOk = true;
}
if (!regex.test(vDate) || d == 'NaN' || !dateOk) {
return errorProcess2(formObj,1,1,"Please enter a valid date");
}
return true;
}

/***************************************************************************/
function validatePhone(formObj) {
var objName = formatName(formObj);
if (fv['bok'] && checkBlank(formObj))
{ fv['bok']=false; return true; }

phoneReg = "^(?:[\(][0-9]{3}[\)]|[0-9]{3})[-. ]?[0-9]{3}[-. ]?[0-9]{4}$";
var regex = new RegExp(phoneReg);
if (!regex.test(formObj.value)) {
return errorProcess2(formObj,1,1,"Please enter a valid Phone number plus Area Code.");
}
return true;
}

/***************************************************************************/
function validateCheckbox(formObj, minC, maxC) {
var objName = formatName(formObj);
var formObj = formObj.form.elements[formObj.name];
var checkTotal = formObj.length;
var checkCount = 0;

if (maxC == 999) maxC = checkTotal;
for (var i=0; i<checkTotal; i++) {
if (formObj.checked) checkCount++;
}
if (checkCount < minC || checkCount > maxC) {
if (fv['groupError']) { addError(formObj); return true; }
alert('Please select between '+minC+' and '+maxC+' options for '+objName+'.\nYou currently have '+checkCount+' selected');
for (i=formObj.length-1; i>=0; i--)
errorProcess(formObj,0,1);
return false;
}
return true;
}

/***************************************************************************/
function validateRadio(formObj) {
var objName = formatName(formObj);
var formObj = formObj.form.elements[formObj.name];
var selectTotal = 0;

for (i=0; i<formObj.length; i++)
if (formObj.checked)
selectTotal++;

if (selectTotal != 1) {
if (fv['groupError']) { addError(formObj); return true; }
alert((formObj[0].getAttribute(fv['emsg'])) ? formObj[0].getAttribute(fv['emsg']) : 'Please select an option for '+objName);
for (i=formObj.length-1; i>=0; i--)
errorProcess(formObj,0,1);
return false;
}
return true;
}
/***************************************************************************/
function validateEitherOr(formObj, del, fields) {
var f = formObj.form;
var arrF = fields.split(del);
var nbCount = 0;
var list = "";
for (var i=0; i<arrF.length; i++) {
list += " -"+formatName(f.elements[arrF])+"\n";
if (!checkBlank(f.elements[arrF]))
nbCount++;
}
if (nbCount != 1) {
if (fv['groupError']) { addError(f.elements[arrF[0]]); return true; }
alert((formObj.getAttribute(fv['emsg'])) ? formObj.getAttribute(fv['emsg']) : "Only one of the following fields may be filled in:\n"+list);
for (var i=0; i<arrF.length; i++)
errorProcess(f.elements[arrF],0,0);
return false;
}
return true;
}
/***************************************************************************/
function validateAtLeast(formObj, qty, del, fields) {
var f = formObj.form;
var arrF = fields.split(del);
var nbCount = 0;
var list = "";
for (var i=0; i<arrF.length; i++) {
list += " -"+formatName(f.elements[arrF])+"\n";
if (!checkBlank(f.elements[arrF])) {
nbCount++;
}
}
if (nbCount < parseInt(qty)) {
if (fv['groupError']) { addError(f.elements[arrF[0]]); return true; }
alert((formObj.getAttribute(fv['emsg'])) ? formObj.getAttribute(fv['emsg']) : "At least "+qty+" of the following fields must be filled in:\n"+list);
for (var i=0; i<arrF.length; i++)
errorProcess(f.elements[arrF],0,0);
return false;
}
return true;
}
/***************************************************************************/
function validateFile(formObj, extensions, cSens) {
var objName = formatName(formObj);
if (fv['bok'] && checkBlank(formObj))
{ fv['bok']=false; return true; }

cSens = (cSens) ? "" : "i";
regExten = extensions.replace(/,/g,"|");
var fileReg = "^.+\\.("+regExten+")$";
var regex = new RegExp(fileReg,cSens);
if (!regex.test(formObj.value)) {
return errorProcess2(formObj,1,1,"The file must be one of the following types:\n"+extensions+"\nNote: File extention may be case-sensitive");
}
return true;
}
/***************************************************************************/
function validateCustom(formObj) {
var objName = formatName(formObj);
if (fv['bok'] && checkBlank(formObj))
{ fv['bok']=false; return true; }

var regex = new RegExp(formObj.getAttribute(fv['pattern']));
if (!regex.test(formObj.value)) {
return errorProcess2(formObj,1,1,"The "+objName+" is invalid.");
}
return true;
}
/****************************************************************************
* Here are all the ancillary functions
****************************************************************************/
function addError(o) {
errorData[errorData.length] = o;
}
/***************************************************************************/
function formatName(o) {
var wStr = (o.name) ? o.name : o.id;
wStr = wStr.replace(/_/g," ");
return wStr;
}
/***************************************************************************/
function errorProcess(o, sel, foc) {
fv['revertClass'] = o.className;
o.className = fv['errorClass'];
if (sel) o.select();
if (foc) o.focus();
}

function errorProcess2(o, sel, foc, error) {
var ret = false;
if (fv['groupError']) { addError(o); ret = true; }
else {
alert((o.getAttribute(fv['emsg'])) ? o.getAttribute(fv['emsg']) : error);
if (sel) o.select();
if (foc) o.focus();
}
fv['revertClass'] = o.className;
o.className = fv['errorClass'];
return ret;
}
/***************************************************************************/
function clearStyle(o) {
if (o.className == fv['errorClass']) o.className = fv['revertClass'];
}
/***************************************************************************/
function puncStr(str) {
str = str.replace("pipe", "|");
return str.replace(/([\\\|\(\)\[\{\^\$\*\+\?\.])/g,"\\$1");
// return str.replace(/([\!\@\#\$\%\^\&\*\(\)\_\+\-\=\{\}\|\[\]\\\:\"\;\'\<\>\?\,\.\/])/g,"\\$1");
}

/*****************************************************************************************************
* CREDIT CARD FUNCTIONS
*
*********** WARNING: DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING! ****************/

function cleanupCCNum(ccNum) {
return ccNum.replace(/\D/g,'');
}
/***************************************************************************/
function validateCC(formObj) {
if (fv['bok'] && checkBlank(formObj))
{ fv['bok']=false; return true; }
var objName = formatName(formObj);

switch (formObj.form.elements[fv['ccType']].value.toUpperCase()) {
case 'VISA' : var ccReg = /^4\d{12}(\d{3})?$/; break;
case 'MC' : var ccReg = /^5[1-5]\d{14}$/; break;
case 'DISC' : var ccReg = /^6011\d{12}$/; break;
case 'AMEX' : var ccReg = /^3[4|7]\d{13}$/; break;
case 'DINERS' : var ccReg = /^3[0|6|8]\d{12}$/; break;
case 'ENROUTE' : var ccReg = /^2[014|149]\d{11}$/; break;
case 'JCB' : var ccReg = /^3[088|096|112|158|337|528]\d{12}$/; break;
case 'SWITCH' : var ccReg = /^(49030[2-9]|49033[5-9]|49110[1-2]|4911(7[4-9]|8[1-2])|4936[0-9]{2}|564182|6333[0-4][0-9]|6759[0-9]{2})\d{10}(\d{2,3})?$/; break;
case 'DELTA' : var ccReg = /^4(1373[3-7]|462[0-9]{2}|5397[8|9]|54313|5443[2-5]|54742|567(2[5-9]|3[0-9]|4[0-5])|658[3-7][0-9]|659(0[1-9]|[1-4][0-9]|50)|844[09|10]|909[6-7][0-9]|9218[1|2]|98824)\d{10}$/; break;
case 'SOLO' : var ccReg = /^(6334[5-9][0-9]|6767[0-9]{2})\d{10}(\d{2,3})?$/; break;
// Add additonal card types here
default : if (!fv['groupError']) alert('Error! Card Type not found!'); return false;
}
var formatOK = ccReg.test(formObj.value);
var luhnOK = validateLUHN(formObj.value);
if (!formatOK || !luhnOK) {
return errorProcess2(formObj,1,1,'The '+objName+' you entered is not valid. Please check again and re-enter');
}
return true;
}
/***************************************************************************/
function validateLUHN(ccString) {
var odds = "";
var evens = "";
var i=1;

for (i=ccString.length-2; i>=0; i=i-2) {
var digit = parseInt(ccString.charAt(i)) * 2;
odds += digit+"";
}
for (i=ccString.length-1; i>=0; i=i-2)
evens += ccString.charAt(i);
var luhnStr = odds + evens;
var checkSum = 0;
for (i=0; i<luhnStr.length; i++)
checkSum += parseInt(luhnStr.charAt(i));
return (checkSum % 10 == 0);
}


</SCRIPT>

<SCRIPT language=javascript type=text/javascript>
var fv = new Array()

/****************************************************
* Globals. Modify these to suit your setup
****************************************************/

// Attribute used for fValidate Validator codes
fv['code'] = 'alt';

// Attribute used for custom error messages (override built-in error messages)
fv['emsg'] = 'emsg';

// Attribute used for pattern with custom validator type
fv['pattern'] = 'pattern';

// Change this to the classname you want for the error highlighting
fv['errorClass'] = 'errHilite';

// If the bConfirm flag is set to true, the users will be prompted with CONFIRM box with this message
fv['confirmMsg'] = 'Your Data is about to be sent.\nPlease click \'Ok\' to proceed or \'Cancel\' to abort.';

// If user cancels CONFIRM, then this message will be alerted. If you don't want this alert to show, then
// empty the variable ( fv['confirmAbortMsg'] = ''; )
fv['confirmAbortMsg'] = 'Submission cancelled. Data has not been sent.';

// Enter the name/id of your form's submit button here (works with type=image too)
fv['submitButton'] = 'Submit';

// Enter the name/id of your form's reset button here (works with type=image too)
fv['resetButton'] = 'Reset';

// Ender the name or id of the SELECT object here. Make sure you pay attention to the values (CC Types)
// used in the case statement for the function validateCC()
fv['ccType'] = 'Credit_Card_Type';

// NOTE: The config value below exists for backwards compatibility with fValidate 3.55b. If you have a newer
// version, use the above fv['ccType'] instead.
// Enter the DOM name of the SELECT object here. Make sure you pay attention to the values (CC Types)
// used in the case statement for the function validateCC()
fv['ccTypeObj'] = 'form1.Credit_Card_Type';

// Number of group error mode alerts before switching to normal error mode
fv['switchToEbyE'] = 3;

/**********************************************************
* Do not edit This section. Start below
***********************************************************/

function FV_bs() {
this.ver = navigator.appVersion; //Cheking for browser version
this.agent = navigator.userAgent; //Checking for browser type
var minor = parseFloat(this.ver);
var major = parseInt(minor);
this.dom = document.getElementById?1:0;
this.opera = (this.agent.indexOf("opera") != -1);
var iePos = this.ver.indexOf('msie');
if (iePos !=-1) {
minor = parseFloat(this.ver.substring(iePos+5,this.ver.indexOf(';',iePos)))
major = parseInt(minor);
}
this.ie = ((iePos!=-1) && (!this.opera));
this.gecko = ((navigator.product)&&(navigator.product.toLowerCase()=="gecko"))?true:false;
this.ie4 = (this.ie && major == 4);
this.ie4up = (this.ie && minor >= 4);
this.ie5 = (this.ie && major == 5);
this.ie5up = (this.ie && minor >= 5);
this.ie5_5 = (this.ie && (this.agent.indexOf("msie 5.5") !=-1));
this.ie5_5up = (this.ie && minor >= 5.5);
this.ie6 = (this.ie && major == 6);
this.ie6up = (this.ie && minor >= 6);
this.mac = this.agent.indexOf("Mac")>-1;
}

/****************************************************
* Constants. Do not edit
****************************************************/

// Global used for flagging the validateBlank() function within most other validation functions
fv['bok'] = false;

// Global used for class switching.
fv['revertClass'] = '';

// Placeholder for Group Error boolean
fv['groupError'] = 0;

// Placeholder for number of group error alerts
fv['groupErrors'] = 0;

// Browser Sniffer
fv['is'] = new FV_bs();

// Array for error totalling while in group error mode
var errorData = new Array();

// EOF
</SCRIPT>
<!-- onLoad="statusMessage();" -->
<body bgcolor="#FFFFFF">

<DIV align=center>
<DIV style="VISIBILITY: hidden">
<SCRIPT language=JavaScript src="">
</SCRIPT>

<SCRIPT language=JavaScript>
<!--
nedstatbasic("ACtlPgIgM51LiEplplqBGIDSVXQA", 0);
// -->
</SCRIPT>
</DIV><!-- ©Copyright pooya.info -- www.pooya.info -- Mojtaba Majidi -- [email protected] --></DIV>
<SPAN lang=en-us>

<TABLE dir=ltr style="BORDER-COLLAPSE: collapse"
borderColor=#111111 cellSpacing=0 cellPadding=0 width="95%"
align=center border=0 id="table6">
<TBODY>
<TR align=middle height=70>
<TD width="20%"><A
href="http://www.pooya.info"><IMG
onmouseover="fade_up('fade1','آموزشهاي فلش > Flash Remoting MX چيست ؟','5A6C7A')"
onmouseout="fade_down('fade1')"
src="http://www.pooya.info/jadid/images/flash_re_pic.gif" border=0
name=maincnt247>&lt;/A>&lt;/TD>
&lt;TD width="20%">&lt;A
href="http://www.pooya.info">
<IMG
onmouseover="fade_up('fade1','آموزشهاي افكتهاي فتوشاپ > Wallpaper سمی','5A6C7A')"
onmouseout="fade_down('fade1')"
src="http://www.pooya.info/jadid/images/toxic_wall_pic.gif" border=0
name=maincnt244 width="70" height="65">&lt;/A>&lt;/TD>
&lt;TD width="20%">&lt;A
href="http://www.pooya.info"><IMG
onmouseover="fade_up('fade1','آموزشهاي افكتهاي فتوشاپ > چشمهای قاتل','5A6C7A')"
onmouseout="fade_down('fade1')"
src="http://www.pooya.info/jadid/images/deatheye_pic.gif" border=0
name=maincnt243>&lt;/A>&lt;/TD>
&lt;TD width="20%">&lt;A
href="http://www.pooya.info"><IMG
onmouseover="fade_up('fade1','مقالات متفرقه > آموزش عكاسي (شناخت دوربينها و اجزاي آنها)','5A6C7A')"
onmouseout="fade_down('fade1')"
src="http://www.pooya.info/jadid/images/photo01_pic.gif" border=0
name=maincnt242>&lt;/A>&lt;/TD>
&lt;TD width="20%">&lt;SPAN lang=en-us>
&lt;A
href="http://www.pooya.info"><IMG
onmouseover="fade_up('fade1','مقالات متفرقه > کاليبره کردن مانيتور و آشنايي با آن','5A6C7A')"
onmouseout="fade_down('fade1')"
src="http://www.pooya.info/jadid/images/adobe_gamma_pic.gif" border=0
name=maincnt232>&lt;/A>&lt;/SPAN>&lt;/TD>&lt;/TR>
&lt;TR align=middle height=70>
&lt;TD width="20%">&lt;A
href="http://www.pooya.info"><IMG
onmouseover="fade_up('fade1','نكات و آموزشهاي فتوشاپ > آموزش ایجاد box در طراحی وب - قسمت دوم','5A6C7A')"
onmouseout="fade_down('fade1')"
src="http://www.pooya.info/jadid/images/icon_box_1.gif" border=0
name=maincnt231>&lt;/A>&lt;/TD>
&lt;TD width="20%">&lt;A
href="http://www.pooya.info"><IMG
onmouseover="fade_up('fade1','آموزشهاي افكتهاي فتوشاپ > نوشته یخ زده','5A6C7A')"
onmouseout="fade_down('fade1')"
src="http://www.pooya.info/jadid/images/icon_frozentext.gif" border=0
name=maincnt230>&lt;/A>&lt;/TD>
&lt;TD width="20%">&lt;A
href="http://www.pooya.info"><IMG
onmouseover="fade_up('fade1','آموزشهاي افكتهاي فتوشاپ > آموزش ساخت Wallpaper','5A6C7A')"
onmouseout="fade_down('fade1')"
src="http://www.pooya.info/jadid/images/icon_wall2.gif" border=0
name=maincnt229>&lt;/A>&lt;/TD>
&lt;TD width="20%">&lt;A
href="http://www.pooya.info"><IMG
onmouseover="fade_up('fade1','مقالات متفرقه > عمق میدان وضوح در عکاسی','5A6C7A')"
onmouseout="fade_down('fade1')"
src="http://www.pooya.info/jadid/images/icon_photo1.gif" border=0
name=maincnt228>&lt;/A>&lt;/TD>
&lt;TD width="20%">&lt;A
href="http://www.pooya.info"><IMG
onmouseover="fade_up('fade1','گرافيك > معرفی M.C. Escher','5A6C7A')"
onmouseout="fade_down('fade1')"
src="http://www.pooya.info/jadid/images/icon_escher.gif" border=0
name=maincnt227>&lt;/A>&lt;/TD>&lt;/TR>
&lt;TR>
&lt;TD dir=rtl colSpan=5 height=35>&lt;FONT
style="FONT-SIZE: 9pt" face=tahoma>
&lt;SCRIPT language=JavaScript1.2>
if (document.layers){
document.write('&lt;ilayer name="nscontainer" width="100%" height="100">')
document.write('&lt;layer name="fade1" width="100%" height="100">')
document.write('&lt;/layer>&lt;/ilayer>')
}
else
document.write('&lt;DIV ID="fade1">&lt;/DIV>')
&lt;/SCRIPT>
&lt;/FONT>&lt;/TD>&lt;/TR>&lt;/TBODY>&lt;/TABLE>&lt;/SPAN>
&lt;P dir=rtl align=center>&amp;nbsp;&lt;/P>
&lt;P dir=rtl align=center>&lt;SMALL>&lt;FONT face=Tahoma
size=1>&lt;BR>&amp;nbsp;&lt;/FONT>&lt;/SMALL>&lt;/P>&lt;/CENTER>&lt;/BODY>&lt;SPAN lang=en-us>
&lt;TABLE id=table5 style="BORDER-COLLAPSE: collapse"
borderColor=#111111 cellSpacing=0 cellPadding=0 width=420
bgColor=#e8e8ee border=0>
&lt;TBODY>
&lt;TR>
&lt;TD vAlign=bottom align=middle width="100%" bgcolor="#FFFFFF">&amp;nbsp;&lt;/TD>&lt;/TR>
&lt;TR>
&lt;TD width="100%" bgcolor="#FFFFFF">
&lt;font color="#FFFFFF">
&lt;SCRIPT language=JavaScript>
FadingText('fade1', 5,"E8E8EE");
FadeInterval=30;
&lt;/SCRIPT>

&lt;/font>

&lt;/TD>&lt;/TR>
&lt;TR>
&lt;TD width="100%" bgcolor="#FFFFFF">&amp;nbsp;&lt;/TD>&lt;/TR>&lt;/TBODY>&lt;/TABLE>&lt;/SPAN>
&lt;p>&amp;nbsp;&lt;/p>

&lt;/HTML>
 

pooyait

Member
البته اينم لينكش كه بتونيد عملي اونو ببينيد
فقط كافيه اونو Save As بزنيد تا براتون ذخيره بشه
wwww.pooya.info/jadid/pooya-it.htm
موفق باشيد
منتظر نظرتون هستم
 

mosi-online

Member
دادا كارت درسته... ايول..
الان كه خونه نيستم.. رفتم خونه تستش ميكنم... دستت درد نكنه..
قربونت...:X
(ولي ديدم تو كدها شكلك هم در اومده)
 

جدیدترین ارسال ها

بالا