function postreply(id)
{
//	alert (id);
	parent.document.getElementById('txtpostid').value=id;
	var urlanchor=String(parent.location);
	var spliturl=urlanchor.split('#');
	parent.location=spliturl[0]+'#top';
	
	parent.document.getElementById('pokertwittr').focus();
}

function iResizer()
{
	var iframeID='blogdetail',iframeName='blogdetail';
	
	
     moz=document.getElementById&&!document.all
     mozHeightOffset=50
//    document.getElementById(iframeID).width="100%"
    document.getElementById(iframeID).height=window.frames[iframeName].document.body.scrollHeight+(moz?mozHeightOffset:0)
}

function iFrameHeight() {
if(document.getElementById && !(document.all)) {
h = document.getElementById('blogdetail').contentDocument.body.scrollHeight;
document.getElementById('blogdetail').style.height = h;
}
else if(document.all) {
h = document.frames('blogdetail').document.body.scrollHeight;
document.all.blogdetail.style.height = h+30;
}
}

function Reload () 
{
	var f = document.getElementById('blogdetail');
	f.src = f.src;
}

function validateForm(form1)
{
	document.getElementById('err_count').innerHTML='';
	if (!checkemptystring(form1.pokertwittr.value,'Must fill it befor publish!'))
	{
		form1.pokertwittr.focus();
		return false;
	}

	return true;
	
}

function isPhoneNumber(s)
{
     // Check for correct phone number
     rePhoneNumber = new RegExp(/^\([1-9]\d{2}\)\s?\d{3}\-\d{4}$/);
     if (!rePhoneNumber.test(s)) {
          alert("Phone Number Must Be Entered As: (555) 555-1234");
          return false;
     }
	return true;
}

function textLimit(field, maxlen)
{
	if (field.value.length > maxlen)
	{
		field.value = field.value.substring(0, maxlen);
		alert('Only 250 characters Allowed in intro text');
		return false;
		
	}
	return true;
}

//checks valid date
function isValiddate(year,month,day,cursorFocus){
mydate = new Date(month + "/" + day + "/" + year);
if(parseInt(myDate.getDate()) != parseInt(day)){
alert("Invalid date");
cursorFocus.focus();
return false;
}
else
return true;
}

//checks valid time
function isValidTime(myTimeField){
timeValue = myTimeField.value.toUpperCase();
timeValue = ReplaceText(timeValue," ","");
if(timeValue.indexOf("PM") != -1 || timeValue.indexOf("AM") !=-1){
timeValue = ReplaceText(timeValue,"PM","PM");
timeValue = ReplaceText(timeValue,"AM","AM");
}
myTime = new Date("12/12/2000 " + timeValue)
if (myTime == "NaN" || myTime == "Invalid Date"){
alert("Not a valid time. (Use hh:mm AM)");
myTimeField.focus();
return false;
}
return timeValue;
}

//checks valid integer
function isValidInt(myNumStr){
	var myStr = '0123456789.';
	var myChar;
	for (i=0; i< myNumStr.length; i++){
		myChar = myNumStr.substring(i,i+1);
			if (myStr.indexOf(myChar) == -1){
				//alert("Please enter valid number");
				return false;
			}
		}
	return true;
}

//checks valid string
function isValidstring(myNumStr,msg){

var myStr = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ';
var myChar;
	for (i=0; i< myNumStr.length; i++){
	myChar = myNumStr.substring(i,i+1);
		if (myStr.indexOf(myChar) == -1){
		alert(msg);
		return false;
		}
	}
	return true;
}

/*
	for (i=0; i< myNumStr.length; i++){
	myChar = myNumStr.substring(i,i+1);
		if (myStr.indexOf(myChar) == -1){
		alert(msg);
		return false;
		}
	}
	return true;

*/
/////////////////////////////
function isValidstr(myNumStr){
var myStr = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_';
var myChar;
for (i=0; i< myNumStr.length; i++){
myChar = myNumStr.substring(i,i+1);
if (myStr.indexOf(myChar) == -1){
alert("Please enter valid string");
return false;
}
}
return true;
}
//checks valid family
function isValidfamily(myNumStr,msg){
var myStr = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ';
var myChar;
for (i=0; i< myNumStr.length; i++){
myChar = myNumStr.substring(i,i+1);
if (myStr.indexOf(myChar) == -1){
alert(msg);
return false;
}
}
return true;
}


