//<---------Persian star rating------------->.
//This Script written by Hossein alinejad
//my email : Halinejad@gmailc.com
//This script is freeware. You can use it as free.
//http://www.pcwsoft.com
//<---------Persian star rating------------->.
var nowindex,firsttabset=true,star_on="assets/images/star/rating_on.gif",imgArray=new Array();
//-----------on stars to
function nowimg_status()
{
var i;	
imgArray[0]=document.getElementById("m1").style.backgroundImage;
imgArray[1]=document.getElementById("m2").style.backgroundImage;
imgArray[2]=document.getElementById("m3").style.backgroundImage;
imgArray[3]=document.getElementById("m4").style.backgroundImage;
imgArray[4]=document.getElementById("m5").style.backgroundImage;
//for(i=0;i<=4;i++)
// document.write(get_imgurl(imgArray[i]));
//i1.style.backgroundImage ="url("+ scrs +")";
}
function tabset(newindex)//index & newindex = images
{
 if(firsttabset)
 {
  nowimg_status();
  firsttabset=false;
 }
 var temp,i,va,vv,last,stt;
 //temp=document.getElementById(newindex).src;
 //exchange_image(newindex,index,false);
 //self.status = " ";
 va=new String(newindex); 
 vv=va.length;
 last = va.charAt(vv-1)
 for(i=1;i<=last;i++)
 {
 // document.write(str);
  newindex=new String("m"+i);
  //document.write(newindex);
  exch_image(newindex,star_on);
 }
 //exchange_image(index,temp,true);
 nowindex=newindex; 
}
//------------off stars to
function mosut_off()
{
var i,va,vv,last,old,poit;
 va=new String(nowindex); 
 vv=va.length;
 last = va.charAt(vv-1)
 for(i=1;i<=last;i++)
 { 
 // document.write(str);
  poit=i-1;
  old=imgArray[poit];
  nowindex=new String("m"+i);
  //document.write(newindex);
  exch_image(nowindex,get_imgurl(old));
 }

}
//--------------------------
function exch_image(image1,scrs)
{
var i1; 
/*i1=document.getElementById(image1);
//exchenghe by image1 by id with scr
i1.src=scrs;*/
i1=document.getElementById(image1);
i1.style.backgroundImage ="url("+ scrs +")";
}
//----------
function tst()
{
var i;
for(i=0;i<=4;i++)
 document.write(get_imgurl(imgArray[i]));
}
//---------------------------------------
function get_vote(itm,imgid)
{
//-----------------
// hideBranch("starsr");
//-----------------
Hfil=document.getElementById(itm);
if (imgid=="m1")
 Hfil.value=1;
if (imgid=="m2")
 Hfil.value=2;
if (imgid=="m3")
 Hfil.value=3;
if (imgid=="m4")
 Hfil.value=4; 
if (imgid=="m5")
 Hfil.value=5; 
}
function get_imgurl(url)
{
var urls,lst,tmp;
urls=new String(url); 
lst=(urls.length)-1;
tmp=urls.substring(4,lst);
return tmp;
}
function var_Exist(varName)
{
if(typeof(varName) == 'undefined')
 return false;
else 
 return true;
} 
function Star_Box(ID)
{
if(var_Exist(ID))//varha mojod
{
if(ID!="")
{
var locat_Url=window.top.location;	
document.write('<iframe frameborder="0" scrolling="no" src="FB_Write.inc.php?Id='+ID+'" align="right" id="maineditor" style="height:39px; width:130px;"></iframe>');
}
}
}