//checks valid alpha numaric value
function isValidalnumaric(myNumStr){
var myStr = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.';
var myChar;
for (i=0; i< myNumStr.length; i++){
myChar = myNumStr.substring(i,i+1);
if (myStr.indexOf(myChar) == -1){
alert("Please enter valid number");
return false;
}
}
return true;
}

//checks valid decimal
function isValidDecimal(myNumStr){
var myStr = '0123456789.';
var myChar;
for (i=0; i< myNumStr.length; i++){
myChar = myNumStr.substring(i,i+1);
if (myStr.indexOf(myChar) == -1){
alert("Please enter valid number");
return false;
}
}
return true;
} //end fn isValidInt

//replace two texts
function ReplaceText(TextValue,Replace,ReplaceWith){
var l_Space=true;
var l_Index=0;
while (l_Space){
l_index=TextValue.indexOf(Replace,l_Index);
if(l_Index==-1){
l_Space=false;
}
else{
TextValue=TextValue.substring(0,l_Index) +ReplaceWith+TextValue.substring(l_Index+Replace.length,TextValue.length);    
l_Index=l_Index+ReplaceWith.length;
}
}
return TextValue;
}
function checkemptystring(strString,txtMsg)
{
	if(strString=="" || strString=="-1")
	{
		alert(txtMsg);
		return false;
	}
	else
		return true;
}
function isValidalnumaric1(myNumStr,txtmsg)
{
	var myStr = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_ ';
	var myChar;
	for (i=0; i< myNumStr.length; i++)
	{
		myChar = myNumStr.substring(i,i+1);
		if (myStr.indexOf(myChar) == -1)
		{
			alert(txtmsg);
			return false;
		}
	}
	return true;
}


//checks valid integer
/*function isValidZip(myNumStr){
	var myStr = '0123456789';
	var myChar;
	for (i=0; i< myNumStr.length; i++){
		myChar = myNumStr.substring(i,i+1);
			if (myStr.indexOf(myChar) == -1){
				return false;
			}
		}
	return true;
}*/

function isValidZip(myNumStr){
var myStr = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.';
var myChar;
for (i=0; i< myNumStr.length; i++){
myChar = myNumStr.substring(i,i+1);
if (myStr.indexOf(myChar) == -1){
//alert("Please enter valid number");
return false;
}
}
return true;
}


///////////////////////
//Check Email Validation
function emailvalid(email) 
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
	{
		return (true)
	}
		alert("Invalid Email Address")
		return (false)
}
//////Dynamic Message produce//////////////
function isValstring(myNumStr,msg){
var myStr = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
var myChar;
for (i=0; i< myNumStr.length; i++){
myChar = myNumStr.substring(i,i+1);
if (myStr.indexOf(myChar) == -1){
//alert("Please enter valid string");
return false;
}
}
return true;
}
///////////////////Email Validation////////////////
/**
 * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

function echeck(str)
{

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail Address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail Address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

 		 return true					
}						
//////////Validation of Admin Password
function adminpassword()
{
		if(window.document.form1.uname.value=="")
		{
			alert("Please enter the Account Name!");
			window.document.form1.uname.focus();
			return false;
		}
		var emailID=document.form1.email
		if ((emailID.value==null)||(emailID.value=="")){
			alert("Please Enter Account Email ID")
			emailID.focus()
			return false
		}
		if (echeck(emailID.value)==false){
			emailID.value=""
			emailID.focus()
			return false
		}
		if(window.document.form1.password.value=="")
		{
			alert("Please Enter the Password!");
			window.document.form1.password.focus();
			return false;
		}
		if(window.document.form1.password.value != window.document.form1.conpass.value)
		{
			alert("Please enter the Same Password!");
			window.document.form1.conpass.focus();
			return false;
		}				
		return true;
}
////////////////////////////////						
function c()
{	
		if(window.document.form1.uname.value=="")
		{
			alert("Please enter the Account Name!");
			window.document.form1.uname.focus();
			return false;
		}
		var emailID=document.form1.email
		if ((emailID.value==null)||(emailID.value=="")){
			alert("Please Enter Account Email ID")
			emailID.focus()
			return false;
		}
		if (echeck(emailID.value)==false){
			emailID.value=""
			emailID.focus()
			return false
		}
		if(window.document.form1.password.value =="")
		{
			alert("Please Enter the Password!");
			window.document.form1.password.focus();
			return false;
		}
		if(window.document.form1.password.value != window.document.form1.cpass.value)
		{
			alert("Please Enter the Same Password!");
			window.document.form1.cpass.focus();
			return false;
		}
				return true;
}
//////////Validation of Configuration Page
function configvaild()
{
		if(window.document.form2.atr.value=="")
		{
			alert("Please Enter the Server Side Variable!");
			window.document.form2.atr.focus();
			return false;
		}
		if(window.document.form2.comname.value=="")
		{
			alert("Please Enter the Company Name!");
			window.document.form2.comname.focus();
			return false;
		}
		else if(!isValidstring(form2.comname.value))
		{
			window.document.form2.comname.focus();
			return false;
		}
		return true;
}
//////////Validation of Approval Review Page
function appreview()
{
	var my_car=document.form1.p1.value;				
	var len =my_car.length ;
	var leng= len - 4;
	var s = my_car.substr(leng,len)
	/////////Image 2//////////////
	var my_car2=document.form1.p2.value;				
	var len2 =my_car2.length ;
	var leng2= len2 - 4;
	var s2 = my_car2.substr(leng2,len2)
	////////////Image 3/////////////
	var my_car3=document.form1.p3.value;				
	var len3 =my_car3.length ;
	var leng3= len3 - 4;
	var s3 = my_car3.substr(leng3,len3)
	/////Image 4/////////////////////
	var my_car4=document.form1.p4.value;				
	var len4 =my_car4.length ;
	var leng4= len4 - 4;
	var s4 = my_car4.substr(leng4,len4)
	///////////////////////////
		if(s!="" && s!= ".jpg" && s!=".JPG")
		{
			alert("Please enter the JPEG Only!");
			window.document.form1.p1.focus();
			return false;
		}
		if(s2!="" && s2!= ".jpg" && s2!=".JPG")
		{
			alert("Please enter the JPEG Only!");
			window.document.form1.p2.focus();
			return false;
		}
		if(s3!="" && s3!= ".jpg" && s3!=".JPG")
		{
			alert("Please enter the JPEG Only!");
			window.document.form1.p3.focus();
			return false;
		}
		if(s4!="" && s4!= ".jpg" && s4!=".JPG")
		{
			alert("Please enter the JPEG Only!");
			window.document.form1.p4.focus();
			return false;
		}
		if(window.document.form1.name.value=="")
		{
			alert("Please enter your name!");
			window.document.form1.name.focus();
			return false;
		}
		else if(!isValidstring(form1.name.value))
		{
			window.document.form1.name.focus();
			return false;
		}
		var emailID=document.form1.email
		if ((emailID.value==null)||(emailID.value=="")){
			alert("Please enter your email address")
			emailID.focus()
			return false
		}
		if (echeck(emailID.value)==false){
			emailID.value=""
			emailID.focus()
			return false
		}
		if(window.document.form1.subject.value=="")
		{
			alert("Please Enter the Review Subject!");
			window.document.form1.subject.focus();
			return false;
		}
		if(window.document.form1.location.value=="")
		{
			alert("Please enter your location!");
			window.document.form1.location.focus();
			return false;
		}
		if(window.document.form1.zip.value=="")
		{
			alert("Please Enter the Zip Code!");
			window.document.form1.zip.focus();
			return false;
		}
		else if(!isValidZip(form1.zip.value))
		{
			alert("Zip Code can only contain Alphanumeric numbers!");
			window.document.form1.zip.focus();
			return false;
		}
		if(window.document.form1.title.value=="")
		{
			alert("Please Enter the Review Title!");
			window.document.form1.title.focus();
			return false;
		}
		if(window.document.form1.intro.value=="")
		{
			alert("Please Enter the Review Introduction!");
			window.document.form1.intro.focus();
			return false;
		}
		return true;
}
//////////Validation of New Review Page
function newreview()
{
			var my_car=document.form1.p1.value; 
			var len =my_car.length ;
			var leng= len - 4;
			var s = my_car.substr(leng,len)
			/////////Image 2//////////////
			var my_car2=document.form1.p2.value;				
			var len2 =my_car2.length ;
			var leng2= len2 - 4;
			var s2 = my_car2.substr(leng2,len2)
			////////////Image 3/////////////
			var my_car3=document.form1.p3.value;				
			var len3 =my_car3.length ;
			var leng3= len3 - 4;
			var s3 = my_car3.substr(leng3,len3)
			/////Image 4/////////////////////
			var my_car4=document.form1.p4.value;				
			var len4 =my_car4.length ;
			var leng4= len4 - 4;
			var s4 = my_car4.substr(leng4,len4)
			///////////////////////////
		if(s!="" && s!= ".jpg" && s!=".JPG")
		{
			alert("Please enter the JPEG Only!");
			window.document.form1.p1.focus();
			return false;
		}
		if(s2!="" && s2!= ".jpg" && s2!=".JPG")
		{
			alert("Please enter the JPEG Only!");
			window.document.form1.p2.focus();
			return false;
		}
		if(s3!="" && s3!= ".jpg" && s3!=".JPG")
		{
			alert("Please enter the JPEG Only!");
			window.document.form1.p3.focus();
			return false;
		}
		if(s4!="" && s4!= ".jpg" && s4!=".JPG")
		{
			alert("Please enter the JPEG Only!");
			window.document.form1.p4.focus();
			return false;
		}
		if(window.document.form1.name.value=="")
		{
			alert("Please enter your name!");
			window.document.form1.name.focus();
			return false;
		}
		else if(!isValidstring(form1.name.value))
		{
			window.document.form1.name.focus();
			return false;
		}
		var emailID=document.form1.email
		if ((emailID.value==null)||(emailID.value=="")){
			alert("Please enter your email address")
			emailID.focus()
			return false
		}
		if (echeck(emailID.value)==false){
			emailID.value=""
			emailID.focus()
			return false
		}
		if(window.document.form1.subject.value=="")
		{
			alert("Please Enter the Review Subject!");
			window.document.form1.subject.focus();
			return false;
		}
		if(window.document.form1.location.value=="")
		{
			alert("Please enter your location!");
			window.document.form1.location.focus();
			return false;
		}
		if(window.document.form1.zip.value=="")
		{
			alert("Please Enter the Zip Code!");
			window.document.form1.zip.focus();
			return false;
		}
		else if(!isValidZip(form1.zip.value))
		{
			alert("Zip Code can only contain Alphanumeric numbers!");
			window.document.form1.zip.focus();
			return false;
		}
		if(window.document.form1.title.value=="")
		{
			alert("Please Enter the Review Title!");
			window.document.form1.title.focus();
			return false;
		}
		if(window.document.form1.intro.value=="")
		{
			alert("Please Enter the Review Introduction!");
			window.document.form1.intro.focus();
			return false;
		}
		return true;
}
/////////////////Validation on Preview Page
function checkpreview()
{
	var emailID=document.f1.email
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	if (emailID.value.length>128)
	{
		alert("Please enter less then 128 characters in email address!");
		emailID.focus()
		return false
	}
	
	return true;
}
/////////Validation of Intro Text////////////
function ok(maxchars) {
 if(window.document.f1.intro.value.length > maxchars) {
   alert('Too much data in the text box! Please remove '+
    (window.document.f1.intro.value.length - maxchars)+ ' characters');
   return false; }
 else
   return true; 
 }
//////////////Pictures Performing Validation//////////
var rem_last=1;
function changeMultiple()
{
	var str,str1;
	var val, rest_recipients;
	var no_of_recipients=document.f1.no_of_recipients.options[document.f1.no_of_recipients.selectedIndex].value;
	var flag=0;
	rest_recipients=parseInt(no_of_recipients);
	var select=no_of_recipients;
		for(i=rest_recipients; i<=4; i++)
		{
			if(document.getElementById('rname'+i).value)
			{ 
			 flag=1; 
			 select++;
			}
		 }
	 
		for(k=1; k<=no_of_recipients; k++)
		{
		if(navigator.appName=='Microsoft Internet Explorer')
			document.getElementById("tdrow"+k).style.display="block";
		document.getElementById("tdrname"+k).style.display="block";
	//	document.getElementById("tdremail"+k).style.display="block";
		}
		for(i=k;i<=4;i++)
		{
		if(navigator.appName=='Microsoft Internet Explorer')
		document.getElementById("tdrow"+i).style.display="none";
		document.getElementById("tdrname"+i).style.display="none";
	//	document.getElementById("tdremail"+i).style.display="none";
	 //   document.getElementById("fe"+i).innerHTML=str;
	//	str1='<font face=Verdana size=2 color=#000080></font>';
	//    document.getElementById("fn"+i).innerHTML=str1;

		}
	
	rem_last=select;
}
///CheckBox validation////////////////
function allow(theForm) {
   var field = theForm.subject
	if(theForm.subj.checked)
	{
		theForm.subject.disabled=false;

	}
	else
	{
			theForm.subject.disabled=true;
			theForm.subject.value=theForm.h.value;		
	}
  // var dis = theForm.subj.unchecked;
//   var field = theForm.subject
//   if (dis) field.value=""; /* remove this line to keep the contents after disabling */
//   		field.disabled=dis;
}  
/////////////Validation Of Toggles////////
var ie4 = false; if(document.all) { ie4 = true; }
function getObject(id) { if (ie4) { return document.all[id]; } else { return document.getElementById(id); } }
function toggle(link, divId) { 
	var lText = link.innerHTML; 
	var d = getObject(divId);
 	if (lText == '+') 
	{ 
		link.innerHTML = '&#8722;'; 
		d.style.display = 'block'; 
	}
 	else 
	{ 
		link.innerHTML = '+'; d.style.display = 'none'; 
	} 
}

function toggleinsertion(link, divId) { 
	var lText = link.innerHTML; 

	var d = getObject(divId);
 	if (lText == 'Add Review') 
	{ 
		link.innerHTML = '&#8722;'; 
		d.style.display = 'block'; 
//			alert(d.style.display='none');
	}
	 else 
	 { 
	 	link.innerHTML = 'Add Review'; 
		d.style.display = 'none'; 
	} 
}
/*This function will make all checkboxes on the form checked or unchecked*/
function checkAllOne(CheckBoxControl,formname)
{
	if(CheckBoxControl.checked == true)   
	{
		var i = 0;
		var j = 1;
	
		for (i=1; i < formname.elements.length; i++) 
		{	
			if(formname.elements[i].name == "chkbox" + j)
			{	
				formname.elements[i].checked = true;
				j++;
			}
		}
	}
	
	else if(CheckBoxControl.checked == false)
	{
		var i = 0;
		var j = 1;
		
		for (i=1; i < formname.elements.length; i++) 
		{
			if(formname.elements[i].name == "chkbox" +j)
			{
				formname.elements[i].checked = false;
				j++;
			}
		}
	}
}
function windowOpenResize(file,height,width)
{
	//alert(file)
	window.open(file,'Detail', 'status = 1, height = '+ height + ', width =' + width +', resizable=0,scrollbars=1,left=125,top=100');	
}
function windOpen(file,height,width)
{
	//alert(file)
	window.open(file,'Detail', 'status = 1, height = '+ height + ', width =' + width +', resizable=0,scrollbars=0,left=125,top=100');	
}

function windowOpen(file)
{
	//alert(file)
	window.open(file,'Detail', 'status = 1, height = 500, width =740, resizable=0,scrollbars=1,left=125,top=100');	
}